Sunbeam Studios

Our open-source projects, here for you!

zerotrie (0.2.3)

Published 2026-03-26 10:37:14 +00:00 by siennathesane

Installation

[registry]
default = "gitea"

[registries.gitea]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add zerotrie@0.2.3

About this package

A data structure that efficiently maps strings to integers

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

ID Version
databake ^0.2.0
displaydoc ^0.2.3
litemap ^0.8.0
serde_core ^1.0.220
yoke ^0.8.0
zerofrom ^0.1.3
zerovec ^0.11.3
Details
Cargo
2026-03-26 10:37:14 +00:00
0
The ICU4X Project Developers
Unicode-3.0
68 KiB
Assets (1)
Versions (1) View all
0.2.3 2026-03-26