Crates.io | zerotrie |
lib.rs | zerotrie |
version | 0.2.0 |
source | src |
created_at | 2023-09-23 04:06:54.409204 |
updated_at | 2024-11-23 01:50:36.330707 |
description | A data structure that efficiently maps strings to integers |
homepage | https://icu4x.unicode.org |
repository | https://github.com/unicode-org/icu4x |
max_upload_size | |
id | 981047 |
size | 364,324 |
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.
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);
To read about the internal structure of [ZeroTrie
], build the docs with private modules:
cargo doc --document-private-items --all-features --no-deps --open
For more information on development, authorship, contributing etc. please visit ICU4X home page
.