17 lines
7.1 KiB
HTML
17 lines
7.1 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="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."><title>zerotrie - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="zerotrie" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Crate zerotrie</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../zerotrie/index.html">zerotrie</a><span class="version">0.2.3</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li><li><a href="#internal-structure" title="Internal Structure">Internal Structure</a></li></ul><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>zerotrie</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/zerotrie/lib.rs.html#5-87">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>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 <code>usize</code> values.</p>
|
|
<p><a href="struct.ZeroTrie.html" title="struct zerotrie::ZeroTrie"><code>ZeroTrie</code></a> does not support mutation because doing so would require recomputing the entire
|
|
data structure. Instead, it supports conversion to and from <a href="litemap::LiteMap"><code>LiteMap</code></a> and <a href="alloc::collections::BTreeMap"><code>BTreeMap</code></a>.</p>
|
|
<p>There are multiple variants of <a href="struct.ZeroTrie.html" title="struct zerotrie::ZeroTrie"><code>ZeroTrie</code></a> optimized for different use cases.</p>
|
|
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>zerotrie::ZeroTrie;
|
|
|
|
<span class="kw">let </span>data: <span class="kw-2">&</span>[(<span class="kw-2">&</span>str, usize)] = <span class="kw-2">&</span>[(<span class="string">"abc"</span>, <span class="number">11</span>), (<span class="string">"xyz"</span>, <span class="number">22</span>), (<span class="string">"axyb"</span>, <span class="number">33</span>)];
|
|
|
|
<span class="kw">let </span>trie: ZeroTrie<Vec<u8>> = data.iter().copied().collect();
|
|
|
|
<span class="macro">assert_eq!</span>(trie.get(<span class="string">"axyb"</span>), <span class="prelude-val">Some</span>(<span class="number">33</span>));
|
|
<span class="macro">assert_eq!</span>(trie.byte_len(), <span class="number">18</span>);</code></pre></div><h2 id="internal-structure"><a class="doc-anchor" href="#internal-structure">§</a>Internal Structure</h2>
|
|
<p>To read about the internal structure of <a href="struct.ZeroTrie.html" title="struct zerotrie::ZeroTrie"><code>ZeroTrie</code></a>, build the docs with private modules:</p>
|
|
<div class="example-wrap"><pre class="language-bash"><code>cargo doc --document-private-items --all-features --no-deps --open</code></pre></div></div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="cursor/index.html" title="mod zerotrie::cursor">cursor</a></dt><dd>Types for walking stepwise through a trie.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.ZeroAsciiIgnoreCaseTrie.html" title="struct zerotrie::ZeroAsciiIgnoreCaseTrie">Zero<wbr>Ascii<wbr>Ignore<wbr>Case<wbr>Trie</a></dt><dd>A data structure that compactly maps from ASCII strings to integers
|
|
in a case-insensitive way.</dd><dt><a class="struct" href="struct.ZeroTrie.html" title="struct zerotrie::ZeroTrie">Zero<wbr>Trie</a></dt><dd>A data structure that compactly maps from byte sequences to integers.</dd><dt><a class="struct" href="struct.ZeroTrieExtendedCapacity.html" title="struct zerotrie::ZeroTrieExtendedCapacity">Zero<wbr>Trie<wbr>Extended<wbr>Capacity</a></dt><dd>A data structure that maps from a large number of byte strings to integers.</dd><dt><a class="struct" href="struct.ZeroTriePerfectHash.html" title="struct zerotrie::ZeroTriePerfectHash">Zero<wbr>Trie<wbr>Perfect<wbr>Hash</a></dt><dd>A data structure that compactly maps from byte strings to integers.</dd><dt><a class="struct" href="struct.ZeroTrieSimpleAscii.html" title="struct zerotrie::ZeroTrieSimpleAscii">Zero<wbr>Trie<wbr>Simple<wbr>Ascii</a></dt><dd>A data structure that compactly maps from ASCII strings to integers.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.ZeroTrieBuildError.html" title="enum zerotrie::ZeroTrieBuildError">Zero<wbr>Trie<wbr>Build<wbr>Error</a></dt><dd>Error types for the <code>zerotrie</code> crate.</dd></dl></section></div></main></body></html> |