tree: c3e3bbc198c6d64db6214d67a27936b8de55051d [path history] [tgz]
  1. benches/
  2. examples/
  3. src/
  4. tests/
  5. .android-checksum.json
  6. .cargo-checksum.json
  7. Android.bp
  8. Cargo.lock
  9. Cargo.toml
  10. cargo_embargo.json
  11. icu4x_bionic_dep.bp.fragment
  12. LICENSE
  13. METADATA
  14. MODULE_LICENSE_UNICODE_3
  15. README.md
crates/zerotrie/README.md

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.