fn decode_escaped_unicode(&self, s: &[u8]) -> Result<Value> {
        let mut result = String::with_capacity(s.len());
        let mut iter = s.iter();
        while let Some(&b) = iter.next() {
            match b {
                b'\\' => {
                    let nescape = match iter.next() {
                        Some(&b'u') => 4,
                        Some(&b'U') => 8,
                        _ => return self.error(ErrorCode::InvalidLiteral(s.into())),
                    };
                    let mut accum = 0;
                    for _i in 0..nescape {
                        accum *= 16;
                        match iter.next().and_then(|&ch| (ch as char).to_digit(16)) {
                            Some(v) => accum += v,
                            None => return self.error(ErrorCode::InvalidLiteral(s.into()))
                        }
                    }
                    match char::from_u32(accum) {
                        Some(v) => result.push(v),
                        None => return self.error(ErrorCode::InvalidLiteral(s.into()))
                    }
                }
                _ => result.push(b as char)
            }
        }
        Ok(Value::String(result))
    }
// Decode escaped Unicode strings. These are encoded with "raw-unicode-escape",
// which only knows the \uXXXX and \UYYYYYYYY escapes. The backslash is escaped
// in this way, too.
Decode escaped Unicode strings. These are encoded with "raw-unicode-escape",
which only knows the \uXXXX and \UYYYYYYYY escapes. The backslash is escaped
in this way, too.
Decode escaped Unicode strings . These are encoded with " raw - unicode - escape " which only knows the \ uXXXX and \ UYYYYYYYY escapes . The backslash is escaped in this way too .
fn decode_escaped_unicode(&self, s: &[u8]) -> Result<Value> {
        let mut result = String::with_capacity(s.len());
        let mut iter = s.iter();
        while let Some(&b) = iter.next() {
            match b {
                b'\\' => {
                    let nescape = match iter.next() {
                        Some(&b'u') => 4,
                        Some(&b'U') => 8,
                        _ => return self.error(ErrorCode::InvalidLiteral(s.into())),
                    };
                    let mut accum = 0;
                    for _i in 0..nescape {
                        accum *= 16;
                        match iter.next().and_then(|&ch| (ch as char).to_digit(16)) {
                            Some(v) => accum += v,
                            None => return self.error(ErrorCode::InvalidLiteral(s.into()))
                        }
                    }
                    match char::from_u32(accum) {
                        Some(v) => result.push(v),
                        None => return self.error(ErrorCode::InvalidLiteral(s.into()))
                    }
                }
                _ => result.push(b as char)
            }
        }
        Ok(Value::String(result))
    }
fn decode_escaped_unicode ( & self , s : & [ u8 ] ) -> Result < Value > { let mut result = String :: with_capacity ( s . len ( ) ) ; let mut iter = s . iter ( ) ; while let Some ( & b ) = iter . next ( ) { match b { b'\\' => { let nescape = match iter . next ( ) { Some ( & b'u' ) => 4 , Some ( & b'U' ) => 8 , _ => return self . error ( ErrorCode :: InvalidLiteral ( s . into ( ) ) ) , } ; let mut accum = 0 ; for _i in 0 .. nescape { accum *= 16 ; match iter . next ( ) . and_then ( | & ch | ( ch as char ) . to_digit ( 16 ) ) { Some ( v ) => accum += v , None => return self . error ( ErrorCode :: InvalidLiteral ( s . into ( ) ) ) } } match char :: from_u32 ( accum ) { Some ( v ) => result . push ( v ) , None => return self . error ( ErrorCode :: InvalidLiteral ( s . into ( ) ) ) } } _ => result . push ( b as char ) } } Ok ( Value :: String ( result ) ) }
Decode escaped Unicode strings.
Decode escaped Unicode strings .
&self
s
&[u8]
&self
s
&[u8]