README.md
1# zerotrie [](https://crates.io/crates/zerotrie)
2
3<!-- cargo-rdme start -->
4
5A data structure offering zero-copy storage and retrieval of byte strings, with a focus
6on the efficient storage of ASCII strings. Strings are mapped to `usize` values.
7
8[`ZeroTrie`] does not support mutation because doing so would require recomputing the entire
9data structure. Instead, it supports conversion to and from [`LiteMap`] and [`BTreeMap`].
10
11There are multiple variants of [`ZeroTrie`] optimized for different use cases.
12
13## Examples
14
15```rust
16use zerotrie::ZeroTrie;
17
18let data: &[(&str, usize)] = &[("abc", 11), ("xyz", 22), ("axyb", 33)];
19
20let trie: ZeroTrie<Vec<u8>> = data.iter().copied().collect();
21
22assert_eq!(trie.get("axyb"), Some(33));
23assert_eq!(trie.byte_len(), 18);
24```
25
26## Internal Structure
27
28To read about the internal structure of [`ZeroTrie`], build the docs with private modules:
29
30```bash
31cargo doc --document-private-items --all-features --no-deps --open
32```
33
34[`LiteMap`]: litemap::LiteMap
35[`BTreeMap`]: alloc::collections::BTreeMap
36
37<!-- cargo-rdme end -->
38
39## More Information
40
41For more information on development, authorship, contributing etc. please visit [`ICU4X home page`](https://github.com/unicode-org/icu4x).
42