Function truncate_string
Source pub fn truncate_string(s: &str, max_width: usize) -> String
Expand description
Truncate a string to fit within a maximum display width
Handles Unicode properly by counting graphemes, not bytes.
Adds ellipsis if truncation occurs.
§Arguments
s - The string to truncate
max_width - Maximum display width in characters
§Returns
The truncated string, or the original if it fits