parquet::column::writer

Function truncate_utf8

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

Truncate a UTF-8 slice to the longest prefix that is still a valid UTF-8 string, while being less than length bytes and non-empty. Returns None if truncation is not possible within those constraints.

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