4 releases

new 0.1.3 May 28, 2024
0.1.2 Nov 16, 2023
0.1.1 Oct 3, 2023
0.1.0 Sep 23, 2023

#366 in Internationalization (i18n)

Download history 3899/week @ 2024-02-05 4700/week @ 2024-02-12 4390/week @ 2024-02-19 4327/week @ 2024-02-26 4317/week @ 2024-03-04 4864/week @ 2024-03-11 4816/week @ 2024-03-18 4069/week @ 2024-03-25 4508/week @ 2024-04-01 3789/week @ 2024-04-08 3383/week @ 2024-04-15 3018/week @ 2024-04-22 3981/week @ 2024-04-29 3360/week @ 2024-05-06 3483/week @ 2024-05-13 3371/week @ 2024-05-20

14,449 downloads per month
Used in 59 crates (4 directly)

Unicode-3.0

425KB
7K 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.4–0.9MB
~21K SLoC