pub fn caret_encode<C: Copy + Into<u8>>(c: C) -> Option<AsciiChar>
Expand description
Terminals use caret notation to display some typed control codes, such as ^D for EOT and ^Z for SUB.
This function returns the caret notation letter for control codes,
or None
for printable characters.
ยงExamples
assert_eq!(caret_encode(b'\0'), Some(AsciiChar::At));
assert_eq!(caret_encode(AsciiChar::DEL), Some(AsciiChar::Question));
assert_eq!(caret_encode(b'E'), None);
assert_eq!(caret_encode(b'\n'), Some(AsciiChar::J));