/// Takes in a string of a backslash escaped character
/// and convert it to the proper escaped character.
Takes in a string of a backslash escaped character
and convert it to the proper escaped character.
Takes in a string of a backslash escaped character and convert it to the proper escaped character .
pub(crate) fn unescape(s: &str) -> Option<char> {
    let mut queue: VecDeque<_> = s.chars().collect();
    if queue.pop_front().unwrap() != '\\' {
        return None;
    }
    queue.pop_front().and_then(|ch| match ch {
        'b' => Some('\u{0008}'),
        'f' => Some('\u{000C}'),
        'n' => Some('\n'),
        'r' => Some('\r'),
        't' => Some('\t'),
        '\'' => Some('\''),
        '\"' => Some('\"'),
        '\\' => Some('\\'),
        'u' => unescape_unicode(&mut queue),
        'x' => unescape_byte(&mut queue),
        c if c.is_digit(8) => unescape_octal(c, &mut queue),
        _ => None,
    })
}
pub ( crate ) fn unescape ( s : & str ) -> Option < char > { let mut queue : VecDeque < _ > = s . chars ( ) . collect ( ) ; if queue . pop_front ( ) . unwrap ( ) != '\\' { return None ; } queue . pop_front ( ) . and_then ( | ch | match ch { 'b' => Some ( '\u{0008}' ) , 'f' => Some ( '\u{000C}' ) , 'n' => Some ( '\n' ) , 'r' => Some ( '\r' ) , 't' => Some ( '\t' ) , '\'' => Some ( '\'' ) , '\"' => Some ( '\"' ) , '\\' => Some ( '\\' ) , 'u' => unescape_unicode ( & mut queue ) , 'x' => unescape_byte ( & mut queue ) , c if c . is_digit ( 8 ) => unescape_octal ( c , & mut queue ) , _ => None , } ) }
Takes in a string of a backslash escaped character
and convert it to the proper escaped character.
Takes in a string of a backslash escaped character and convert it to the proper escaped character .
s
&str