5 stable releases

1.1.0 Jul 1, 2021
1.0.3 Jul 17, 2018

#37 in Value formatting

Download history 13327/week @ 2024-08-09 12902/week @ 2024-08-16 19015/week @ 2024-08-23 17461/week @ 2024-08-30 15915/week @ 2024-09-06 16231/week @ 2024-09-13 14669/week @ 2024-09-20 15674/week @ 2024-09-27 15505/week @ 2024-10-04 17648/week @ 2024-10-11 19053/week @ 2024-10-18 17686/week @ 2024-10-25 18810/week @ 2024-11-01 17558/week @ 2024-11-08 17381/week @ 2024-11-15 15172/week @ 2024-11-22

72,071 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

~250–710KB
~17K SLoC