Skip to main content

truncate_to_width

Function truncate_to_width 

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

Truncate s so its display width is at most max_cols. Guaranteed to return a valid UTF-8 string that never splits a grapheme.