7 releases

new 0.2.2 May 7, 2025
0.2.1 Feb 26, 2025
0.2.0 Nov 23, 2024
0.1.3 May 28, 2024
0.1.0 Sep 23, 2023

#484 in Internationalization (i18n)

Download history 31976/week @ 2025-01-17 36991/week @ 2025-01-24 42560/week @ 2025-01-31 45593/week @ 2025-02-07 38532/week @ 2025-02-14 44993/week @ 2025-02-21 46051/week @ 2025-02-28 38547/week @ 2025-03-07 45250/week @ 2025-03-14 47622/week @ 2025-03-21 45911/week @ 2025-03-28 43120/week @ 2025-04-04 44343/week @ 2025-04-11 37473/week @ 2025-04-18 59167/week @ 2025-04-25 44505/week @ 2025-05-02

194,185 downloads per month
Used in 32,390 crates (10 directly)

Unicode-3.0

390KB
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

~200–700KB
~16K SLoC