Skip to main content

escape_bytes

Function escape_bytes 

Source
pub fn escape_bytes<W: Write + ?Sized>(bytes: &[u8], w: &mut W) -> Result
Available on crate feature text only.
Expand description

Write bytes as a double-quoted textproto string literal to w.

Printable ASCII passes through unchanged except for " and \, which are escaped. All other bytes (control characters, 0x7F, high-bit bytes) are emitted as \NNN three-digit octal escapes. This produces pure-ASCII output regardless of the input bytes.

ยงErrors

Propagates core::fmt::Error from the underlying writer.