<main><divclass="width-limiter"><navclass="sub"><formclass="search-form"><span></span><divid="sidebar-button"tabindex="-1"><ahref="../../../regex_automata/all.html"title="show sidebar"></a></div><inputclass="search-input"name="search"aria-label="Run search in the documentation"autocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"><divid="help-button"tabindex="-1"><ahref="../../../help.html"title="help">?</a></div><divid="settings-menu"tabindex="-1"><ahref="../../../settings.html"title="settings"><imgwidth="22"height="22"alt="Change settings"src="../../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><sectionid="main-content"class="content"><divclass="main-heading"><h1>Struct <ahref="../../index.html">regex_automata</a>::<wbr><ahref="../index.html">nfa</a>::<wbr><ahref="index.html">thompson</a>::<wbr><aclass="struct"href="#">Builder</a><buttonid="copy-path"title="Copy item path to clipboard"><imgsrc="../../../static.files/clipboard-7571035ce49a181d.svg"width="19"height="18"alt="Copy item path"></button></h1><spanclass="out-of-band"><aclass="src"href="../../../src/regex_automata/nfa/thompson/builder.rs.html#313-357">source</a> · <buttonid="toggle-all-docs"title="collapse all docs">[<span>−</span>]</button></span></div><preclass="rust item-decl"><code>pub struct Builder { <spanclass="comment">/* private fields */</span> }</code></pre><detailsclass="toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>An abstraction for building Thompson NFAs by hand.</p>
<p>A builder is what a <ahref="struct.Compiler.html"title="struct regex_automata::nfa::thompson::Compiler"><code>thompson::Compiler</code></a>
uses internally to translate a regex’s high-level intermediate
representation into an <ahref="struct.NFA.html"title="struct regex_automata::nfa::thompson::NFA"><code>NFA</code></a>.</p>
<p>The primary function of this builder is to abstract away the internal
representation of an NFA and make it difficult to produce NFAs are that
internally invalid or inconsistent. This builder also provides a way to
add “empty” states (which can be thought of as unconditional epsilon
transitions), despite the fact that <ahref="enum.State.html"title="enum regex_automata::nfa::thompson::State"><code>thompson::State</code></a> does
not have any “empty” representation. The advantage of “empty” states is
that they make the code for constructing a Thompson NFA logically simpler.</p>
<p>Many of the routines on this builder may panic or return errors. Generally
speaking, panics occur when an invalid sequence of method calls were made,
where as an error occurs if things get too big. (Where “too big” might mean
exhausting identifier space or using up too much heap memory in accordance
with the configured <ahref="struct.Builder.html#method.set_size_limit"title="method regex_automata::nfa::thompson::Builder::set_size_limit"><code>size_limit</code></a>.)</p>
<p>Each pattern you add to an NFA should correspond to a pair of
<ahref="struct.Builder.html#method.start_pattern"title="method regex_automata::nfa::thompson::Builder::start_pattern"><code>Builder::start_pattern</code></a> and <ahref="struct.Builder.html#method.finish_pattern"title="method regex_automata::nfa::thompson::Builder::finish_pattern"><code>Builder::finish_pattern</code></a> calls, with
calls inbetween that add NFA states for that pattern. NFA states may be
added without first calling <code>start_pattern</code>, with the exception of adding
<p>Here is a very brief overview of each of the methods that add NFA states.
Every method adds a single state.</p>
<ul>
<li><ahref="struct.Builder.html#method.add_empty"title="method regex_automata::nfa::thompson::Builder::add_empty"><code>add_empty</code></a>: Add a state with a single
unconditional epsilon transition to another state.</li>
<li><ahref="struct.Builder.html#method.add_union"title="method regex_automata::nfa::thompson::Builder::add_union"><code>add_union</code></a>: Adds a state with unconditional
epsilon transitions to two or more states, with earlier transitions
preferred over later ones.</li>
<li><ahref="struct.Builder.html#method.add_union_reverse"title="method regex_automata::nfa::thompson::Builder::add_union_reverse"><code>add_union_reverse</code></a>: Adds a state with
unconditional epsilon transitions to two or more states, with later
transitions preferred over earlier ones.</li>
<li><ahref="struct.Builder.html#method.add_range"title="method regex_automata::nfa::thompson::Builder::add_range"><code>add_range</code></a>: Adds a state with a single transition
to another state that can only be followed if the current input byte is
within the range given.</li>
<li><ahref="struct.Builder.html#method.add_sparse"title="method regex_automata::nfa::thompson::Builder::add_sparse"><code>add_sparse</code></a>: Adds a state with two or more
range transitions to other states, where a transition is only followed
if the current input byte is within one of the ranges. All transitions
in this state have equal priority, and the corresponding ranges must be
non-overlapping.</li>
<li><ahref="struct.Builder.html#method.add_look"title="method regex_automata::nfa::thompson::Builder::add_look"><code>add_look</code></a>: Adds a state with a single <em>conditional</em>
epsilon transition to another state, where the condition depends on a
limited look-around property.</li>
<li><ahref="struct.Builder.html#method.add_capture_start"title="method regex_automata::nfa::thompson::Builder::add_capture_start"><code>add_capture_start</code></a>: Adds a state with
a single unconditional epsilon transition that also instructs an NFA
simulation to record the current input position to a specific location in
memory. This is intended to represent the starting location of a capturing
group.</li>
<li><ahref="struct.Builder.html#method.add_capture_end"title="method regex_automata::nfa::thompson::Builder::add_capture_end"><code>add_capture_end</code></a>: Adds a state with
a single unconditional epsilon transition that also instructs an NFA
simulation to record the current input position to a specific location in
memory. This is intended to represent the ending location of a capturing
group.</li>
<li><ahref="struct.Builder.html#method.add_fail"title="method regex_automata::nfa::thompson::Builder::add_fail"><code>add_fail</code></a>: Adds a state that never transitions to
another state.</li>
<li><ahref="struct.Builder.html#method.add_match"title="method regex_automata::nfa::thompson::Builder::add_match"><code>add_match</code></a>: Add a state that indicates a match has
been found for a particular pattern. A match state is a final state with
<h3id="setting-transitions-between-nfa-states"><aclass="doc-anchor"href="#setting-transitions-between-nfa-states">§</a>Setting transitions between NFA states</h3>
<p>The <ahref="struct.Builder.html#method.patch"title="method regex_automata::nfa::thompson::Builder::patch"><code>Builder::patch</code></a> method creates a transition from one state to the
next. If the <code>from</code> state corresponds to a state that supports multiple
outgoing transitions (such as “union”), then this adds the corresponding
transition. Otherwise, it sets the single transition. (This routine panics
if <code>from</code> corresponds to a state added by <code>add_sparse</code>, since sparse states
) -><aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.NFA.html"title="struct regex_automata::nfa::thompson::NFA">NFA</a>, <aclass="struct"href="struct.BuildError.html"title="struct regex_automata::nfa::thompson::BuildError">BuildError</a>></h4></section></summary><divclass="docblock"><p>Assemble a <ahref="struct.NFA.html"title="struct regex_automata::nfa::thompson::NFA"><code>NFA</code></a> from the states added so far.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.start_pattern"class="method"><aclass="src rightside"href="../../../src/regex_automata/nfa/thompson/builder.rs.html#622-632">source</a><h4class="code-header">pub fn <ahref="#method.start_pattern"class="fn">start_pattern</a>(&mut self) -><aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="../../struct.PatternID.html"title="struct regex_automata::PatternID">PatternID</a>, <aclass="struct"href="struct.BuildError.html"title="struct regex_automata::nfa::thompson::BuildError">BuildError</a>></h4></section></summary><divclass="docblock"><p>Start the assembly of a pattern in this NFA.</p>
) -><aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="../../struct.PatternID.html"title="struct regex_automata::PatternID">PatternID</a>, <aclass="struct"href="struct.BuildError.html"title="struct regex_automata::nfa::thompson::BuildError">BuildError</a>></h4></section></summary><divclass="docblock"><p>Finish the assembly of a pattern in this NFA.</p>
<p>If this is called without a corresponding <code>start_pattern</code> call, then
this panics.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.current_pattern_id"class="method"><aclass="src rightside"href="../../../src/regex_automata/nfa/thompson/builder.rs.html#669-671">source</a><h4class="code-header">pub fn <ahref="#method.current_pattern_id"class="fn">current_pattern_id</a>(&self) -><aclass="struct"href="../../struct.PatternID.html"title="struct regex_automata::PatternID">PatternID</a></h4></section></summary><divclass="docblock"><p>Returns the pattern identifier of the current pattern.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.pattern_len"class="method"><aclass="src rightside"href="../../../src/regex_automata/nfa/thompson/builder.rs.html#677-679">source</a><h4class="code-header">pub fn <ahref="#method.pattern_len"class="fn">pattern_len</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.78.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the number of patterns added to this builder so far.</p>
<p>An “empty” NFA state is a state with a single unconditional epsilon
transition to another NFA state. Such empty states are removed before
building the final <ahref="struct.NFA.html"title="struct regex_automata::nfa::thompson::NFA"><code>NFA</code></a> (which has no such “empty” states), but they
can be quite useful in the construction process of an NFA.</p>
<p>A “look” NFA state corresponds to a state with exactly one
<em>conditional</em> epsilon transition to another NFA state. Namely, it
represents one of a small set of simplistic look-around operators.</p>
<p>Callers may provide a “dummy” state ID (typically <ahref="../../util/primitives/struct.StateID.html#associatedconstant.ZERO"title="associated constant regex_automata::util::primitives::StateID::ZERO"><code>StateID::ZERO</code></a>),
and then change it later with <ahref="struct.Builder.html#method.patch"title="method regex_automata::nfa::thompson::Builder::patch"><code>patch</code></a>.</p>
<p>A “start capture” NFA state corresponds to a state with exactly one
outgoing unconditional epsilon transition to another state. Unlike
“empty” states, a “start capture” state also carries with it an
instruction for saving the current position of input to a particular
location in memory. NFA simulations, like the Pike VM, may use this
information to report the match locations of capturing groups in a
regex pattern.</p>
<p>If the corresponding capturing group has a name, then callers should
include it here.</p>
<p>Callers may provide a “dummy” state ID (typically <ahref="../../util/primitives/struct.StateID.html#associatedconstant.ZERO"title="associated constant regex_automata::util::primitives::StateID::ZERO"><code>StateID::ZERO</code></a>),
and then change it later with <ahref="struct.Builder.html#method.patch"title="method regex_automata::nfa::thompson::Builder::patch"><code>patch</code></a>.</p>
<p>Note that unlike <code>start_pattern</code>/<code>finish_pattern</code>, capturing start and
end states may be interleaved. Indeed, it is typical for many “start
capture” NFA states to appear before the first “end capture” state.</p>
<p>This returns an error if the state identifier space is exhausted, or if
the configured heap size limit has been exceeded or if the given
capture index overflows <code>usize</code>.</p>
<p>While the above are the only conditions in which this routine can
currently return an error, it is possible to call this method with an
inputs that results in the final <code>build()</code> step failing to produce an
NFA. For example, if one adds two distinct capturing groups with the
same name, then that will result in <code>build()</code> failing with an error.</p>
<p>See the <ahref="../../util/captures/struct.GroupInfo.html"title="struct regex_automata::util::captures::GroupInfo"><code>GroupInfo</code></a> type for
more information on what qualifies as valid capturing groups.</p>
<p>A “end capture” NFA state corresponds to a state with exactly one
outgoing unconditional epsilon transition to another state. Unlike
“empty” states, a “end capture” state also carries with it an
instruction for saving the current position of input to a particular
location in memory. NFA simulations, like the Pike VM, may use this
information to report the match locations of capturing groups in a</p>
<p>Callers may provide a “dummy” state ID (typically <ahref="../../util/primitives/struct.StateID.html#associatedconstant.ZERO"title="associated constant regex_automata::util::primitives::StateID::ZERO"><code>StateID::ZERO</code></a>),
and then change it later with <ahref="struct.Builder.html#method.patch"title="method regex_automata::nfa::thompson::Builder::patch"><code>patch</code></a>.</p>
<p>Note that unlike <code>start_pattern</code>/<code>finish_pattern</code>, capturing start and
end states may be interleaved. Indeed, it is typical for many “start
capture” NFA states to appear before the first “end capture” state.</p>
<p>This returns an error if the state identifier space is exhausted, or if
the configured heap size limit has been exceeded or if the given
capture index overflows <code>usize</code>.</p>
<p>While the above are the only conditions in which this routine can
currently return an error, it is possible to call this method with an
inputs that results in the final <code>build()</code> step failing to produce an
NFA. For example, if one adds two distinct capturing groups with the
same name, then that will result in <code>build()</code> failing with an error.</p>
<p>See the <ahref="../../util/captures/struct.GroupInfo.html"title="struct regex_automata::util::captures::GroupInfo"><code>GroupInfo</code></a> type for
more information on what qualifies as valid capturing groups.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.patch"class="method"><aclass="src rightside"href="../../../src/regex_automata/nfa/thompson/builder.rs.html#1143-1183">source</a><h4class="code-header">pub fn <ahref="#method.patch"class="fn">patch</a>(&mut self, from: <aclass="struct"href="../../util/primitives/struct.StateID.html"title="struct regex_automata::util::primitives::StateID">StateID</a>, to: <aclass="struct"href="../../util/primitives/struct.StateID.html"title="struct regex_automata::util::primitives::StateID">StateID</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="primitive"href="https://doc.rust-lang.org/1.78.0/std/primitive.unit.html">()</a>, <aclass="struct"href="struct.BuildError.html"title="struct regex_automata::nfa::thompson::BuildError">BuildError</a>></h4></section></summary><divclass="docblock"><p>Add a transition from one state to another.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.set_utf8"class="method"><aclass="src rightside"href="../../../src/regex_automata/nfa/thompson/builder.rs.html#1219-1221">source</a><h4class="code-header">pub fn <ahref="#method.set_utf8"class="fn">set_utf8</a>(&mut self, yes: <aclass="primitive"href="https://doc.rust-lang.org/1.78.0/std/primitive.bool.html">bool</a>)</h4></section></summary><divclass="docblock"><p>Set whether the NFA produced by this builder should only match UTF-8.</p>
<p>This should be set when both of the following are true:</p>
<ol>
<li>The caller guarantees that the NFA created by this build will only
report non-empty matches with spans that are valid UTF-8.</li>
<li>The caller desires regex engines using this NFA to avoid reporting
empty matches with a span that splits a valid UTF-8 encoded codepoint.</li>
</ol>
<p>Property (1) is not checked. Instead, this requires the caller to
promise that it is true. Property (2) corresponds to the behavior of
regex engines using the NFA created by this builder. Namely, there
is no way in the NFA’s graph itself to say that empty matches found
by, for example, the regex <code>a*</code> will fall on valid UTF-8 boundaries.
Instead, this option is used to communicate the UTF-8 semantic to regex
engines that will typically implement it as a post-processing step by
filtering out empty matches that don’t fall on UTF-8 boundaries.</p>
<p>If you’re building an NFA from an HIR (and not using a
<ahref="struct.Compiler.html"title="struct regex_automata::nfa::thompson::Compiler"><code>thompson::Compiler</code></a>), then you can
use the <ahref="../../util/syntax/struct.Config.html#method.utf8"title="method regex_automata::util::syntax::Config::utf8"><code>syntax::Config::utf8</code></a>
option to guarantee that if the HIR detects a non-empty match, then it
is guaranteed to be valid UTF-8.</p>
<p>Note that property (2) does <em>not</em> specify the behavior of executing
a search on a haystack that is not valid UTF-8. Therefore, if you’re
<em>not</em> running this NFA on strings that are guaranteed to be valid
UTF-8, you almost certainly do not want to enable this option.
Similarly, if you are running the NFA on strings that <em>are</em> guaranteed
to be valid UTF-8, then you almost certainly want to enable this option
unless you can guarantee that your NFA will never produce a zero-width
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_utf8"class="method"><aclass="src rightside"href="../../../src/regex_automata/nfa/thompson/builder.rs.html#1226-1228">source</a><h4class="code-header">pub fn <ahref="#method.get_utf8"class="fn">get_utf8</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.78.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns whether UTF-8 mode is enabled for this builder.</p>
<p>See <ahref="struct.Builder.html#method.set_utf8"title="method regex_automata::nfa::thompson::Builder::set_utf8"><code>Builder::set_utf8</code></a> for more details about what “UTF-8 mode” is.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.set_reverse"class="method"><aclass="src rightside"href="../../../src/regex_automata/nfa/thompson/builder.rs.html#1239-1241">source</a><h4class="code-header">pub fn <ahref="#method.set_reverse"class="fn">set_reverse</a>(&mut self, yes: <aclass="primitive"href="https://doc.rust-lang.org/1.78.0/std/primitive.bool.html">bool</a>)</h4></section></summary><divclass="docblock"><p>Sets whether the NFA produced by this builder should be matched in
reverse or not. Generally speaking, when enabled, the NFA produced
should be matched by moving backwards through a haystack, from a higher
memory address to a lower memory address.</p>
<p>See also <ahref="struct.NFA.html#method.is_reverse"title="method regex_automata::nfa::thompson::NFA::is_reverse"><code>NFA::is_reverse</code></a> for more details.</p>
<p>This is disabled by default, which means NFAs are by default matched
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_reverse"class="method"><aclass="src rightside"href="../../../src/regex_automata/nfa/thompson/builder.rs.html#1247-1249">source</a><h4class="code-header">pub fn <ahref="#method.get_reverse"class="fn">get_reverse</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.78.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns whether reverse mode is enabled for this builder.</p>
<p>See <ahref="struct.Builder.html#method.set_reverse"title="method regex_automata::nfa::thompson::Builder::set_reverse"><code>Builder::set_reverse</code></a> for more details about what “reverse mode”
is.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.set_look_matcher"class="method"><aclass="src rightside"href="../../../src/regex_automata/nfa/thompson/builder.rs.html#1257-1259">source</a><h4class="code-header">pub fn <ahref="#method.set_look_matcher"class="fn">set_look_matcher</a>(&mut self, m: <aclass="struct"href="../../util/look/struct.LookMatcher.html"title="struct regex_automata::util::look::LookMatcher">LookMatcher</a>)</h4></section></summary><divclass="docblock"><p>Sets the look-around matcher that should be used for the resulting NFA.</p>
<p>A look-around matcher can be used to configure how look-around
assertions are matched. For example, a matcher might carry
configuration that changes the line terminator used for <code>(?m:^)</code> and
<code>(?m:$)</code> assertions.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_look_matcher"class="method"><aclass="src rightside"href="../../../src/regex_automata/nfa/thompson/builder.rs.html#1265-1267">source</a><h4class="code-header">pub fn <ahref="#method.get_look_matcher"class="fn">get_look_matcher</a>(&self) ->&<aclass="struct"href="../../util/look/struct.LookMatcher.html"title="struct regex_automata::util::look::LookMatcher">LookMatcher</a></h4></section></summary><divclass="docblock"><p>Returns the look-around matcher used for this builder.</p>
<p>If a matcher was not explicitly set, then <code>LookMatcher::default()</code> is
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.memory_usage"class="method"><aclass="src rightside"href="../../../src/regex_automata/nfa/thompson/builder.rs.html#1299-1301">source</a><h4class="code-header">pub fn <ahref="#method.memory_usage"class="fn">memory_usage</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.78.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the heap memory usage, in bytes, used by the NFA states added
<code><ahref="https://doc.rust-lang.org/1.78.0/core/convert/trait.From.html"title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-ToOwned-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.78.0/src/alloc/borrow.rs.html#83-85">source</a><ahref="#impl-ToOwned-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.78.0/alloc/borrow/trait.ToOwned.html"title="trait alloc::borrow::ToOwned">ToOwned</a> for T<divclass="where">where
T: <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Owned"class="associatedtype trait-impl"><ahref="#associatedtype.Owned"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.78.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned"class="associatedtype">Owned</a> = T</h4></section></summary><divclass='docblock'>The resulting type after obtaining ownership.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.to_owned"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.78.0/src/alloc/borrow.rs.html#88">source</a><ahref="#method.to_owned"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.78.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned"class="fn">to_owned</a>(&self) -> T</h4></section></summary><divclass='docblock'>Creates owned data from borrowed data, usually by cloning. <ahref="https://doc.rust-lang.org/1.78.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.clone_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.78.0/src/alloc/borrow.rs.html#92">source</a><ahref="#method.clone_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.78.0/alloc/borrow/trait.ToOwned.html#method.clone_into"class="fn">clone_into</a>(&self, target: <aclass="primitive"href="https://doc.rust-lang.org/1.78.0/std/primitive.reference.html">&mut T</a>)</h4></section></summary><divclass='docblock'>Uses borrowed data to replace owned data, usually by cloning. <ahref="https://doc.rust-lang.org/1.78.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryFrom%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.78.0/src/core/convert/mod.rs.html#805-807">source</a><ahref="#impl-TryFrom%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html#associatedtype.Error"class="associatedtype">Error</a> = <aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/convert/enum.Infallible.html"title="enum core::convert::Infallible">Infallible</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.78.0/src/core/convert/mod.rs.html#812">source</a><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html#tymethod.try_from"class="fn">try_from</a>(value: U) -><aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><T, <T as <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryInto%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.78.0/src/core/convert/mod.rs.html#790-792">source</a><ahref="#impl-TryInto%3CU%3E-for-T"class="anchor">§</a><h3class="code-header">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryInto.html"title="trait core::convert::TryInto">TryInto</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryInto.html#associatedtype.Error"class="associatedtype">Error</a> = <U as <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.78.0/src/core/convert/mod.rs.html#797">source</a><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryInto.html#tymethod.try_into"class="fn">try_into</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.78.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><U, <U as <aclass="trait"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.78.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>