| <!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">☰</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<Fst<Data>></a></li><li><a href="#impl-From%3CFst%3CData%3E%3E-for-Map%3CData%3E">From<Fst<Data>></a></li><li><a href="#impl-IntoStreamer%3C%27a%3E-for-%26%27f%20Fst%3CData%3E">IntoStreamer<'a></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<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-Fst%3CData%3E">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-Fst%3CData%3E">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-Fst%3CData%3E">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-Fst%3CData%3E">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-Fst%3CData%3E">TryInto<U></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">−</span>]</a></span></div><div class="item-decl"><pre class="rust struct"><code>pub struct Fst<Data = Vec<u8>> { /* 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&rep=rep1&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<Data: Deref<Target = [u8]>> <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a><Data></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) -> <a class="type" href="../type.Result.html" title="type tantivy_fst::Result">Result</a><<a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a><Data>></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><B: AsRef<[u8]>>(&self, key: B) -> Option<<a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>></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><B: AsRef<[u8]>>(&self, key: B) -> 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>(&self) -> <a class="struct" href="struct.Stream.html" title="struct tantivy_fst::raw::Stream">Stream</a><'_></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>(&self) -> <a class="struct" href="struct.StreamBuilder.html" title="struct tantivy_fst::raw::StreamBuilder">StreamBuilder</a><'_></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><A: <a class="trait" href="../automaton/trait.Automaton.html" title="trait tantivy_fst::automaton::Automaton">Automaton</a>>(&self, aut: A) -> <a class="struct" href="struct.StreamBuilder.html" title="struct tantivy_fst::raw::StreamBuilder">StreamBuilder</a><'_, A></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>(&self) -> 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>(&self) -> 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>(&self) -> 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>(&self) -> <a class="struct" href="struct.OpBuilder.html" title="struct tantivy_fst::raw::OpBuilder">OpBuilder</a><'_></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><'f, I, S>(&self, stream: I) -> bool<span class="where fmt-newline">where<br> I: for<'a> <a class="trait" href="../trait.IntoStreamer.html" title="trait tantivy_fst::IntoStreamer">IntoStreamer</a><'a, Into = S, Item = (&'a [u8], <a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>)>,<br> S: 'f + for<'a> <a class="trait" href="../trait.Streamer.html" title="trait tantivy_fst::Streamer">Streamer</a><'a, Item = (&'a [u8], <a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>)>,</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><'f, I, S>(&self, stream: I) -> bool<span class="where fmt-newline">where<br> I: for<'a> <a class="trait" href="../trait.IntoStreamer.html" title="trait tantivy_fst::IntoStreamer">IntoStreamer</a><'a, Into = S, Item = (&'a [u8], <a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>)>,<br> S: 'f + for<'a> <a class="trait" href="../trait.Streamer.html" title="trait tantivy_fst::Streamer">Streamer</a><'a, Item = (&'a [u8], <a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>)>,</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><'f, I, S>(&self, stream: I) -> bool<span class="where fmt-newline">where<br> I: for<'a> <a class="trait" href="../trait.IntoStreamer.html" title="trait tantivy_fst::IntoStreamer">IntoStreamer</a><'a, Into = S, Item = (&'a [u8], <a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>)>,<br> S: 'f + for<'a> <a class="trait" href="../trait.Streamer.html" title="trait tantivy_fst::Streamer">Streamer</a><'a, Item = (&'a [u8], <a class="struct" href="struct.Output.html" title="struct tantivy_fst::raw::Output">Output</a>)>,</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>(&self) -> <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>(&self) -> <a class="struct" href="struct.Node.html" title="struct tantivy_fst::raw::Node">Node</a><'_></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>(&self, addr: <a class="type" href="type.CompiledAddr.html" title="type tantivy_fst::raw::CompiledAddr">CompiledAddr</a>) -> <a class="struct" href="struct.Node.html" title="struct tantivy_fst::raw::Node">Node</a><'_></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>(&self) -> Vec<u8></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<Data> AsRef<<a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a><Data>> for <a class="struct" href="../map/struct.Map.html" title="struct tantivy_fst::map::Map">Map</a><Data></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>(&self) -> &<a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a><Data></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<Data> From<<a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a><Data>> for <a class="struct" href="../map/struct.Map.html" title="struct tantivy_fst::map::Map">Map</a><Data></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><Data>) -> 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<'a, 'f, Data> <a class="trait" href="../trait.IntoStreamer.html" title="trait tantivy_fst::IntoStreamer">IntoStreamer</a><'a> for &'f <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a><Data><span class="where fmt-newline">where<br> Data: Deref<Target = [u8]>,</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> = (&'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><'f, <a class="struct" href="../automaton/struct.AlwaysMatch.html" title="struct tantivy_fst::automaton::AlwaysMatch">AlwaysMatch</a>></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) -> 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<Data> RefUnwindSafe for <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a><Data><span class="where fmt-newline">where<br> 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<Data> Send for <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a><Data><span class="where fmt-newline">where<br> 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<Data> Sync for <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a><Data><span class="where fmt-newline">where<br> 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<Data> Unpin for <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a><Data><span class="where fmt-newline">where<br> 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<Data> UnwindSafe for <a class="struct" href="struct.Fst.html" title="struct tantivy_fst::raw::Fst">Fst</a><Data><span class="where fmt-newline">where<br> 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<T> Any for T<span class="where fmt-newline">where<br> 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>(&self) -> 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<T> Borrow<T> for T<span class="where fmt-newline">where<br> 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>(&self) -> &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<T> BorrowMut<T> for T<span class="where fmt-newline">where<br> 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>(&mut self) -> &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<T> From<T> 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) -> 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<T, U> Into<U> for T<span class="where fmt-newline">where<br> U: From<T>,</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) -> 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]<T> 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<T, U> TryFrom<U> for T<span class="where fmt-newline">where<br> U: Into<T>,</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) -> Result<T, <T as TryFrom<U>>::Error></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<T, U> TryInto<U> for T<span class="where fmt-newline">where<br> U: TryFrom<T>,</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> = <U as TryFrom<T>>::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) -> Result<U, <U as TryFrom<T>>::Error></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> |