Function console::truncate_str
source ยท pub fn truncate_str<'a>(s: &'a str, width: usize, tail: &str) -> Cow<'a, str>
Expand description
Truncates a string to a certain number of characters.
This ensures that escape codes are not screwed up in the process. If the maximum length is hit the string will be truncated but escapes code will still be honored. If truncation takes place the tail string will be appended.