Skip to main content

truncate_context

Function truncate_context 

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

Truncate a string to approximately max_len characters with " ... " in the middle.

If the string is shorter than or equal to max_len, returns it unchanged. Uses char_indices() for Unicode safety.