Skip to main content

bounded_bytes

Function bounded_bytes 

Source
pub fn bounded_bytes(token: &[u8]) -> Cow<'_, str>
Expand description

bounded for bytes that are not known to be UTF-8.

The cut happens before the decoding rather than after it, so a user-id the size of a field section is never allocated whole just to be thrown away. Whatever character the cut lands inside becomes U+FFFD, which is what every other byte an invalid user-id is made of becomes anyway.