[][src]Crate escape8259

escape8259 performs RFC8259-compliant string escaping and un-escaping.

RFC8259 is a JSON encoding standard. Many JSON encoders exist, but other RFCs use the same string escaping mechanism, so it's useful to be able to access the string escaping functions by themselves.

Examples

use escape8259::{escape, unescape};

assert_eq!(unescape(r#"\u0041\n"#).unwrap(), "A\n");

let multiline = r#"hello
 world"#;
assert_eq!(escape(multiline), r#"hello\n world"#);

Structs

UnescapeError

An error occurred while

Functions

escape

Escape a string, following RFC8259 rules.

unescape

Un-escape a string, following RFC8259 rules.