truncate_lines_and_trailoff

Function truncate_lines_and_trailoff 

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

Takes only max_lines from the string and, if there were more than max_lines-1, appends a a newline and “…” to the string, so that max_lines are returned. Returns string unchanged if its length is smaller than max_lines.