blob: e0e2bb197b09bd455dc2fd258e08aa4145acf637 [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The configuration and the haystack to use for an Aho-Corasick search."><meta name="keywords" content="rust, rustlang, rust-lang, Input"><title>Input in aho_corasick - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../aho_corasick/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="../aho_corasick/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Input</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.anchored">anchored</a></li><li><a href="#method.earliest">earliest</a></li><li><a href="#method.end">end</a></li><li><a href="#method.get_anchored">get_anchored</a></li><li><a href="#method.get_earliest">get_earliest</a></li><li><a href="#method.get_range">get_range</a></li><li><a href="#method.get_span">get_span</a></li><li><a href="#method.haystack">haystack</a></li><li><a href="#method.is_done">is_done</a></li><li><a href="#method.new">new</a></li><li><a href="#method.range">range</a></li><li><a href="#method.set_anchored">set_anchored</a></li><li><a href="#method.set_earliest">set_earliest</a></li><li><a href="#method.set_end">set_end</a></li><li><a href="#method.set_range">set_range</a></li><li><a href="#method.set_span">set_span</a></li><li><a href="#method.set_start">set_start</a></li><li><a href="#method.span">span</a></li><li><a href="#method.start">start</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Clone-for-Input%3C%27h%3E">Clone</a></li><li><a href="#impl-Debug-for-Input%3C%27h%3E">Debug</a></li><li><a href="#impl-From%3C%26%27h%20H%3E-for-Input%3C%27h%3E">From&lt;&amp;&#39;h H&gt;</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-Input%3C%27h%3E">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Input%3C%27h%3E">Send</a></li><li><a href="#impl-Sync-for-Input%3C%27h%3E">Sync</a></li><li><a href="#impl-Unpin-for-Input%3C%27h%3E">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Input%3C%27h%3E">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-Input%3C%27h%3E">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-Input%3C%27h%3E">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-Input%3C%27h%3E">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-Input%3C%27h%3E">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-Input%3C%27h%3E">Into&lt;U&gt;</a></li><li><a href="#impl-ToOwned-for-Input%3C%27h%3E">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-Input%3C%27h%3E">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-Input%3C%27h%3E">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In aho_corasick</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">aho_corasick</a>::<wbr><a class="struct" href="#">Input</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/aho_corasick/util/search.rs.html#83-88">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust struct"><code>pub struct Input&lt;'h&gt; { /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The configuration and the haystack to use for an Aho-Corasick search.</p>
<p>When executing a search, there are a few parameters one might want to
configure:</p>
<ul>
<li>The haystack to search, provided to the <a href="struct.Input.html#method.new" title="Input::new"><code>Input::new</code></a> constructor. This
is the only required parameter.</li>
<li>The span <em>within</em> the haystack to limit a search to. (The default
is the entire haystack.) This is configured via <a href="struct.Input.html#method.span" title="Input::span"><code>Input::span</code></a> or
<a href="struct.Input.html#method.range" title="Input::range"><code>Input::range</code></a>.</li>
<li>Whether to run an unanchored (matches can occur anywhere after the
start of the search) or anchored (matches can only occur beginning at
the start of the search) search. Unanchored search is the default. This is
configured via <a href="struct.Input.html#method.anchored" title="Input::anchored"><code>Input::anchored</code></a>.</li>
<li>Whether to quit the search as soon as a match has been found, regardless
of the <a href="enum.MatchKind.html" title="MatchKind"><code>MatchKind</code></a> that the searcher was built with. This is configured
via <a href="struct.Input.html#method.earliest" title="Input::earliest"><code>Input::earliest</code></a>.</li>
</ul>
<p>For most cases, the defaults for all optional parameters are appropriate.
The utility of this type is that it keeps the default or common case simple
while permitting tweaking parameters in more niche use cases while reusing
the same search APIs.</p>
<h2 id="valid-bounds-and-search-termination"><a href="#valid-bounds-and-search-termination">Valid bounds and search termination</a></h2>
<p>An <code>Input</code> permits setting the bounds of a search via either
<a href="struct.Input.html#method.span" title="Input::span"><code>Input::span</code></a> or <a href="struct.Input.html#method.range" title="Input::range"><code>Input::range</code></a>. The bounds set must be valid, or
else a panic will occur. Bounds are valid if and only if:</p>
<ul>
<li>The bounds represent a valid range into the input’s haystack.</li>
<li><strong>or</strong> the end bound is a valid ending bound for the haystack <em>and</em>
the start bound is exactly one greater than the end bound.</li>
</ul>
<p>In the latter case, <a href="struct.Input.html#method.is_done" title="Input::is_done"><code>Input::is_done</code></a> will return true and indicates any
search receiving such an input should immediately return with no match.</p>
<p>Other than representing “search is complete,” the <code>Input::span</code> and
<code>Input::range</code> APIs are never necessary. Instead, callers can slice the
haystack instead, e.g., with <code>&amp;haystack[start..end]</code>. With that said, they
can be more convenient than slicing because the match positions reported
when using <code>Input::span</code> or <code>Input::range</code> are in terms of the original
haystack. If you instead use <code>&amp;haystack[start..end]</code>, then you’ll need to
add <code>start</code> to any match position returned in order for it to be a correct
index into <code>haystack</code>.</p>
<h2 id="example-str-and-u8-automatically-convert-to-an-input"><a href="#example-str-and-u8-automatically-convert-to-an-input">Example: <code>&amp;str</code> and <code>&amp;[u8]</code> automatically convert to an <code>Input</code></a></h2>
<p>There is a <code>From&lt;&amp;T&gt; for Input</code> implementation for all <code>T: AsRef&lt;[u8]&gt;</code>.
Additionally, the <a href="struct.AhoCorasick.html"><code>AhoCorasick</code></a> search APIs accept
a <code>Into&lt;Input&gt;</code>. These two things combined together mean you can provide
things like <code>&amp;str</code> and <code>&amp;[u8]</code> to search APIs when the defaults are
suitable, but also an <code>Input</code> when they’re not. For example:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::{AhoCorasick, Anchored, Input, Match, StartKind};
<span class="comment">// Build a searcher that supports both unanchored and anchored modes.
</span><span class="kw">let </span>ac = AhoCorasick::builder()
.start_kind(StartKind::Both)
.build(<span class="kw-2">&amp;</span>[<span class="string">&quot;abcd&quot;</span>, <span class="string">&quot;b&quot;</span>])
.unwrap();
<span class="kw">let </span>haystack = <span class="string">&quot;abcd&quot;</span>;
<span class="comment">// A search using default parameters is unanchored. With standard
// semantics, this finds `b` first.
</span><span class="macro">assert_eq!</span>(
<span class="prelude-val">Some</span>(Match::must(<span class="number">1</span>, <span class="number">1</span>..<span class="number">2</span>)),
ac.find(haystack),
);
<span class="comment">// Using the same &#39;find&#39; routine, we can provide an &#39;Input&#39; explicitly
// that is configured to do an anchored search. Since &#39;b&#39; doesn&#39;t start
// at the beginning of the search, it is not reported as a match.
</span><span class="macro">assert_eq!</span>(
<span class="prelude-val">Some</span>(Match::must(<span class="number">0</span>, <span class="number">0</span>..<span class="number">4</span>)),
ac.find(Input::new(haystack).anchored(Anchored::Yes)),
);</code></pre></div>
</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-Input%3C%27h%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#90-630">source</a><a href="#impl-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;'h&gt; <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.new" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#93-100">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>&lt;H:&nbsp;?Sized + AsRef&lt;[u8]&gt;&gt;(haystack: &amp;'h H) -&gt; <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h4></section></summary><div class="docblock"><p>Create a new search configuration for the given haystack.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.span" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#142-145">source</a><h4 class="code-header">pub fn <a href="#method.span" class="fnname">span</a>&lt;S:&nbsp;Into&lt;<a class="struct" href="struct.Span.html" title="struct aho_corasick::Span">Span</a>&gt;&gt;(self, span: S) -&gt; <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h4></section></summary><div class="docblock"><p>Set the span for this search.</p>
<p>This routine is generic over how a span is provided. While
a <a href="struct.Span.html" title="Span"><code>Span</code></a> may be given directly, one may also provide a
<code>std::ops::Range&lt;usize&gt;</code>. To provide anything supported by range
syntax, use the <a href="struct.Input.html#method.range" title="Input::range"><code>Input::range</code></a> method.</p>
<p>The default span is the entire haystack.</p>
<p>Note that <a href="struct.Input.html#method.range" title="Input::range"><code>Input::range</code></a> overrides this method and vice versa.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>This panics if the given span does not correspond to valid bounds in
the haystack or the termination of a search.</p>
<h5 id="example"><a href="#example">Example</a></h5>
<p>This example shows how the span of the search can impact whether a
match is reported or not.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::{AhoCorasick, Input, MatchKind};
<span class="kw">let </span>patterns = <span class="kw-2">&amp;</span>[<span class="string">&quot;b&quot;</span>, <span class="string">&quot;abcd&quot;</span>, <span class="string">&quot;abc&quot;</span>];
<span class="kw">let </span>haystack = <span class="string">&quot;abcd&quot;</span>;
<span class="kw">let </span>ac = AhoCorasick::builder()
.match_kind(MatchKind::LeftmostFirst)
.build(patterns)
.unwrap();
<span class="kw">let </span>input = Input::new(haystack).span(<span class="number">0</span>..<span class="number">3</span>);
<span class="kw">let </span>mat = ac.try_find(input)<span class="question-mark">?</span>.expect(<span class="string">&quot;should have a match&quot;</span>);
<span class="comment">// Without the span stopping the search early, &#39;abcd&#39; would be reported
// because it is the correct leftmost-first match.
</span><span class="macro">assert_eq!</span>(<span class="string">&quot;abc&quot;</span>, <span class="kw-2">&amp;</span>haystack[mat.span()]);
</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.range" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#175-178">source</a><h4 class="code-header">pub fn <a href="#method.range" class="fnname">range</a>&lt;R:&nbsp;RangeBounds&lt;usize&gt;&gt;(self, range: R) -&gt; <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h4></section></summary><div class="docblock"><p>Like <code>Input::span</code>, but accepts any range instead.</p>
<p>The default range is the entire haystack.</p>
<p>Note that <a href="struct.Input.html#method.span" title="Input::span"><code>Input::span</code></a> overrides this method and vice versa.</p>
<h5 id="panics-1"><a href="#panics-1">Panics</a></h5>
<p>This routine will panic if the given range could not be converted
to a valid [<code>Range</code>]. For example, this would panic when given
<code>0..=usize::MAX</code> since it cannot be represented using a half-open
interval in terms of <code>usize</code>.</p>
<p>This routine also panics if the given range does not correspond to
valid bounds in the haystack or the termination of a search.</p>
<h5 id="example-1"><a href="#example-1">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::Input;
<span class="kw">let </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="number">0</span>..<span class="number">6</span>, input.get_range());
<span class="kw">let </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>).range(<span class="number">2</span>..=<span class="number">4</span>);
<span class="macro">assert_eq!</span>(<span class="number">2</span>..<span class="number">5</span>, input.get_range());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.anchored" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#252-255">source</a><h4 class="code-header">pub fn <a href="#method.anchored" class="fnname">anchored</a>(self, mode: <a class="enum" href="enum.Anchored.html" title="enum aho_corasick::Anchored">Anchored</a>) -&gt; <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h4></section></summary><div class="docblock"><p>Sets the anchor mode of a search.</p>
<p>When a search is anchored (via <a href="enum.Anchored.html#variant.Yes" title="Anchored::Yes"><code>Anchored::Yes</code></a>), a match must begin
at the start of a search. When a search is not anchored (that’s
<a href="enum.Anchored.html#variant.No" title="Anchored::No"><code>Anchored::No</code></a>), searchers will look for a match anywhere in the
haystack.</p>
<p>By default, the anchored mode is <a href="enum.Anchored.html#variant.No" title="Anchored::No"><code>Anchored::No</code></a>.</p>
<h5 id="support-for-anchored-searches"><a href="#support-for-anchored-searches">Support for anchored searches</a></h5>
<p>Anchored or unanchored searches might not always be available,
depending on the type of searcher used and its configuration:</p>
<ul>
<li><a href="nfa/noncontiguous/struct.NFA.html"><code>noncontiguous::NFA</code></a> always
supports both unanchored and anchored searches.</li>
<li><a href="nfa/contiguous/struct.NFA.html"><code>contiguous::NFA</code></a> always supports both
unanchored and anchored searches.</li>
<li><a href="dfa/struct.DFA.html"><code>dfa::DFA</code></a> supports only unanchored
searches by default.
<a href="dfa/struct.Builder.html#method.start_kind"><code>dfa::Builder::start_kind</code></a> can
be used to change the default to supporting both kinds of searches
or even just anchored searches.</li>
<li><a href="struct.AhoCorasick.html"><code>AhoCorasick</code></a> inherits the same setup as a
<code>DFA</code>. Namely, it only supports unanchored searches by default, but
<a href="struct.AhoCorasickBuilder.html#method.start_kind"><code>AhoCorasickBuilder::start_kind</code></a>
can change this.</li>
</ul>
<p>If you try to execute a search using a <code>try_</code> (“fallible”) method with
an unsupported anchor mode, then an error will be returned. For calls
to infallible search methods, a panic will result.</p>
<h5 id="example-2"><a href="#example-2">Example</a></h5>
<p>This demonstrates the differences between an anchored search and
an unanchored search. Notice that we build our <code>AhoCorasick</code> searcher
with <a href="enum.StartKind.html#variant.Both" title="StartKind::Both"><code>StartKind::Both</code></a> so that it supports both unanchored and
anchored searches simultaneously.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::{
AhoCorasick, Anchored, Input, MatchKind, StartKind,
};
<span class="kw">let </span>patterns = <span class="kw-2">&amp;</span>[<span class="string">&quot;bcd&quot;</span>];
<span class="kw">let </span>haystack = <span class="string">&quot;abcd&quot;</span>;
<span class="kw">let </span>ac = AhoCorasick::builder()
.start_kind(StartKind::Both)
.build(patterns)
.unwrap();
<span class="comment">// Note that &#39;Anchored::No&#39; is the default, so it doesn&#39;t need to
// be explicitly specified here.
</span><span class="kw">let </span>input = Input::new(haystack);
<span class="kw">let </span>mat = ac.try_find(input)<span class="question-mark">?</span>.expect(<span class="string">&quot;should have a match&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="string">&quot;bcd&quot;</span>, <span class="kw-2">&amp;</span>haystack[mat.span()]);
<span class="comment">// While &#39;bcd&#39; occurs in the haystack, it does not begin where our
// search begins, so no match is found.
</span><span class="kw">let </span>input = Input::new(haystack).anchored(Anchored::Yes);
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, ac.try_find(input)<span class="question-mark">?</span>);
<span class="comment">// However, if we start our search where &#39;bcd&#39; starts, then we will
// find a match.
</span><span class="kw">let </span>input = Input::new(haystack).range(<span class="number">1</span>..).anchored(Anchored::Yes);
<span class="kw">let </span>mat = ac.try_find(input)<span class="question-mark">?</span>.expect(<span class="string">&quot;should have a match&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="string">&quot;bcd&quot;</span>, <span class="kw-2">&amp;</span>haystack[mat.span()]);
</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.earliest" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#302-305">source</a><h4 class="code-header">pub fn <a href="#method.earliest" class="fnname">earliest</a>(self, yes: bool) -&gt; <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h4></section></summary><div class="docblock"><p>Whether to execute an “earliest” search or not.</p>
<p>When running a non-overlapping search, an “earliest” search will
return the match location as early as possible. For example, given
the patterns <code>abc</code> and <code>b</code>, and a haystack of <code>abc</code>, a normal
leftmost-first search will return <code>abc</code> as a match. But an “earliest”
search will return as soon as it is known that a match occurs, which
happens once <code>b</code> is seen.</p>
<p>Note that when using <a href="enum.MatchKind.html#variant.Standard" title="MatchKind::Standard"><code>MatchKind::Standard</code></a>, the “earliest” option
has no effect since standard semantics are already “earliest.” Note
also that this has no effect in overlapping searches, since overlapping
searches also use standard semantics and report all possible matches.</p>
<p>This is disabled by default.</p>
<h5 id="example-3"><a href="#example-3">Example</a></h5>
<p>This example shows the difference between “earliest” searching and
normal leftmost searching.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::{AhoCorasick, Anchored, Input, MatchKind, StartKind};
<span class="kw">let </span>patterns = <span class="kw-2">&amp;</span>[<span class="string">&quot;abc&quot;</span>, <span class="string">&quot;b&quot;</span>];
<span class="kw">let </span>haystack = <span class="string">&quot;abc&quot;</span>;
<span class="kw">let </span>ac = AhoCorasick::builder()
.match_kind(MatchKind::LeftmostFirst)
.build(patterns)
.unwrap();
<span class="comment">// The normal leftmost-first match.
</span><span class="kw">let </span>input = Input::new(haystack);
<span class="kw">let </span>mat = ac.try_find(input)<span class="question-mark">?</span>.expect(<span class="string">&quot;should have a match&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="string">&quot;abc&quot;</span>, <span class="kw-2">&amp;</span>haystack[mat.span()]);
<span class="comment">// The &quot;earliest&quot; possible match, even if it isn&#39;t leftmost-first.
</span><span class="kw">let </span>input = Input::new(haystack).earliest(<span class="bool-val">true</span>);
<span class="kw">let </span>mat = ac.try_find(input)<span class="question-mark">?</span>.expect(<span class="string">&quot;should have a match&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="string">&quot;b&quot;</span>, <span class="kw-2">&amp;</span>haystack[mat.span()]);
</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_span" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#332-342">source</a><h4 class="code-header">pub fn <a href="#method.set_span" class="fnname">set_span</a>&lt;S:&nbsp;Into&lt;<a class="struct" href="struct.Span.html" title="struct aho_corasick::Span">Span</a>&gt;&gt;(&amp;mut self, span: S)</h4></section></summary><div class="docblock"><p>Set the span for this search configuration.</p>
<p>This is like the <a href="struct.Input.html#method.span" title="Input::span"><code>Input::span</code></a> method, except this mutates the
span in place.</p>
<p>This routine is generic over how a span is provided. While
a <a href="struct.Span.html" title="Span"><code>Span</code></a> may be given directly, one may also provide a
<code>std::ops::Range&lt;usize&gt;</code>.</p>
<h5 id="panics-2"><a href="#panics-2">Panics</a></h5>
<p>This panics if the given span does not correspond to valid bounds in
the haystack or the termination of a search.</p>
<h5 id="example-4"><a href="#example-4">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::Input;
<span class="kw">let </span><span class="kw-2">mut </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="number">0</span>..<span class="number">6</span>, input.get_range());
input.set_span(<span class="number">2</span>..<span class="number">4</span>);
<span class="macro">assert_eq!</span>(<span class="number">2</span>..<span class="number">4</span>, input.get_range());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_range" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#370-389">source</a><h4 class="code-header">pub fn <a href="#method.set_range" class="fnname">set_range</a>&lt;R:&nbsp;RangeBounds&lt;usize&gt;&gt;(&amp;mut self, range: R)</h4></section></summary><div class="docblock"><p>Set the span for this search configuration given any range.</p>
<p>This is like the <a href="struct.Input.html#method.range" title="Input::range"><code>Input::range</code></a> method, except this mutates the
span in place.</p>
<h5 id="panics-3"><a href="#panics-3">Panics</a></h5>
<p>This routine will panic if the given range could not be converted
to a valid [<code>Range</code>]. For example, this would panic when given
<code>0..=usize::MAX</code> since it cannot be represented using a half-open
interval in terms of <code>usize</code>.</p>
<p>This routine also panics if the given range does not correspond to
valid bounds in the haystack or the termination of a search.</p>
<h5 id="example-5"><a href="#example-5">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::Input;
<span class="kw">let </span><span class="kw-2">mut </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="number">0</span>..<span class="number">6</span>, input.get_range());
input.set_range(<span class="number">2</span>..=<span class="number">4</span>);
<span class="macro">assert_eq!</span>(<span class="number">2</span>..<span class="number">5</span>, input.get_range());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_start" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#412-414">source</a><h4 class="code-header">pub fn <a href="#method.set_start" class="fnname">set_start</a>(&amp;mut self, start: usize)</h4></section></summary><div class="docblock"><p>Set the starting offset for the span for this search configuration.</p>
<p>This is a convenience routine for only mutating the start of a span
without having to set the entire span.</p>
<h5 id="panics-4"><a href="#panics-4">Panics</a></h5>
<p>This panics if the given span does not correspond to valid bounds in
the haystack or the termination of a search.</p>
<h5 id="example-6"><a href="#example-6">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::Input;
<span class="kw">let </span><span class="kw-2">mut </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="number">0</span>..<span class="number">6</span>, input.get_range());
input.set_start(<span class="number">5</span>);
<span class="macro">assert_eq!</span>(<span class="number">5</span>..<span class="number">6</span>, input.get_range());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_end" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#437-439">source</a><h4 class="code-header">pub fn <a href="#method.set_end" class="fnname">set_end</a>(&amp;mut self, end: usize)</h4></section></summary><div class="docblock"><p>Set the ending offset for the span for this search configuration.</p>
<p>This is a convenience routine for only mutating the end of a span
without having to set the entire span.</p>
<h5 id="panics-5"><a href="#panics-5">Panics</a></h5>
<p>This panics if the given span does not correspond to valid bounds in
the haystack or the termination of a search.</p>
<h5 id="example-7"><a href="#example-7">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::Input;
<span class="kw">let </span><span class="kw-2">mut </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="number">0</span>..<span class="number">6</span>, input.get_range());
input.set_end(<span class="number">5</span>);
<span class="macro">assert_eq!</span>(<span class="number">0</span>..<span class="number">5</span>, input.get_range());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_anchored" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#458-460">source</a><h4 class="code-header">pub fn <a href="#method.set_anchored" class="fnname">set_anchored</a>(&amp;mut self, mode: <a class="enum" href="enum.Anchored.html" title="enum aho_corasick::Anchored">Anchored</a>)</h4></section></summary><div class="docblock"><p>Set the anchor mode of a search.</p>
<p>This is like <a href="struct.Input.html#method.anchored" title="Input::anchored"><code>Input::anchored</code></a>, except it mutates the search
configuration in place.</p>
<h5 id="example-8"><a href="#example-8">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::{Anchored, Input};
<span class="kw">let </span><span class="kw-2">mut </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert_eq!</span>(Anchored::No, input.get_anchored());
input.set_anchored(Anchored::Yes);
<span class="macro">assert_eq!</span>(Anchored::Yes, input.get_anchored());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_earliest" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#478-480">source</a><h4 class="code-header">pub fn <a href="#method.set_earliest" class="fnname">set_earliest</a>(&amp;mut self, yes: bool)</h4></section></summary><div class="docblock"><p>Set whether the search should execute in “earliest” mode or not.</p>
<p>This is like <a href="struct.Input.html#method.earliest" title="Input::earliest"><code>Input::earliest</code></a>, except it mutates the search
configuration in place.</p>
<h5 id="example-9"><a href="#example-9">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::Input;
<span class="kw">let </span><span class="kw-2">mut </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert!</span>(!input.get_earliest());
input.set_earliest(<span class="bool-val">true</span>);
<span class="macro">assert!</span>(input.get_earliest());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.haystack" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#493-495">source</a><h4 class="code-header">pub fn <a href="#method.haystack" class="fnname">haystack</a>(&amp;self) -&gt; &amp;[u8]</h4></section></summary><div class="docblock"><p>Return a borrow of the underlying haystack as a slice of bytes.</p>
<h5 id="example-10"><a href="#example-10">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::Input;
<span class="kw">let </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="string">b&quot;foobar&quot;</span>, input.haystack());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.start" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#513-515">source</a><h4 class="code-header">pub fn <a href="#method.start" class="fnname">start</a>(&amp;self) -&gt; usize</h4></section></summary><div class="docblock"><p>Return the start position of this search.</p>
<p>This is a convenience routine for <code>search.get_span().start()</code>.</p>
<h5 id="example-11"><a href="#example-11">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::Input;
<span class="kw">let </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="number">0</span>, input.start());
<span class="kw">let </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>).span(<span class="number">2</span>..<span class="number">4</span>);
<span class="macro">assert_eq!</span>(<span class="number">2</span>, input.start());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.end" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#533-535">source</a><h4 class="code-header">pub fn <a href="#method.end" class="fnname">end</a>(&amp;self) -&gt; usize</h4></section></summary><div class="docblock"><p>Return the end position of this search.</p>
<p>This is a convenience routine for <code>search.get_span().end()</code>.</p>
<h5 id="example-12"><a href="#example-12">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::Input;
<span class="kw">let </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="number">6</span>, input.end());
<span class="kw">let </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>).span(<span class="number">2</span>..<span class="number">4</span>);
<span class="macro">assert_eq!</span>(<span class="number">4</span>, input.end());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_span" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#551-553">source</a><h4 class="code-header">pub fn <a href="#method.get_span" class="fnname">get_span</a>(&amp;self) -&gt; <a class="struct" href="struct.Span.html" title="struct aho_corasick::Span">Span</a></h4></section></summary><div class="docblock"><p>Return the span for this search configuration.</p>
<p>If one was not explicitly set, then the span corresponds to the entire
range of the haystack.</p>
<h5 id="example-13"><a href="#example-13">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::{Input, Span};
<span class="kw">let </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert_eq!</span>(Span { start: <span class="number">0</span>, end: <span class="number">6 </span>}, input.get_span());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_range" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#569-571">source</a><h4 class="code-header">pub fn <a href="#method.get_range" class="fnname">get_range</a>(&amp;self) -&gt; Range&lt;usize&gt;</h4></section></summary><div class="docblock"><p>Return the span as a range for this search configuration.</p>
<p>If one was not explicitly set, then the span corresponds to the entire
range of the haystack.</p>
<h5 id="example-14"><a href="#example-14">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::Input;
<span class="kw">let </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="number">0</span>..<span class="number">6</span>, input.get_range());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_anchored" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#589-591">source</a><h4 class="code-header">pub fn <a href="#method.get_anchored" class="fnname">get_anchored</a>(&amp;self) -&gt; <a class="enum" href="enum.Anchored.html" title="enum aho_corasick::Anchored">Anchored</a></h4></section></summary><div class="docblock"><p>Return the anchored mode for this search configuration.</p>
<p>If no anchored mode was set, then it defaults to <a href="enum.Anchored.html#variant.No" title="Anchored::No"><code>Anchored::No</code></a>.</p>
<h5 id="example-15"><a href="#example-15">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::{Anchored, Input};
<span class="kw">let </span><span class="kw-2">mut </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert_eq!</span>(Anchored::No, input.get_anchored());
input.set_anchored(Anchored::Yes);
<span class="macro">assert_eq!</span>(Anchored::Yes, input.get_anchored());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_earliest" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#604-606">source</a><h4 class="code-header">pub fn <a href="#method.get_earliest" class="fnname">get_earliest</a>(&amp;self) -&gt; bool</h4></section></summary><div class="docblock"><p>Return whether this search should execute in “earliest” mode.</p>
<h5 id="example-16"><a href="#example-16">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::Input;
<span class="kw">let </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert!</span>(!input.get_earliest());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_done" class="method has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#627-629">source</a><h4 class="code-header">pub fn <a href="#method.is_done" class="fnname">is_done</a>(&amp;self) -&gt; bool</h4></section></summary><div class="docblock"><p>Return true if this input has been exhausted, which in turn means all
subsequent searches will return no matches.</p>
<p>This occurs precisely when the start position of this search is greater
than the end position of the search.</p>
<h5 id="example-17"><a href="#example-17">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>aho_corasick::Input;
<span class="kw">let </span><span class="kw-2">mut </span>input = Input::new(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert!</span>(!input.is_done());
input.set_start(<span class="number">6</span>);
<span class="macro">assert!</span>(!input.is_done());
input.set_start(<span class="number">7</span>);
<span class="macro">assert!</span>(input.is_done());</code></pre></div>
</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-Clone-for-Input%3C%27h%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#82">source</a><a href="#impl-Clone-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;'h&gt; Clone for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#82">source</a><a href="#method.clone" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h4></section></summary><div class='docblock'>Returns a copy of the value. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.clone_from" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">clone_from</a>(&amp;mut self, source: &amp;Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Debug-for-Input%3C%27h%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#632-644">source</a><a href="#impl-Debug-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;'h&gt; Debug for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#633-643">source</a><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a class="fnname">fmt</a>(&amp;self, f: &amp;mut Formatter&lt;'_&gt;) -&gt; Result</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-From%3C%26%27h%20H%3E-for-Input%3C%27h%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#646-651">source</a><a href="#impl-From%3C%26%27h%20H%3E-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;'h, H:&nbsp;?Sized + AsRef&lt;[u8]&gt;&gt; From&lt;&amp;'h H&gt; for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/aho_corasick/util/search.rs.html#648-650">source</a><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(haystack: &amp;'h H) -&gt; <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h4></section></summary><div class='docblock'>Converts to this type from the input type.</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-Input%3C%27h%3E" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;'h&gt; RefUnwindSafe for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h3></section><section id="impl-Send-for-Input%3C%27h%3E" class="impl has-srclink"><a href="#impl-Send-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;'h&gt; Send for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h3></section><section id="impl-Sync-for-Input%3C%27h%3E" class="impl has-srclink"><a href="#impl-Sync-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;'h&gt; Sync for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h3></section><section id="impl-Unpin-for-Input%3C%27h%3E" class="impl has-srclink"><a href="#impl-Unpin-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;'h&gt; Unpin for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</h3></section><section id="impl-UnwindSafe-for-Input%3C%27h%3E" class="impl has-srclink"><a href="#impl-UnwindSafe-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;'h&gt; UnwindSafe for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a>&lt;'h&gt;</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-Input%3C%27h%3E" class="impl has-srclink"><a href="#impl-Any-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Any for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl has-srclink"><a href="#method.type_id" class="anchor"></a><h4 class="code-header">fn <a class="fnname">type_id</a>(&amp;self) -&gt; TypeId</h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-Input%3C%27h%3E" class="impl has-srclink"><a href="#impl-Borrow%3CT%3E-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Borrow&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow</a>(&amp;self) -&gt; &amp;T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-Input%3C%27h%3E" class="impl has-srclink"><a href="#impl-BorrowMut%3CT%3E-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; BorrowMut&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow_mut</a>(&amp;mut self) -&gt; &amp;mut T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-Input%3C%27h%3E" class="impl has-srclink"><a href="#impl-From%3CT%3E-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; From&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.from-1" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-Input%3C%27h%3E" class="impl has-srclink"><a href="#impl-Into%3CU%3E-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; Into&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: From&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code>[From]&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToOwned-for-Input%3C%27h%3E" class="impl has-srclink"><a href="#impl-ToOwned-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; ToOwned for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Clone,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Owned" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl has-srclink"><a href="#method.to_owned" class="anchor"></a><h4 class="code-header">fn <a class="fnname">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl has-srclink"><a href="#method.clone_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone_into</a>(&amp;self, target: &amp;mut T)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-Input%3C%27h%3E" class="impl has-srclink"><a href="#impl-TryFrom%3CU%3E-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryFrom&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: Into&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = Infallible</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(value: U) -&gt; Result&lt;T, &lt;T as TryFrom&lt;U&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-Input%3C%27h%3E" class="impl has-srclink"><a href="#impl-TryInto%3CU%3E-for-Input%3C%27h%3E" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryInto&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: TryFrom&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = &lt;U as TryFrom&lt;T&gt;&gt;::Error</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_into</a>(self) -&gt; Result&lt;U, &lt;U as TryFrom&lt;T&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="aho_corasick" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>