Skip to main content

truncate_to_bytes

Function truncate_to_bytes 

Source
pub fn truncate_to_bytes(s: &str, max_bytes: usize) -> &str
Expand description

Truncate a string to at most max_bytes bytes while preserving UTF-8 validity.