pub fn unescape(literal: impl IntoBuf, dst: &mut Vec<u8>)Expand description
Expands escape sequences in the content of a valid JSON string.
The Buf to unescape must contain the literal content of a valid JSON string value, as it
appears in the JSON text (with or without the surrounding double quotation mark characters).
The unescaped text is appended to the given byte vector.
§Panics
Panics if the input Buf contains an invalid or unterminated JSON escape sequence.
§Examples
Unescape a string with surrounding double quote characters…
use bufjson::{Buf, lexical::unescape};
let mut dst = Vec::new();
unescape(r#""foo\nbar""#, &mut dst);
assert_eq!(
&br#""foo
bar""#[..],
&dst);…Or without them…
use bufjson::{Buf, lexical::unescape};
let mut dst = Vec::new();
unescape(r#"hello\u002c\u0020world"#, &mut dst);
assert_eq!(&b"hello, world"[..], &dst);