5 stable releases

1.1.0 Jul 1, 2021
1.0.3 Jul 17, 2018

#36 in Value formatting

Download history 13697/week @ 2024-07-23 17144/week @ 2024-07-30 15553/week @ 2024-08-06 12021/week @ 2024-08-13 16669/week @ 2024-08-20 17883/week @ 2024-08-27 16636/week @ 2024-09-03 16369/week @ 2024-09-10 15229/week @ 2024-09-17 16024/week @ 2024-09-24 14499/week @ 2024-10-01 16544/week @ 2024-10-08 18716/week @ 2024-10-15 17069/week @ 2024-10-22 19124/week @ 2024-10-29 18717/week @ 2024-11-05

76,489 downloads per month
Used in 59 crates (24 directly)

Unlicense

7KB
105 lines

enquote crate docs

This Rust library quotes, unquotes, and unescapes strings.

Example

extern crate enquote;

fn main() {
    assert_eq!(enquote::enquote('\'', "foo'bar"), "'foo\\'bar'");
    assert_eq!(enquote::unquote("'foo\\'bar\\n'").unwrap(), "foo'bar\n");
    assert_eq!(enquote::unescape("\\n", None).unwrap(), "\n");
}

lib.rs:

This Rust library quotes, unquotes, and unescapes strings.

Examples

extern crate enquote;

fn main() {
    assert_eq!(enquote::enquote('\'', "foo'bar"), "'foo\\'bar'");
    assert_eq!(enquote::unquote("'foo\\'bar\\n'").unwrap(), "foo'bar\n");
    assert_eq!(enquote::unescape("\\n", None).unwrap(), "\n");
}

Dependencies

~260–720KB
~17K SLoC