3 releases

0.1.2 Nov 16, 2023
0.1.1 Oct 3, 2023
0.1.0 Sep 23, 2023

#354 in Internationalization (i18n)

Download history 2423/week @ 2023-12-15 1851/week @ 2023-12-22 2366/week @ 2023-12-29 2638/week @ 2024-01-05 2958/week @ 2024-01-12 3208/week @ 2024-01-19 2900/week @ 2024-01-26 3779/week @ 2024-02-02 4183/week @ 2024-02-09 4945/week @ 2024-02-16 4261/week @ 2024-02-23 3890/week @ 2024-03-01 4833/week @ 2024-03-08 5214/week @ 2024-03-15 4247/week @ 2024-03-22 3585/week @ 2024-03-29

18,574 downloads per month
Used in 54 crates (4 directly)

Custom license

380KB
6.5K SLoC

zerotrie crates.io

A data structure offering zero-copy storage and retrieval of byte strings, with a focus on the efficient storage of ASCII strings. Strings are mapped to usize values.

ZeroTrie does not support mutation because doing so would require recomputing the entire data structure. Instead, it supports conversion to and from LiteMap and BTreeMap.

There are multiple variants of ZeroTrie optimized for different use cases.

Examples

use zerotrie::ZeroTrie;

let data: &[(&str, usize)] = &[("abc", 11), ("xyz", 22), ("axyb", 33)];

let trie: ZeroTrie<Vec<u8>> = data.iter().copied().collect();

assert_eq!(trie.get("axyb"), Some(33));
assert_eq!(trie.byte_len(), 18);

Internal Structure

To read about the internal structure of ZeroTrie, build the docs with private modules:

cargo doc --document-private-items --all-features --no-deps --open

More Information

For more information on development, authorship, contributing etc. please visit ICU4X home page.

Dependencies

~0.3–0.9MB
~20K SLoC