pub fn escape_char(c: u8) -> Option<Cow<'static, [u8]>> {
    match c {
        b'\n' => Some((&b"\\n"[..]).into()),
        b'\r' => Some((&b"\\r"[..]).into()),
        b'\t' => Some((&b"\\t"[..]).into()),
        b'\\' => Some((&b"\\\\"[..]).into()),
        b'"' => Some((&b"\\\""[..]).into()),
        b'$' => None,
        c if is_lit_printable(c) => None,
        c => {
            let mut r = vec![];
            write!(r, "\\{:03o}", c).unwrap();
            Some(r.into())
        }
    }
}
/// This escapes a string using the format understood by the assembler
/// and php serialization. The assembler and php serialization probably
/// don't actually have the same rules but this should safely fit in both.
/// It will escape $ in octal so that it can also be used as a PHP double
/// string.
This escapes a string using the format understood by the assembler
and php serialization. The assembler and php serialization probably
don't actually have the same rules but this should safely fit in both.
It will escape $ in octal so that it can also be used as a PHP double
string.
This escapes a string using the format understood by the assembler and php serialization . The assembler and php serialization probably don ' t actually have the same rules but this should safely fit in both . It will escape $ in octal so that it can also be used as a PHP double string .
pub fn escape_char(c: u8) -> Option<Cow<'static, [u8]>> {
    match c {
        b'\n' => Some((&b"\\n"[..]).into()),
        b'\r' => Some((&b"\\r"[..]).into()),
        b'\t' => Some((&b"\\t"[..]).into()),
        b'\\' => Some((&b"\\\\"[..]).into()),
        b'"' => Some((&b"\\\""[..]).into()),
        b'$' => None,
        c if is_lit_printable(c) => None,
        c => {
            let mut r = vec![];
            write!(r, "\\{:03o}", c).unwrap();
            Some(r.into())
        }
    }
}
pub fn escape_char ( c : u8 ) -> Option < Cow < ' static , [ u8 ] > > { match c { b'\n' => Some ( ( & b" \\ " [ .. ] ) . into ( ) ) , b'\r' => Some ( ( & b" \\ " [ .. ] ) . into ( ) ) , b'\t' => Some ( ( & b" \\ " [ .. ] ) . into ( ) ) , b'\\' => Some ( ( & b" \\ \\ " [ .. ] ) . into ( ) ) , b'"' => Some ( ( & b" \\ \" " [ .. ] ) . into ( ) ) , b'$' => None , c if is_lit_printable ( c ) => None , c => { let mut r = vec ! [ ] ; write ! ( r " \\ " c ) . unwrap ( ) ; Some ( r . into ( ) ) } } }
This escapes a string using the format understood by the assembler
and php serialization.
This escapes a string using the format understood by the assembler and php serialization .
c
u8
c
u8