Function std::ascii::escape_default [] [src]

pub fn escape_default(c: u8) -> EscapeDefault

Returns an iterator that produces an escaped version of a u8.

The default is chosen with a bias toward producing literals that are legal in a variety of languages, including C++11 and similar C-family languages. The exact rules are:

Examples

use std::ascii;

let escaped = ascii::escape_default(b'0').next().unwrap();
assert_eq!(b'0', escaped);

let mut escaped = ascii::escape_default(b'\t');

assert_eq!(b'\\', escaped.next().unwrap());
assert_eq!(b't', escaped.next().unwrap());