| Crates.io | unescape_zero_copy |
| lib.rs | unescape_zero_copy |
| version | 2.3.0 |
| created_at | 2024-07-19 22:34:40.065575+00 |
| updated_at | 2025-01-07 16:53:03.289364+00 |
| description | Unescape strings without allocating memory |
| homepage | https://crates.io/crates/unescape_zero_copy |
| repository | https://github.com/MWPuppire/unescape_zero_copy |
| max_upload_size | |
| id | 1309119 |
| size | 20,894 |
Unescapes strings with C-style escape sequences, written to minimize memory
copying. Other crates (e.g. unescaper)
like to allocate memory for every string, but most strings don't need any
unescaping and so can be returned as-is. This library does that.
It supports custom escape sequence parsers intead of the standard C-style escape
sequences as well; an example of this can be found in
tests/lua_escapes.rs, using the library to parse Lua
escape sequences.
Supports no_std by returning an iterator, or can return a Cow that allocates
as needed with the std or alloc feature (std is enabled by default).
assert_eq!(unescape_zero_copy::unescape_default(r"Hello\x0aworld").unwrap(), "Hello\nworld");
The code is released under the MIT license.