/// Find the length of the string in characters.
/// If the length matches the length in bytes, the string must be 7bit ASCII.
Find the length of the string in characters.
If the length matches the length in bytes, the string must be 7bit ASCII.
Find the length of the string in characters . If the length matches the length in bytes the string must be 7bit ASCII .
pub fn len(x: &str) -> usize {
    let n = skip_at_most_1byte(x, x.len());
    if n == x.len() {
        n // All 1 byte
    } else {
        unsafe { x.get_unchecked(n..) }.chars().count() + n
    }
}
pub fn len ( x : & str ) -> usize { let n = skip_at_most_1byte ( x , x . len ( ) ) ; if n == x . len ( ) { n // All 1 byte } else { unsafe { x . get_unchecked ( n .. ) } . chars ( ) . count ( ) + n } }
Find the length of the string in characters.
Find the length of the string in characters .
x
&str