Function truncate_and_increment_utf8

Source
fn truncate_and_increment_utf8(data: &str, length: usize) -> Option<Vec<u8>>
Expand description

Truncate a UTF-8 slice and increment it’s final character. The returned value is the longest such slice that is still a valid UTF-8 string while being less than length bytes and non-empty. Returns None if no such transformation is possible.

The caller guarantees that data.len() > length.