pub(crate) fn truncate(buf: &str, approx_chars: usize) -> Cow<'_, str>
Shortens a string to a specified length and adds “[…]” to the end of the shortened string.