[][src]Function ascii::caret_encode

pub fn caret_encode<C: Copy + Into<u8>>(c: C) -> Option<AsciiChar>

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));