5 stable releases

1.1.0 Jul 1, 2021
1.0.3 Jul 17, 2018

#37 in Value formatting

Download history 15514/week @ 2024-09-18 15330/week @ 2024-09-25 15155/week @ 2024-10-02 16102/week @ 2024-10-09 19155/week @ 2024-10-16 18114/week @ 2024-10-23 18785/week @ 2024-10-30 18230/week @ 2024-11-06 18112/week @ 2024-11-13 17840/week @ 2024-11-20 17043/week @ 2024-11-27 22210/week @ 2024-12-04 22109/week @ 2024-12-11 15476/week @ 2024-12-18 22206/week @ 2024-12-25 12399/week @ 2025-01-01

75,462 downloads per month
Used in 61 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

~235–690KB
~16K SLoC