Function truncate_chars
Source pub fn truncate_chars(s: &str, max_chars: usize) -> String
Expand description
Truncate a string to a maximum character count, adding “…” if truncated.
This is useful for simple text truncation where unicode display width
isn’t critical (e.g., log previews, notifications).
§Example
ⓘlet result = truncate_chars("Hello, World!", 8);
assert_eq!(result, "Hello...");