Skip to main content

truncate

Function truncate 

Source
pub fn truncate(s: &str, max: usize) -> String
Expand description

Truncate a string to a maximum length, appending “…” if truncated.

Uses char-aware slicing to avoid panicking on multi-byte UTF-8 boundaries.