mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-05-21 02:30:43 +00:00
108 lines
32 KiB
HTML
108 lines
32 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="API documentation for the Rust `SetBuilder` struct in crate `fst`."><meta name="keywords" content="rust, rustlang, rust-lang, SetBuilder"><title>fst::SetBuilder - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../fst/index.html'><img src='../rust-logo.png' alt='logo' width='100'></a><p class='location'>Struct SetBuilder</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.bytes_written">bytes_written</a><a href="#method.extend_iter">extend_iter</a><a href="#method.extend_stream">extend_stream</a><a href="#method.finish">finish</a><a href="#method.get_ref">get_ref</a><a href="#method.insert">insert</a><a href="#method.into_inner">into_inner</a><a href="#method.memory">memory</a><a href="#method.new">new</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow">Borrow</a><a href="#impl-BorrowMut">BorrowMut</a><a href="#impl-From">From</a><a href="#impl-Into">Into</a><a href="#impl-TryFrom">TryFrom</a><a href="#impl-TryInto">TryInto</a></div></div><p class='location'><a href='index.html'>fst</a></p><script>window.sidebarCurrent = {name: 'SetBuilder', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/fst/set.rs.html#460' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='index.html'>fst</a>::<wbr><a class="struct" href=''>SetBuilder</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct SetBuilder<W>(_);</pre></div><div class='docblock'><p>A builder for creating a set.</p>
|
||
<p>This is not your average everyday builder. It has two important qualities
|
||
that make it a bit unique from what you might expect:</p>
|
||
<ol>
|
||
<li>All keys must be added in lexicographic order. Adding a key out of order
|
||
will result in an error.</li>
|
||
<li>The representation of a set is streamed to <em>any</em> <code>io::Write</code> as it is
|
||
built. For an in memory representation, this can be a <code>Vec<u8></code>.</li>
|
||
</ol>
|
||
<p>Point (2) is especially important because it means that a set can be
|
||
constructed <em>without storing the entire set in memory</em>. Namely, since it
|
||
works with any <code>io::Write</code>, it can be streamed directly to a file.</p>
|
||
<p>With that said, the builder does use memory, but <strong>memory usage is bounded
|
||
to a constant size</strong>. The amount of memory used trades off with the
|
||
compression ratio. Currently, the implementation hard codes this trade off
|
||
which can result in about 5-20MB of heap usage during construction. (N.B.
|
||
Guaranteeing a maximal compression ratio requires memory proportional to
|
||
the size of the set, which defeats the benefit of streaming it to disk.
|
||
In practice, a small bounded amount of memory achieves close-to-minimal
|
||
compression ratios.)</p>
|
||
<p>The algorithmic complexity of set construction is <code>O(n)</code> where <code>n</code> is the
|
||
number of elements added to the set.</p>
|
||
<h1 id="example-build-in-memory" class="section-header"><a href="#example-build-in-memory">Example: build in memory</a></h1>
|
||
<p>This shows how to use the builder to construct a set in memory. Note that
|
||
<code>Set::from_iter</code> provides a convenience function that achieves this same
|
||
goal without needing to explicitly use <code>SetBuilder</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">fst</span>::{<span class="ident">IntoStreamer</span>, <span class="ident">Streamer</span>, <span class="ident">Set</span>, <span class="ident">SetBuilder</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">build</span> <span class="op">=</span> <span class="ident">SetBuilder</span>::<span class="ident">memory</span>();
|
||
<span class="ident">build</span>.<span class="ident">insert</span>(<span class="string">"bruce"</span>).<span class="ident">unwrap</span>();
|
||
<span class="ident">build</span>.<span class="ident">insert</span>(<span class="string">"clarence"</span>).<span class="ident">unwrap</span>();
|
||
<span class="ident">build</span>.<span class="ident">insert</span>(<span class="string">"stevie"</span>).<span class="ident">unwrap</span>();
|
||
|
||
<span class="comment">// You could also call `finish()` here, but since we're building the set in</span>
|
||
<span class="comment">// memory, there would be no way to get the `Vec<u8>` back.</span>
|
||
<span class="kw">let</span> <span class="ident">bytes</span> <span class="op">=</span> <span class="ident">build</span>.<span class="ident">into_inner</span>().<span class="ident">unwrap</span>();
|
||
|
||
<span class="comment">// At this point, the set has been constructed, but here's how to read it.</span>
|
||
<span class="kw">let</span> <span class="ident">set</span> <span class="op">=</span> <span class="ident">Set</span>::<span class="ident">from_bytes</span>(<span class="ident">bytes</span>).<span class="ident">unwrap</span>();
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">stream</span> <span class="op">=</span> <span class="ident">set</span>.<span class="ident">into_stream</span>();
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">keys</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[];
|
||
<span class="kw">while</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">key</span>) <span class="op">=</span> <span class="ident">stream</span>.<span class="ident">next</span>() {
|
||
<span class="ident">keys</span>.<span class="ident">push</span>(<span class="ident">key</span>.<span class="ident">to_vec</span>());
|
||
}
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">keys</span>, <span class="macro">vec</span><span class="macro">!</span>[
|
||
<span class="string">"bruce"</span>.<span class="ident">as_bytes</span>(), <span class="string">"clarence"</span>.<span class="ident">as_bytes</span>(), <span class="string">"stevie"</span>.<span class="ident">as_bytes</span>(),
|
||
]);</pre></div>
|
||
<h1 id="example-stream-to-file" class="section-header"><a href="#example-stream-to-file">Example: stream to file</a></h1>
|
||
<p>This shows how to stream construction of a set to a file.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>::<span class="ident">File</span>;
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>;
|
||
|
||
<span class="kw">use</span> <span class="ident">fst</span>::{<span class="ident">IntoStreamer</span>, <span class="ident">Streamer</span>, <span class="ident">Set</span>, <span class="ident">SetBuilder</span>};
|
||
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">wtr</span> <span class="op">=</span> <span class="ident">io</span>::<span class="ident">BufWriter</span>::<span class="ident">new</span>(<span class="ident">File</span>::<span class="ident">create</span>(<span class="string">"set.fst"</span>).<span class="ident">unwrap</span>());
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">build</span> <span class="op">=</span> <span class="ident">SetBuilder</span>::<span class="ident">new</span>(<span class="ident">wtr</span>).<span class="ident">unwrap</span>();
|
||
<span class="ident">build</span>.<span class="ident">insert</span>(<span class="string">"bruce"</span>).<span class="ident">unwrap</span>();
|
||
<span class="ident">build</span>.<span class="ident">insert</span>(<span class="string">"clarence"</span>).<span class="ident">unwrap</span>();
|
||
<span class="ident">build</span>.<span class="ident">insert</span>(<span class="string">"stevie"</span>).<span class="ident">unwrap</span>();
|
||
|
||
<span class="comment">// If you want the writer back, then call `into_inner`. Otherwise, this</span>
|
||
<span class="comment">// will finish construction and call `flush`.</span>
|
||
<span class="ident">build</span>.<span class="ident">finish</span>().<span class="ident">unwrap</span>();
|
||
|
||
<span class="comment">// At this point, the set has been constructed, but here's how to read it.</span>
|
||
<span class="kw">let</span> <span class="ident">set</span> <span class="op">=</span> <span class="kw">unsafe</span> { <span class="ident">Set</span>::<span class="ident">from_path</span>(<span class="string">"set.fst"</span>).<span class="ident">unwrap</span>() };
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">stream</span> <span class="op">=</span> <span class="ident">set</span>.<span class="ident">into_stream</span>();
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">keys</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[];
|
||
<span class="kw">while</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">key</span>) <span class="op">=</span> <span class="ident">stream</span>.<span class="ident">next</span>() {
|
||
<span class="ident">keys</span>.<span class="ident">push</span>(<span class="ident">key</span>.<span class="ident">to_vec</span>());
|
||
}
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">keys</span>, <span class="macro">vec</span><span class="macro">!</span>[
|
||
<span class="string">"bruce"</span>.<span class="ident">as_bytes</span>(), <span class="string">"clarence"</span>.<span class="ident">as_bytes</span>(), <span class="string">"stevie"</span>.<span class="ident">as_bytes</span>(),
|
||
]);</pre></div>
|
||
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl <a class="struct" href="../fst/struct.SetBuilder.html" title="struct fst::SetBuilder">SetBuilder</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>></code><a href='#impl' class='anchor'></a><a class='srclink' href='../src/fst/set.rs.html#462-468' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.memory' class="method"><code id='memory.v'>pub fn <a href='#method.memory' class='fnname'>memory</a>() -> Self</code><a class='srclink' href='../src/fst/set.rs.html#465-467' title='goto source code'>[src]</a></h4><div class='docblock'><p>Create a builder that builds a set in memory.</p>
|
||
</div></div><h3 id='impl-1' class='impl'><code class='in-band'>impl<W: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a>> <a class="struct" href="../fst/struct.SetBuilder.html" title="struct fst::SetBuilder">SetBuilder</a><W></code><a href='#impl-1' class='anchor'></a><a class='srclink' href='../src/fst/set.rs.html#470-531' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.new' class="method"><code id='new.v'>pub fn <a href='#method.new' class='fnname'>new</a>(wtr: W) -> <a class="type" href="../fst/type.Result.html" title="type fst::Result">Result</a><<a class="struct" href="../fst/struct.SetBuilder.html" title="struct fst::SetBuilder">SetBuilder</a><W>></code><a class='srclink' href='../src/fst/set.rs.html#473-475' title='goto source code'>[src]</a></h4><div class='docblock'><p>Create a builder that builds a set by writing it to <code>wtr</code> in a
|
||
streaming fashion.</p>
|
||
</div><h4 id='method.insert' class="method"><code id='insert.v'>pub fn <a href='#method.insert' class='fnname'>insert</a><K: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>>>(&mut self, key: K) -> <a class="type" href="../fst/type.Result.html" title="type fst::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></code><a class='srclink' href='../src/fst/set.rs.html#482-484' title='goto source code'>[src]</a></h4><div class='docblock'><p>Insert a new key into the set.</p>
|
||
<p>If a key is inserted that is less than any previous key added, then
|
||
an error is returned. Similarly, if there was a problem writing to
|
||
the underlying writer, an error is returned.</p>
|
||
</div><h4 id='method.extend_iter' class="method"><code id='extend_iter.v'>pub fn <a href='#method.extend_iter' class='fnname'>extend_iter</a><T, I>(&mut self, iter: I) -> <a class="type" href="../fst/type.Result.html" title="type fst::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>>,<br> I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = T>, </span></code><a class='srclink' href='../src/fst/set.rs.html#490-496' title='goto source code'>[src]</a></h4><div class='docblock'><p>Calls insert on each item in the iterator.</p>
|
||
<p>If an error occurred while adding an element, processing is stopped
|
||
and the error is returned.</p>
|
||
</div><h4 id='method.extend_stream' class="method"><code id='extend_stream.v'>pub fn <a href='#method.extend_stream' class='fnname'>extend_stream</a><'f, I, S>(&mut self, stream: I) -> <a class="type" href="../fst/type.Result.html" title="type fst::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> <span class="where fmt-newline">where<br> I: for<'a> <a class="trait" href="../fst/trait.IntoStreamer.html" title="trait fst::IntoStreamer">IntoStreamer</a><'a, Into = S, Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>>,<br> S: 'f + for<'a> <a class="trait" href="../fst/trait.Streamer.html" title="trait fst::Streamer">Streamer</a><'a, Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>>, </span></code><a class='srclink' href='../src/fst/set.rs.html#502-506' title='goto source code'>[src]</a></h4><div class='docblock'><p>Calls insert on each item in the stream.</p>
|
||
<p>Note that unlike <code>extend_iter</code>, this is not generic on the items in
|
||
the stream.</p>
|
||
</div><h4 id='method.finish' class="method"><code id='finish.v'>pub fn <a href='#method.finish' class='fnname'>finish</a>(self) -> <a class="type" href="../fst/type.Result.html" title="type fst::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></code><a class='srclink' href='../src/fst/set.rs.html#511-513' title='goto source code'>[src]</a></h4><div class='docblock'><p>Finishes the construction of the set and flushes the underlying
|
||
writer. After completion, the data written to <code>W</code> may be read using
|
||
one of <code>Set</code>'s constructor methods.</p>
|
||
</div><h4 id='method.into_inner' class="method"><code id='into_inner.v'>pub fn <a href='#method.into_inner' class='fnname'>into_inner</a>(self) -> <a class="type" href="../fst/type.Result.html" title="type fst::Result">Result</a><W></code><a class='srclink' href='../src/fst/set.rs.html#517-519' title='goto source code'>[src]</a></h4><div class='docblock'><p>Just like <code>finish</code>, except it returns the underlying writer after
|
||
flushing it.</p>
|
||
</div><h4 id='method.get_ref' class="method"><code id='get_ref.v'>pub fn <a href='#method.get_ref' class='fnname'>get_ref</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>W</code><a class='srclink' href='../src/fst/set.rs.html#522-524' title='goto source code'>[src]</a></h4><div class='docblock'><p>Gets a reference to the underlying writer.</p>
|
||
</div><h4 id='method.bytes_written' class="method"><code id='bytes_written.v'>pub fn <a href='#method.bytes_written' class='fnname'>bytes_written</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></code><a class='srclink' href='../src/fst/set.rs.html#527-529' title='goto source code'>[src]</a></h4><div class='docblock'><p>Returns the number of bytes written to the underlying writer</p>
|
||
</div></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'><h3 id='impl-Send' class='impl'><code class='in-band'>impl<W> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../fst/struct.SetBuilder.html" title="struct fst::SetBuilder">SetBuilder</a><W> <span class="where fmt-newline">where<br> W: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>, </span></code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl<W> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../fst/struct.SetBuilder.html" title="struct fst::SetBuilder">SetBuilder</a><W> <span class="where fmt-newline">where<br> W: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>, </span></code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-From' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a> for T</code><a href='#impl-From' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#546-548' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -> T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#547' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id='impl-Into' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href='#impl-Into' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#537-542' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.into' class="method hidden"><code id='into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -> U</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#539-541' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id='impl-TryFrom' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href='#impl-TryFrom' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#565-571' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error' class="type"><code id='Error.t'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error' class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div><h4 id='method.try_from' class="method hidden"><code id='try_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from' class='fnname'>try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#568-570' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div><h3 id='impl-Borrow' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Borrow' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-215' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||
</div></div><h3 id='impl-Any' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#100-102' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#101' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||
</div></div><h3 id='impl-BorrowMut' class='impl'><code class='in-band'>impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-BorrowMut' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#218-220' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#219' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||
</div></div><h3 id='impl-TryInto' class='impl'><code class='in-band'>impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href='#impl-TryInto' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#553-560' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Error-1' class="type"><code id='Error.t-1'>type <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error' class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div><h4 id='method.try_into' class="method hidden"><code id='try_into.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into' class='fnname'>try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert.rs.html#557-559' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "fst";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |