Skip to main content

truncate_str

Function truncate_str 

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

Boundary-safe version of &s[..max_bytes]: truncates to the largest char boundary at or below max_bytes. Never panics.