pub fn truncate_string(str: String, range: Range<u64>) -> StringExpand description
Truncates an owned string 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 leaves it intact; an invalid or empty range panics.