/// Check whether a Rust string contains valid CESU-8 data.
Check whether a Rust string contains valid CESU-8 data.
Check whether a Rust string contains valid CESU - 8 data .
pub fn is_valid_cesu8(text: &str) -> bool {
    // We rely on the fact that Rust strings are guaranteed to be valid
    // UTF-8.
    for b in text.bytes() {
        if (b & !CONT_MASK) == TAG_CONT_U8 { continue; }
        if utf8_char_width(b) > 3 { return false; }
    }
    true
}
pub fn is_valid_cesu8 ( text : & str ) -> bool { // We rely on the fact that Rust strings are guaranteed to be valid // UTF-8. for b in text . bytes ( ) { if ( b & ! CONT_MASK ) == TAG_CONT_U8 { continue ; } if utf8_char_width ( b ) > 3 { return false ; } } true }
Check whether a Rust string contains valid CESU-8 data.
Check whether a Rust string contains valid CESU - 8 data .
text
&str