1 2 3 4 5 6
pub(crate) fn sanitize(bytes: &[u8]) -> String { String::from_utf8_lossy(bytes) .chars() .filter(|character| !character.is_control() || matches!(character, '\n' | '\r' | '\t')) .collect() }