pub fn truncate_str(str: &str, range: Range<u64>) -> &strExpand description
Borrows a prefix ending at a randomly selected character count.
The count is sampled from the half-open range and never splits a UTF-8 scalar. A count at or beyond the string’s character count returns the full input; an invalid or empty range panics.