5 stable releases

1.1.0 Jul 1, 2021
1.0.3 Jul 17, 2018

#27 in Parser tooling

Download history 868/week @ 2021-04-09 847/week @ 2021-04-16 902/week @ 2021-04-23 784/week @ 2021-04-30 548/week @ 2021-05-07 484/week @ 2021-05-14 462/week @ 2021-05-21 456/week @ 2021-05-28 423/week @ 2021-06-04 488/week @ 2021-06-11 382/week @ 2021-06-18 450/week @ 2021-06-25 605/week @ 2021-07-02 531/week @ 2021-07-09 1138/week @ 2021-07-16 2636/week @ 2021-07-23

2,567 downloads per month
Used in 29 crates (13 directly)

Unlicense

6KB
111 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

~365–800KB
~20K SLoC