Skip to main content

truncate_content

Function truncate_content 

Source
fn truncate_content(content: &str, max_len: usize) -> Cow<'_, str>
Expand description

Truncates content to a maximum length.

ยงPerformance

Returns Cow::Borrowed when no truncation is needed (zero allocation). Only allocates when truncation is required.