pub fn truncate_str(s: &str, max_bytes: usize) -> &str
Safely truncate a string to at most max_bytes bytes without splitting a multi-byte UTF-8 character. Returns the full string if it’s already within the limit.
max_bytes