blob: 8d1c1c698b0968029ad417addb070c16d3977f5b [file] [log] [blame]
<!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="An acyclic deterministic finite state transducer."><meta name="keywords" content="rust, rustlang, rust-lang, Fst"><title>Fst in tantivy_fst::raw - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../../normalize.css"><link rel="stylesheet" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../../ayu.css" disabled><link rel="stylesheet" href="../../dark.css" disabled><link rel="stylesheet" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../main.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../../tantivy_fst/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../tantivy_fst/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Fst</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.contains_key">contains_key</a></li><li><a href="#method.fst_type">fst_type</a></li><li><a href="#method.get">get</a></li><li><a href="#method.is_disjoint">is_disjoint</a></li><li><a href="#method.is_empty">is_empty</a></li><li><a href="#method.is_subset">is_subset</a></li><li><a href="#method.is_superset">is_superset</a></li><li><a href="#method.len">len</a></li><li><a href="#method.new">new</a></li><li><a href="#method.node">node</a></li><li><a href="#method.op">op</a></li><li><a href="#method.range">range</a></li><li><a href="#method.root">root</a></li><li><a href="#method.search">search</a></li><li><a href="#method.size">size</a></li><li><a href="#method.stream">stream</a></li><li><a href="#method.to_vec">to_vec</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-AsRef%3CFst%3CData%3E%3E-for-Map%3CData%3E">AsRef&lt;Fst&lt;Data&gt;&gt;</a></li><li><a href="#impl-From%3CFst%3CData%3E%3E-for-Map%3CData%3E">From&lt;Fst&lt;Data&gt;&gt;</a></li><li><a href="#impl-IntoStreamer%3C%27a%3E-for-%26%27f%20Fst%3CData%3E">IntoStreamer&lt;&#39;a&gt;</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-Fst%3CData%3E">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Fst%3CData%3E">Send</a></li><li><a href="#impl-Sync-for-Fst%3CData%3E">Sync</a></li><li><a href="#impl-Unpin-for-Fst%3CData%3E">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Fst%3CData%3E">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-Fst%3CData%3E">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-Fst%3CData%3E">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-Fst%3CData%3E">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-Fst%3CData%3E">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-Fst%3CData%3E">Into&lt;U&gt;</a></li><li><a href="#impl-TryFrom%3CU%3E-for-Fst%3CData%3E">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-Fst%3CData%3E">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In tantivy_fst::raw</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Struct <a href="../index.html">tantivy_fst</a>::<wbr><a href="index.html">raw</a>::<wbr><a class="struct" href="#">Fst</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/tantivy_fst/raw/mod.rs.html#275-278">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust struct"><code>pub struct Fst&lt;Data&nbsp;=&nbsp;Vec&lt;u8&gt;&gt; { /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An acyclic deterministic finite state transducer.</p>
<h2 id="how-does-it-work"><a href="#how-does-it-work">How does it work?</a></h2>
<p>The short answer: it’s just like a prefix trie, which compresses keys
based only on their prefixes, except that a automaton/transducer also
compresses suffixes.</p>
<p>The longer answer is that keys in an automaton are stored only in the
transitions from one state to another. A key can be acquired by tracing
a path from the root of the automaton to any match state. The inputs along
each transition are concatenated. Once a match state is reached, the
concatenation of inputs up until that point corresponds to a single key.</p>
<p>But why is it called a transducer instead of an automaton? A finite state
transducer is just like a finite state automaton, except that it has output
transitions in addition to input transitions. Namely, the value associated
with any particular key is determined by summing the outputs along every
input transition that leads to the key’s corresponding match state.</p>
<p>This is best demonstrated with a couple images. First, let’s ignore the
“transducer” aspect and focus on a plain automaton.</p>
<p>Consider that your keys are abbreviations of some of the months in the
Gregorian calendar:</p>
<div class="example-wrap ignore"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code>jan
feb
mar
apr
may
jun
jul</code></pre></div>
<p>The corresponding automaton that stores all of these as keys looks like
this:</p>
<p><img src="http://burntsushi.net/stuff/months-set.png" alt="finite state automaton" /></p>
<p>Notice here how the prefix and suffix of <code>jan</code> and <code>jun</code> are shared.
Similarly, the prefixes of <code>jun</code> and <code>jul</code> are shared and the prefixes
of <code>mar</code> and <code>may</code> are shared.</p>
<p>All of the keys from this automaton can be enumerated in lexicographic
order by following every transition from each node in lexicographic
order. Since it is acyclic, the procedure will terminate.</p>
<p>A key can be found by tracing it through the transitions in the automaton.
For example, the key <code>aug</code> is known not to be in the automaton by only
visiting the root state (because there is no <code>a</code> transition). For another
example, the key <code>jax</code> is known not to be in the set only after moving
through the transitions for <code>j</code> and <code>a</code>. Namely, after those transitions
are followed, there are no transitions for <code>x</code>.</p>
<p>Notice here that looking up a key is proportional the length of the key
itself. Namely, lookup time is not affected by the number of keys in the
automaton!</p>
<p>Additionally, notice that the automaton exploits the fact that many keys
share common prefixes and suffixes. For example, <code>jun</code> and <code>jul</code> are
represented with no more states than would be required to represent either
one on its own. Instead, the only change is a single extra transition. This
is a form of compression and is key to how the automatons produced by this
crate are so small.</p>
<p>Let’s move on to finite state transducers. Consider the same set of keys
as above, but let’s assign their numeric month values:</p>
<div class="example-wrap ignore"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code>jan,<span class="number">1
</span>feb,<span class="number">2
</span>mar,<span class="number">3
</span>apr,<span class="number">4
</span>may,<span class="number">5
</span>jun,<span class="number">6
</span>jul,<span class="number">7</span></code></pre></div>
<p>The corresponding transducer looks very similar to the automaton above,
except outputs have been added to some of the transitions:</p>
<p><img src="http://burntsushi.net/stuff/months-map.png" alt="finite state transducer" /></p>
<p>All of the operations with a transducer are the same as described above
for automatons. Additionally, the same compression techniques are used:
common prefixes and suffixes in keys are exploited.</p>
<p>The key difference is that some transitions have been given an output.
As one follows input transitions, one must sum the outputs as they
are seen. (A transition with no output represents the additive identity,
or <code>0</code> in this case.) For example, when looking up <code>feb</code>, the transition
<code>f</code> has output <code>2</code>, the transition <code>e</code> has output <code>0</code>, and the transition
<code>b</code> also has output <code>0</code>. The sum of these is <code>2</code>, which is exactly the
value we associated with <code>feb</code>.</p>
<p>For another more interesting example, consider <code>jul</code>. The <code>j</code> transition
has output <code>1</code>, the <code>u</code> transition has output <code>5</code> and the <code>l</code> transition
has output <code>1</code>. Summing these together gets us <code>7</code>, which is again the
correct value associated with <code>jul</code>. Notice that if we instead looked up
the <code>jun</code> key, then the <code>n</code> transition would be followed instead of the
<code>l</code> transition, which has no output. Therefore, the <code>jun</code> key equals
<code>1+5+0=6</code>.</p>
<p>The trick to transducers is that there exists a unique path through the
transducer for every key, and its outputs are stored appropriately along
this path such that the correct value is returned when they are all summed
together. This process also enables the data that makes up each value to be
shared across many values in the transducer in exactly the same way that
keys are shared. This is yet another form of compression!</p>
<h2 id="bonus-a-billion-strings"><a href="#bonus-a-billion-strings">Bonus: a billion strings</a></h2>
<p>The amount of compression one can get from automata can be absolutely
ridiuclous. Consider the particular case of storing all billion strings
in the range <code>0000000001-1000000000</code>, e.g.,</p>
<div class="example-wrap ignore"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="number">0000000001
0000000002
</span>...
<span class="number">0000000100
0000000101
</span>...
<span class="number">0999999999
1000000000</span></code></pre></div>
<p>The corresponding automaton looks like this:</p>
<p>![finite state automaton - one billion strings]
(http://burntsushi.net/stuff/one-billion.png)</p>
<p>Indeed, the on disk size of this automaton is a mere <strong>251 bytes</strong>.</p>
<p>Of course, this is a bit of a pathological best case, but it does serve
to show how good compression can be in the optimal case.</p>
<p>Also, check out the
<a href="http://burntsushi.net/stuff/one-billion-map.svg">corresponding transducer</a>
that maps each string to its integer value. It’s a bit bigger, but still
only takes up <strong>896 bytes</strong> of space on disk. This demonstrates that
output values are also compressible.</p>
<h2 id="does-this-crate-produce-minimal-transducers"><a href="#does-this-crate-produce-minimal-transducers">Does this crate produce minimal transducers?</a></h2>
<p>For any non-trivial sized set of keys, it is unlikely that this crate will
produce a minimal transducer. As far as this author knows, guaranteeing a
minimal transducer requires working memory proportional to the number of
states. This can be quite costly and is anathema to the main design goal of
this crate: provide the ability to work with gigantic sets of strings with
constant memory overhead.</p>
<p>Instead, construction of a finite state transducer uses a cache of
states. More frequently used states are cached and reused, which provides
reasonably good compression ratios. (No comprehensive benchmarks exist to
back up this claim.)</p>
<p>It is possible that this crate may expose a way to guarantee minimal
construction of transducers at the expense of exorbitant memory
requirements.</p>
<h2 id="bibliography"><a href="#bibliography">Bibliography</a></h2>
<p>I initially got the idea to use finite state tranducers to represent
ordered sets/maps from
<a href="http://blog.mikemccandless.com/2010/12/using-finite-state-transducers-in.html">Michael
McCandless’</a>
work on incorporating transducers in Lucene.</p>
<p>However, my work would also not have been possible without the hard work
of many academics, especially
<a href="http://galaxy.eti.pg.gda.pl/katedry/kiw/pracownicy/Jan.Daciuk/personal/">Jan Daciuk</a>.</p>
<ul>
<li><a href="http://www.mitpressjournals.org/doi/pdfplus/10.1162/089120100561601">Incremental construction of minimal acyclic finite-state automata</a>
(Section 3 provides a decent overview of the algorithm used to construct
transducers in this crate, assuming all outputs are <code>0</code>.)</li>
<li><a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.24.3698&amp;rep=rep1&amp;type=pdf">Direct Construction of Minimal Acyclic Subsequential Transducers</a>
(The whole thing. The proof is dense but illuminating. The algorithm at
the end is the money shot, namely, it incorporates output values.)</li>
<li><a href="http://www.researchgate.net/profile/Jii_Dvorsky/publication/221568039_Word_Random_Access_Compression/links/0c96052c095630d5b3000000.pdf#page=116">Experiments with Automata Compression</a>, <a href="http://www.cs.put.poznan.pl/dweiss/site/publications/download/fsacomp.pdf">Smaller Representation of Finite State Automata</a>
(various compression techniques for representing states/transitions)</li>
<li><a href="http://www.pg.gda.pl/~jandac/thesis.ps.gz">Jan Daciuk’s dissertation</a>
(excellent for in depth overview)</li>
<li><a href="http://www.cs.mun.ca/~harold/Courses/Old/CS4750/Diary/q3p2qx4lv71m5vew.pdf">Comparison of Construction Algorithms for Minimal, Acyclic, Deterministic, Finite-State Automata from Sets of Strings</a>
(excellent for surface level overview)</li>
</ul>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><div id="implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Fst%3CData%3E" class="impl has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#308-540">source</a><a href="#impl-Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;Data:&nbsp;Deref&lt;Target = [u8]&gt;&gt; <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a>&lt;Data&gt;</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.new" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#310-368">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>(data: Data) -&gt; <a class="type" href="../type.Result.html" title="type tantivy_fst::Result">Result</a>&lt;<a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a>&lt;Data&gt;&gt;</h4></section></summary><div class="docblock"><p>Open a <code>Fst</code> from a given data.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#374-392">source</a><h4 class="code-header">pub fn <a href="#method.get" class="fnname">get</a>&lt;B:&nbsp;AsRef&lt;[u8]&gt;&gt;(&amp;self, key: B) -&gt; Option&lt;<a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>&gt;</h4></section></summary><div class="docblock"><p>Retrieves the value associated with a key.</p>
<p>If the key does not exist, then <code>None</code> is returned.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.contains_key" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#395-404">source</a><h4 class="code-header">pub fn <a href="#method.contains_key" class="fnname">contains_key</a>&lt;B:&nbsp;AsRef&lt;[u8]&gt;&gt;(&amp;self, key: B) -&gt; bool</h4></section></summary><div class="docblock"><p>Returns true if and only if the given key is in this FST.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.stream" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#409-411">source</a><h4 class="code-header">pub fn <a href="#method.stream" class="fnname">stream</a>(&amp;self) -&gt; <a class="struct" href="struct.Stream.html" title="struct tantivy_fst::raw::Stream">Stream</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>Return a lexicographically ordered stream of all key-value pairs in
this fst.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.range" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#422-424">source</a><h4 class="code-header">pub fn <a href="#method.range" class="fnname">range</a>(&amp;self) -&gt; <a class="struct" href="struct.StreamBuilder.html" title="struct tantivy_fst::raw::StreamBuilder">StreamBuilder</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>Return a builder for range queries.</p>
<p>A range query returns a subset of key-value pairs in this fst in a
range given in lexicographic order.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.search" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#427-429">source</a><h4 class="code-header">pub fn <a href="#method.search" class="fnname">search</a>&lt;A:&nbsp;<a class="trait" href="../automaton/trait.Automaton.html" title="trait tantivy_fst::automaton::Automaton">Automaton</a>&gt;(&amp;self, aut: A) -&gt; <a class="struct" href="struct.StreamBuilder.html" title="struct tantivy_fst::raw::StreamBuilder">StreamBuilder</a>&lt;'_, A&gt;</h4></section></summary><div class="docblock"><p>Executes an automaton on the keys of this map.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.len" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#433-435">source</a><h4 class="code-header">pub fn <a href="#method.len" class="fnname">len</a>(&amp;self) -&gt; usize</h4></section></summary><div class="docblock"><p>Returns the number of keys in this fst.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_empty" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#439-441">source</a><h4 class="code-header">pub fn <a href="#method.is_empty" class="fnname">is_empty</a>(&amp;self) -&gt; bool</h4></section></summary><div class="docblock"><p>Returns true if and only if this fst has no keys.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.size" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#445-447">source</a><h4 class="code-header">pub fn <a href="#method.size" class="fnname">size</a>(&amp;self) -&gt; usize</h4></section></summary><div class="docblock"><p>Returns the number of bytes used by this fst.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.op" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#456-458">source</a><h4 class="code-header">pub fn <a href="#method.op" class="fnname">op</a>(&amp;self) -&gt; <a class="struct" href="struct.OpBuilder.html" title="struct tantivy_fst::raw::OpBuilder">OpBuilder</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>Creates a new fst operation with this fst added to it.</p>
<p>The <code>OpBuilder</code> type can be used to add additional fst streams
and perform set operations like union, intersection, difference and
symmetric difference on the keys of the fst. These set operations also
allow one to specify how conflicting values are merged in the stream.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_disjoint" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#465-471">source</a><h4 class="code-header">pub fn <a href="#method.is_disjoint" class="fnname">is_disjoint</a>&lt;'f, I, S&gt;(&amp;self, stream: I) -&gt; bool<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: for&lt;'a&gt; <a class="trait" href="../trait.IntoStreamer.html" title="trait tantivy_fst::IntoStreamer">IntoStreamer</a>&lt;'a, Into = S, Item = (&amp;'a [u8], <a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>)&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;S: 'f + for&lt;'a&gt; <a class="trait" href="../trait.Streamer.html" title="trait tantivy_fst::Streamer">Streamer</a>&lt;'a, Item = (&amp;'a [u8], <a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>)&gt;,</span></h4></section></summary><div class="docblock"><p>Returns true if and only if the <code>self</code> fst is disjoint with the fst
<code>stream</code>.</p>
<p><code>stream</code> must be a lexicographically ordered sequence of byte strings
with associated values.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_subset" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#478-489">source</a><h4 class="code-header">pub fn <a href="#method.is_subset" class="fnname">is_subset</a>&lt;'f, I, S&gt;(&amp;self, stream: I) -&gt; bool<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: for&lt;'a&gt; <a class="trait" href="../trait.IntoStreamer.html" title="trait tantivy_fst::IntoStreamer">IntoStreamer</a>&lt;'a, Into = S, Item = (&amp;'a [u8], <a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>)&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;S: 'f + for&lt;'a&gt; <a class="trait" href="../trait.Streamer.html" title="trait tantivy_fst::Streamer">Streamer</a>&lt;'a, Item = (&amp;'a [u8], <a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>)&gt;,</span></h4></section></summary><div class="docblock"><p>Returns true if and only if the <code>self</code> fst is a subset of the fst
<code>stream</code>.</p>
<p><code>stream</code> must be a lexicographically ordered sequence of byte strings
with associated values.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_superset" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#496-507">source</a><h4 class="code-header">pub fn <a href="#method.is_superset" class="fnname">is_superset</a>&lt;'f, I, S&gt;(&amp;self, stream: I) -&gt; bool<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: for&lt;'a&gt; <a class="trait" href="../trait.IntoStreamer.html" title="trait tantivy_fst::IntoStreamer">IntoStreamer</a>&lt;'a, Into = S, Item = (&amp;'a [u8], <a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>)&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;S: 'f + for&lt;'a&gt; <a class="trait" href="../trait.Streamer.html" title="trait tantivy_fst::Streamer">Streamer</a>&lt;'a, Item = (&amp;'a [u8], <a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>)&gt;,</span></h4></section></summary><div class="docblock"><p>Returns true if and only if the <code>self</code> fst is a superset of the fst
<code>stream</code>.</p>
<p><code>stream</code> must be a lexicographically ordered sequence of byte strings
with associated values.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fst_type" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#517-519">source</a><h4 class="code-header">pub fn <a href="#method.fst_type" class="fnname">fst_type</a>(&amp;self) -&gt; <a class="type" href="type.FstType.html" title="type tantivy_fst::raw::FstType">FstType</a></h4></section></summary><div class="docblock"><p>Returns the underlying type of this fst.</p>
<p>FstType is a convention used to indicate the type of the underlying
transducer.</p>
<p>This crate reserves the range 0-255 (inclusive) but currently leaves
the meaning of 0-255 unspecified.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.root" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#523-525">source</a><h4 class="code-header">pub fn <a href="#method.root" class="fnname">root</a>(&amp;self) -&gt; <a class="struct" href="struct.Node.html" title="struct tantivy_fst::raw::Node">Node</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>Returns the root node of this fst.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.node" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#531-533">source</a><h4 class="code-header">pub fn <a href="#method.node" class="fnname">node</a>(&amp;self, addr: <a class="type" href="type.CompiledAddr.html" title="type tantivy_fst::raw::CompiledAddr">CompiledAddr</a>) -&gt; <a class="struct" href="struct.Node.html" title="struct tantivy_fst::raw::Node">Node</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>Returns the node at the given address.</p>
<p>Node addresses can be obtained by reading transitions on <code>Node</code> values.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_vec" class="method has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#537-539">source</a><h4 class="code-header">pub fn <a href="#method.to_vec" class="fnname">to_vec</a>(&amp;self) -&gt; Vec&lt;u8&gt;</h4></section></summary><div class="docblock"><p>Returns a copy of the binary contents of this FST.</p>
</div></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-AsRef%3CFst%3CData%3E%3E-for-Map%3CData%3E" class="impl has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/map.rs.html#385-390">source</a><a href="#impl-AsRef%3CFst%3CData%3E%3E-for-Map%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;Data&gt; AsRef&lt;<a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a>&lt;Data&gt;&gt; for <a class="struct" href="../map/struct.Map.html" title="struct tantivy_fst::map::Map">Map</a>&lt;Data&gt;</h3></section></summary><div class="docblock"><p>Returns the underlying finite state transducer.</p>
</div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.as_ref" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/map.rs.html#387-389">source</a><a href="#method.as_ref" class="anchor"></a><h4 class="code-header">fn <a class="fnname">as_ref</a>(&amp;self) -&gt; &amp;<a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a>&lt;Data&gt;</h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-From%3CFst%3CData%3E%3E-for-Map%3CData%3E" class="impl has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/map.rs.html#377-382">source</a><a href="#impl-From%3CFst%3CData%3E%3E-for-Map%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;Data&gt; From&lt;<a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a>&lt;Data&gt;&gt; for <a class="struct" href="../map/struct.Map.html" title="struct tantivy_fst::map::Map">Map</a>&lt;Data&gt;</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/map.rs.html#379-381">source</a><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(fst: <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a>&lt;Data&gt;) -&gt; Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-IntoStreamer%3C%27a%3E-for-%26%27f%20Fst%3CData%3E" class="impl has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#542-553">source</a><a href="#impl-IntoStreamer%3C%27a%3E-for-%26%27f%20Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;'a, 'f, Data&gt; <a class="trait" href="../trait.IntoStreamer.html" title="trait tantivy_fst::IntoStreamer">IntoStreamer</a>&lt;'a&gt; for &amp;'f <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a>&lt;Data&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Data: Deref&lt;Target = [u8]&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Item" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Item" class="anchor"></a><h4 class="code-header">type <a href="../trait.IntoStreamer.html#associatedtype.Item" class="associatedtype">Item</a> = (&amp;'a [u8], <a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>)</h4></section></summary><div class='docblock'>The type of the item emitted by the stream.</div></details><details class="rustdoc-toggle" open><summary><section id="associatedtype.Into" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Into" class="anchor"></a><h4 class="code-header">type <a href="../trait.IntoStreamer.html#associatedtype.Into" class="associatedtype">Into</a> = <a class="struct" href="struct.Stream.html" title="struct tantivy_fst::raw::Stream">Stream</a>&lt;'f, <a class="struct" href="../automaton/struct.AlwaysMatch.html" title="struct tantivy_fst::automaton::AlwaysMatch">AlwaysMatch</a>&gt;</h4></section></summary><div class='docblock'>The type of the stream to be constructed.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into_stream" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/tantivy_fst/raw/mod.rs.html#550-552">source</a><a href="#method.into_stream" class="anchor"></a><h4 class="code-header">fn <a href="../trait.IntoStreamer.html#tymethod.into_stream" class="fnname">into_stream</a>(self) -&gt; Self::<a class="associatedtype" href="../trait.IntoStreamer.html#associatedtype.Into" title="type tantivy_fst::IntoStreamer::Into">Into</a></h4></section></summary><div class='docblock'>Construct a stream from <code>Self</code>.</div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-Fst%3CData%3E" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;Data&gt; RefUnwindSafe for <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a>&lt;Data&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Data: RefUnwindSafe,</span></h3></section><section id="impl-Send-for-Fst%3CData%3E" class="impl has-srclink"><a href="#impl-Send-for-Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;Data&gt; Send for <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a>&lt;Data&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Data: Send,</span></h3></section><section id="impl-Sync-for-Fst%3CData%3E" class="impl has-srclink"><a href="#impl-Sync-for-Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;Data&gt; Sync for <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a>&lt;Data&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Data: Sync,</span></h3></section><section id="impl-Unpin-for-Fst%3CData%3E" class="impl has-srclink"><a href="#impl-Unpin-for-Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;Data&gt; Unpin for <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a>&lt;Data&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Data: Unpin,</span></h3></section><section id="impl-UnwindSafe-for-Fst%3CData%3E" class="impl has-srclink"><a href="#impl-UnwindSafe-for-Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;Data&gt; UnwindSafe for <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a>&lt;Data&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Data: UnwindSafe,</span></h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Any-for-Fst%3CData%3E" class="impl has-srclink"><a href="#impl-Any-for-Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Any for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl has-srclink"><a href="#method.type_id" class="anchor"></a><h4 class="code-header">fn <a class="fnname">type_id</a>(&amp;self) -&gt; TypeId</h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-Fst%3CData%3E" class="impl has-srclink"><a href="#impl-Borrow%3CT%3E-for-Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Borrow&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow</a>(&amp;self) -&gt; &amp;T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-Fst%3CData%3E" class="impl has-srclink"><a href="#impl-BorrowMut%3CT%3E-for-Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; BorrowMut&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow_mut</a>(&amp;mut self) -&gt; &amp;mut T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-Fst%3CData%3E" class="impl has-srclink"><a href="#impl-From%3CT%3E-for-Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; From&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.from-1" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-Fst%3CData%3E" class="impl has-srclink"><a href="#impl-Into%3CU%3E-for-Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; Into&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: From&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code>[From]&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-Fst%3CData%3E" class="impl has-srclink"><a href="#impl-TryFrom%3CU%3E-for-Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryFrom&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: Into&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = Infallible</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(value: U) -&gt; Result&lt;T, &lt;T as TryFrom&lt;U&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-Fst%3CData%3E" class="impl has-srclink"><a href="#impl-TryInto%3CU%3E-for-Fst%3CData%3E" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryInto&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: TryFrom&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = &lt;U as TryFrom&lt;T&gt;&gt;::Error</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_into</a>(self) -&gt; Result&lt;U, &lt;U as TryFrom&lt;T&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tantivy_fst" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>