Implement a string processing function with specific constraints.
Given a string s, return the length of its longest contiguous substring containing no repeated characters. The function must handle letters, digits, spaces, and symbols as distinct characters. Return 0 for an empty string.
Function: longest_unique_substring(s)
Examples: "abcabcbb" returns 3, and "bbbbb" returns 1.
Constraints: 0 <= len(s) <= 10^5; all input characters are valid string characters.
def longest_unique_substring(s):