<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="An automaton for searching multiple strings in linear time."><title>AhoCorasick in aho_corasick - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><linkrel="stylesheet"href="../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../static.files/rustdoc-dd39b87e5fcfba68.css"><metaname="rustdoc-vars"data-root-path="../"data-static-root-path="../static.files/"data-current-crate="aho_corasick"data-themes=""data-resource-suffix=""data-rustdoc-version="1.80.0 (051478957 2024-07-21)"data-channel="1.80.0"data-search-js="search-d52510db62a78183.js"data-settings-js="settings-4313503d2e1961c2.js"><scriptsrc="../static.files/storage-118b08c4c78b968e.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../static.files/main-20a3ad099b048cf2.js"></script><noscript><linkrel="stylesheet"href="../static.files/noscript-df360f571f6edeae.css"></noscript><linkrel="alternate icon"type="image/png"href="../static.files/favicon-32x32-422f7d1d52889060.png"><linkrel="icon"type="image/svg+xml"href="../static.files/favicon-2c020d218678b618.svg"></head><bodyclass="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle"title="show sidebar"></button></nav><navclass="sidebar"><divclass="sidebar-crate"><h2><ahref="../aho_corasick/index.html">aho_corasick</a><spanclass="version">1.1.3</span></h2></div><h2class="location"><ahref="#">AhoCorasick</a></h2><divclass="sidebar-elems"><section><h3><ahref="#implementations">Methods</a></h3><ulclass="block method"><li><ahref="#method.builder">builder</a></li><li><ahref="#method.find">find</a></li><li><ahref="#method.find_iter">find_iter</a></li><li><ahref="#method.find_overlapping">find_overlapping</a></li><li><ahref="#method.find_overlapping_iter">find_overlapping_iter</a></li><li><ahref="#method.is_match">is_match</a></li><li><ahref="#method.kind">kind</a></li><li><ahref="#method.match_kind">match_kind</a></li><li><ahref="#method.max_pattern_len">max_pattern_len</a></li><li><ahref="#method.memory_usage">memory_usage</a></li><li><ahref="#method.min_pattern_len">min_pattern_len</a></li><li><ahref="#method.new">new</a></li><li><ahref="#method.patterns_len">patterns_len</a></li><li><ahref="#method.replace_all">replace_all</a></li><li><ahref="#method.replace_all_bytes">replace_all_bytes</a></li><li><ahref="#method.replace_all_with">replace_all_with</a></li><li><ahref="#method.replace_all_with_bytes">replace_all_with_bytes</a></li><li><ahref="#method.start_kind">start_kind</a></li><li><ahref="#method.stream_find_iter">stream_find_iter</a></li><li><ahref="#method.try_find">try_find</a></li><li><ahref="#method.try_find_iter">try_find_iter</a></li><li><ahref="#method.try_find_overlapping">try_find_overlapping</a></li><li><ahref="#method.try_find_overlapping_iter">try_find_overlapping_iter</a></li><li><ahref="#method.try_replace_all">try_replace_all</a></li><li><ahref="#method.try_replace_all_bytes">try_replace_all_bytes</a></li><li><ahref="#method.try_replace_all_with">try_replace_all_with</a></li><li><ahref="#method.try_replace_all_with_bytes">try_replace_all_with_bytes</a></li><li><ahref="#method.try_stream_find_iter">try_stream_find_iter</a></li><li><ahref="#method.try_stream_replace_all">try_stream_replace_all</a></li><li><ahref="#method.try_stream_replace
<p>The <code>AhoCorasick</code> type supports a few basic ways of constructing an
automaton, with the default being <ahref="struct.AhoCorasick.html#method.new"title="associated function aho_corasick::AhoCorasick::new"><code>AhoCorasick::new</code></a>. However, there
are a fair number of configurable options that can be set by using
<ahref="struct.AhoCorasickBuilder.html"title="struct aho_corasick::AhoCorasickBuilder"><code>AhoCorasickBuilder</code></a> instead. Such options include, but are not limited
to, how matches are determined, simple case insensitivity, whether to use a
DFA or not and various knobs for controlling the space-vs-time trade offs
<p>Aho-Corasick automatons are always constructed in <code>O(p)</code> time, where
<code>p</code> is the combined length of all patterns being searched. With that
said, building an automaton can be fairly costly because of high constant
factors, particularly when enabling the <ahref="enum.AhoCorasickKind.html#variant.DFA"title="variant aho_corasick::AhoCorasickKind::DFA">DFA</a> option
with <ahref="struct.AhoCorasickBuilder.html#method.kind"title="method aho_corasick::AhoCorasickBuilder::kind"><code>AhoCorasickBuilder::kind</code></a>. For this reason, it’s generally a good
idea to build an automaton once and reuse it as much as possible.</p>
<p>Aho-Corasick automatons can also use a fair bit of memory. To get
a concrete idea of how much memory is being used, try using the
<p>To give a quick idea of the differences between Aho-Corasick
implementations and their resource usage, here’s a sample of construction
times and heap memory used after building an automaton from 100,000
randomly selected titles from Wikipedia:</p>
<ul>
<li>99MB for a <ahref="nfa/noncontiguous/struct.NFA.html"title="struct aho_corasick::nfa::noncontiguous::NFA"><code>noncontiguous::NFA</code></a> in 240ms.</li>
<li>21MB for a <ahref="nfa/contiguous/struct.NFA.html"title="struct aho_corasick::nfa::contiguous::NFA"><code>contiguous::NFA</code></a> in 275ms.</li>
<li>1.6GB for a <ahref="dfa/struct.DFA.html"title="struct aho_corasick::dfa::DFA"><code>dfa::DFA</code></a> in 1.88s.</li>
</ul>
<p>(Note that the memory usage above reflects the size of each automaton and
not peak memory usage. For example, building a contiguous NFA requires
first building a noncontiguous NFA. Once the contiguous NFA is built, the
noncontiguous NFA is freed.)</p>
<p>This experiment very strongly argues that a contiguous NFA is often the
best balance in terms of resource usage. It takes a little longer to build,
but its memory usage is quite small. Its search speed (not listed) is
also often faster than a noncontiguous NFA, but a little slower than a
DFA. Indeed, when no specific <ahref="enum.AhoCorasickKind.html"title="enum aho_corasick::AhoCorasickKind"><code>AhoCorasickKind</code></a> is used (which is the
default), a contiguous NFA is used in most cases.</p>
<p>The only “catch” to using a contiguous NFA is that, because of its variety
of compression tricks, it may not be able to support automatons as large as
what the noncontiguous NFA supports. In which case, building a contiguous
NFA will fail and (by default) <code>AhoCorasick</code> will automatically fall
back to a noncontiguous NFA. (This typically only happens when building
automatons from millions of patterns.) Otherwise, the small additional time
for building a contiguous NFA is almost certainly worth it.</p>
<p>Most of the search routines accept anything that can be cheaply converted
to an <ahref="struct.Input.html"title="struct aho_corasick::Input"><code>Input</code></a>. This includes <code>&[u8]</code>, <code>&str</code> and <code>Input</code> itself.</p>
<p>The <code>AhoCorasick</code> type provides a number of methods for searching, as one
might expect. Depending on how the Aho-Corasick automaton was built and
depending on the search configuration, it is possible for a search to
return an error. Since an error is <em>never</em> dependent on the actual contents
of the haystack, this type provides both infallible and fallible methods
for searching. The infallible methods panic if an error occurs, and can be
used for convenience and when you know the search will never return an
error.</p>
<p>For example, the <ahref="struct.AhoCorasick.html#method.find_iter"title="method aho_corasick::AhoCorasick::find_iter"><code>AhoCorasick::find_iter</code></a> method is the infallible
version of the <ahref="struct.AhoCorasick.html#method.try_find_iter"title="method aho_corasick::AhoCorasick::try_find_iter"><code>AhoCorasick::try_find_iter</code></a> method.</p>
<p>Examples of errors that can occur:</p>
<ul>
<li>Running a search that requires <ahref="enum.MatchKind.html#variant.Standard"title="variant aho_corasick::MatchKind::Standard"><code>MatchKind::Standard</code></a> semantics (such
as a stream or overlapping search) with an automaton that was built with
<ahref="enum.MatchKind.html#variant.LeftmostFirst"title="variant aho_corasick::MatchKind::LeftmostFirst"><code>MatchKind::LeftmostFirst</code></a> or <ahref="enum.MatchKind.html#variant.LeftmostLongest"title="variant aho_corasick::MatchKind::LeftmostLongest"><code>MatchKind::LeftmostLongest</code></a> semantics.</li>
<li>Running an anchored search with an automaton that only supports
unanchored searches. (By default, <code>AhoCorasick</code> only supports unanchored
searches. But this can be toggled with <ahref="struct.AhoCorasickBuilder.html#method.start_kind"title="method aho_corasick::AhoCorasickBuilder::start_kind"><code>AhoCorasickBuilder::start_kind</code></a>.)</li>
<li>Running an unanchored search with an automaton that only supports
anchored searches.</li>
</ul>
<p>The common thread between the different types of errors is that they are
all rooted in the automaton construction and search configurations. If
those configurations are a static property of your program, then it is
reasonable to call infallible routines since you know an error will never
occur. And if one <em>does</em> occur, then it’s a bug in your program.</p>
<p>To re-iterate, if the patterns, build or search configuration come from
user or untrusted data, then you should handle errors at build or search
time. If only the haystack comes from user or untrusted data, then there
should be no need to handle errors anywhere and it is generally encouraged
to <code>unwrap()</code> (or <code>expect()</code>) both build and search time calls.</p>
</div></details><h2id="implementations"class="section-header">Implementations<ahref="#implementations"class="anchor">§</a></h2><divid="implementations-list"><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-AhoCorasick"class="impl"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#218-271">source</a><ahref="#impl-AhoCorasick"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.AhoCorasick.html"title="struct aho_corasick::AhoCorasick">AhoCorasick</a></h3></section></summary><divclass="docblock"><p>Convenience constructors for an Aho-Corasick searcher. To configure the
searcher, use an <ahref="struct.AhoCorasickBuilder.html"title="struct aho_corasick::AhoCorasickBuilder"><code>AhoCorasickBuilder</code></a> instead.</p>
P: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.AsRef.html"title="trait core::convert::AsRef">AsRef</a><[<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.u8.html">u8</a>]>,</div></h4></section></summary><divclass="docblock"><p>Create a new Aho-Corasick automaton using the default configuration.</p>
<p>This uses the default <ahref="enum.MatchKind.html#variant.Standard"title="variant aho_corasick::MatchKind::Standard"><code>MatchKind::Standard</code></a> match semantics, which
reports a match as soon as it is found. This corresponds to the
standard match semantics supported by textbook descriptions of the
ac.find(<spanclass="string">"xxx bar xxx"</span>).map(|m| m.pattern()),
);</code></pre></div>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.builder"class="method"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#268-270">source</a><h4class="code-header">pub fn <ahref="#method.builder"class="fn">builder</a>() -><aclass="struct"href="struct.AhoCorasickBuilder.html"title="struct aho_corasick::AhoCorasickBuilder">AhoCorasickBuilder</a></h4></section></summary><divclass="docblock"><p>A convenience method for returning a new Aho-Corasick builder.</p>
<p>This usually permits one to just import the <code>AhoCorasick</code> type.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-AhoCorasick-1"class="impl"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#280-913">source</a><ahref="#impl-AhoCorasick-1"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.AhoCorasick.html"title="struct aho_corasick::AhoCorasick">AhoCorasick</a></h3></section></summary><divclass="docblock"><p>Infallible search routines. These APIs panic when the underlying search
would otherwise fail. Infallible routines are useful because the errors are
a result of both search-time configuration and what configuration is used
to build the Aho-Corasick searcher. Both of these things are not usually
the result of user input, and thus, an error is typically indicative of a
programmer error. In cases where callers want errors instead of panics, use
the corresponding <code>try</code> method in the section below.</p>
</div><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_match"class="method"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#311-316">source</a><h4class="code-header">pub fn <ahref="#method.is_match"class="fn">is_match</a><'h, I: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><<aclass="struct"href="struct.Input.html"title="struct aho_corasick::Input">Input</a><'h>>>(&self, input: I) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns true if and only if this automaton matches the haystack at any
<p><code>input</code> may be any type that is cheaply convertible to an <code>Input</code>. This
includes, but is not limited to, <code>&str</code> and <code>&[u8]</code>.</p>
<p>Aside from convenience, when <code>AhoCorasick</code> was built with
leftmost-first or leftmost-longest semantics, this might result in a
search that visits less of the haystack than <ahref="struct.AhoCorasick.html#method.find"title="method aho_corasick::AhoCorasick::find"><code>AhoCorasick::find</code></a>
would otherwise. (For standard semantics, matches are always
immediately returned once they are seen, so there is no way for this to
do less work in that case.)</p>
<p>Note that there is no corresponding fallible routine for this method.
If you need a fallible version of this, then <ahref="struct.AhoCorasick.html#method.try_find"title="method aho_corasick::AhoCorasick::try_find"><code>AhoCorasick::try_find</code></a>
can be used with <ahref="struct.Input.html#method.earliest"title="method aho_corasick::Input::earliest"><code>Input::earliest</code></a> enabled.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.find"class="method"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#404-407">source</a><h4class="code-header">pub fn <ahref="#method.find"class="fn">find</a><'h, I: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><<aclass="struct"href="struct.Input.html"title="struct aho_corasick::Input">Input</a><'h>>>(&self, input: I) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="struct.Match.html"title="struct aho_corasick::Match">Match</a>></h4></section></summary><divclass="docblock"><p>Returns the location of the first match according to the match
semantics that this automaton was constructed with.</p>
<p><code>input</code> may be any type that is cheaply convertible to an <code>Input</code>. This
includes, but is not limited to, <code>&str</code> and <code>&[u8]</code>.</p>
<p>This is the infallible version of <ahref="struct.AhoCorasick.html#method.try_find"title="method aho_corasick::AhoCorasick::try_find"><code>AhoCorasick::try_find</code></a>.</p>
<p>This panics when <ahref="struct.AhoCorasick.html#method.try_find"title="method aho_corasick::AhoCorasick::try_find"><code>AhoCorasick::try_find</code></a> would return an error.</p>
<p>Because this method accepts anything that can be turned into an
<ahref="struct.Input.html"title="struct aho_corasick::Input"><code>Input</code></a>, it’s possible to provide an <code>Input</code> directly in order to
configure the search. In this example, we show how to use the
<code>earliest</code> option to force the search to return as soon as it knows
)</h4></section></summary><divclass="docblock"><p>Returns the location of the first overlapping match in the given
input with respect to the current state of the underlying searcher.</p>
<p><code>input</code> may be any type that is cheaply convertible to an <code>Input</code>. This
includes, but is not limited to, <code>&str</code> and <code>&[u8]</code>.</p>
<p>Overlapping searches do not report matches in their return value.
Instead, matches can be accessed via <ahref="automaton/struct.OverlappingState.html#method.get_match"title="method aho_corasick::automaton::OverlappingState::get_match"><code>OverlappingState::get_match</code></a>
<p>This panics when <ahref="struct.AhoCorasick.html#method.try_find_overlapping"title="method aho_corasick::AhoCorasick::try_find_overlapping"><code>AhoCorasick::try_find_overlapping</code></a> would
return an error. For example, when the Aho-Corasick searcher
doesn’t support overlapping searches. (Only searchers built with
<ahref="enum.MatchKind.html#variant.Standard"title="variant aho_corasick::MatchKind::Standard"><code>MatchKind::Standard</code></a> semantics support overlapping searches.)</p>
) -><aclass="struct"href="struct.FindIter.html"title="struct aho_corasick::FindIter">FindIter</a><'a, 'h><ahref="#"class="tooltip"data-notable-ty="FindIter<'a, 'h>">ⓘ</a></h4></section></summary><divclass="docblock"><p>Returns an iterator of non-overlapping matches, using the match
semantics that this automaton was constructed with.</p>
<p><code>input</code> may be any type that is cheaply convertible to an <code>Input</code>. This
includes, but is not limited to, <code>&str</code> and <code>&[u8]</code>.</p>
<p>This is the infallible version of <ahref="struct.AhoCorasick.html#method.try_find_iter"title="method aho_corasick::AhoCorasick::try_find_iter"><code>AhoCorasick::try_find_iter</code></a>.</p>
<p>This panics when <ahref="struct.AhoCorasick.html#method.try_find_iter"title="method aho_corasick::AhoCorasick::try_find_iter"><code>AhoCorasick::try_find_iter</code></a> would return an error.</p>
) -><aclass="struct"href="struct.FindOverlappingIter.html"title="struct aho_corasick::FindOverlappingIter">FindOverlappingIter</a><'a, 'h><ahref="#"class="tooltip"data-notable-ty="FindOverlappingIter<'a, 'h>">ⓘ</a></h4></section></summary><divclass="docblock"><p>Returns an iterator of overlapping matches. Stated differently, this
returns an iterator of all possible matches at every position.</p>
<p><code>input</code> may be any type that is cheaply convertible to an <code>Input</code>. This
includes, but is not limited to, <code>&str</code> and <code>&[u8]</code>.</p>
<p>This panics when <code>AhoCorasick::try_find_overlapping_iter</code> would return
an error. For example, when the Aho-Corasick searcher is built with
either leftmost-first or leftmost-longest match semantics. Stated
differently, overlapping searches require one to build the searcher
with <ahref="enum.MatchKind.html#variant.Standard"title="variant aho_corasick::MatchKind::Standard"><code>MatchKind::Standard</code></a> (it is the default).</p>
B: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.AsRef.html"title="trait core::convert::AsRef">AsRef</a><<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.str.html">str</a>>,</div></h4></section></summary><divclass="docblock"><p>Replace all matches with a corresponding value in the <code>replace_with</code>
<p>Replacements are determined by the index of the matching pattern.
For example, if the pattern with index <code>2</code> is found, then it is
replaced by <code>replace_with[2]</code>.</p>
<p>This is the infallible version of <ahref="struct.AhoCorasick.html#method.try_replace_all"title="method aho_corasick::AhoCorasick::try_replace_all"><code>AhoCorasick::try_replace_all</code></a>.</p>
<p>This panics when <ahref="struct.AhoCorasick.html#method.try_replace_all"title="method aho_corasick::AhoCorasick::try_replace_all"><code>AhoCorasick::try_replace_all</code></a> would return an
error.</p>
<p>This also panics when <code>replace_with.len()</code> does not equal
B: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.AsRef.html"title="trait core::convert::AsRef">AsRef</a><[<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.u8.html">u8</a>]>,</div></h4></section></summary><divclass="docblock"><p>Replace all matches using raw bytes with a corresponding value in the
<code>replace_with</code> slice given. Matches correspond to the same matches as
reported by <ahref="struct.AhoCorasick.html#method.find_iter"title="method aho_corasick::AhoCorasick::find_iter"><code>AhoCorasick::find_iter</code></a>.</p>
<p>Replacements are determined by the index of the matching pattern.
For example, if the pattern with index <code>2</code> is found, then it is
<p>This panics when <ahref="struct.AhoCorasick.html#method.try_replace_all_bytes"title="method aho_corasick::AhoCorasick::try_replace_all_bytes"><code>AhoCorasick::try_replace_all_bytes</code></a> would return an
error.</p>
<p>This also panics when <code>replace_with.len()</code> does not equal
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(&<aclass="struct"href="struct.Match.html"title="struct aho_corasick::Match">Match</a>, &<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.str.html">str</a>, &mut <aclass="struct"href="https://doc.rust-lang.org/1.80.0/alloc/string/struct.String.html"title="struct alloc::string::String">String</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><divclass="docblock"><p>Replace all matches using a closure called on each match.
<p>This panics when <ahref="struct.AhoCorasick.html#method.try_replace_all_with"title="method aho_corasick::AhoCorasick::try_replace_all_with"><code>AhoCorasick::try_replace_all_with</code></a> would return an
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(&<aclass="struct"href="struct.Match.html"title="struct aho_corasick::Match">Match</a>, &[<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.u8.html">u8</a>], &mut <aclass="struct"href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html"title="struct alloc::vec::Vec">Vec</a><<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.u8.html">u8</a>>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><divclass="docblock"><p>Replace all matches using raw bytes with a closure called on each
<p>This panics when <ahref="struct.AhoCorasick.html#method.try_replace_all_with_bytes"title="method aho_corasick::AhoCorasick::try_replace_all_with_bytes"><code>AhoCorasick::try_replace_all_with_bytes</code></a> would
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.stream_find_iter"class="method"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#906-912">source</a><h4class="code-header">pub fn <ahref="#method.stream_find_iter"class="fn">stream_find_iter</a><'a, R: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/std/io/trait.Read.html"title="trait std::io::Read">Read</a>>(&'a self, rdr: R) -><aclass="struct"href="struct.StreamFindIter.html"title="struct aho_corasick::StreamFindIter">StreamFindIter</a><'a, R><ahref="#"class="tooltip"data-notable-ty="StreamFindIter<'a, R>">ⓘ</a></h4></section></summary><divclass="docblock"><p>Returns an iterator of non-overlapping matches in the given
<p>The matches yielded by this iterator use absolute position offsets in
the stream given, where the first byte has index <code>0</code>. Matches are
yieled until the stream is exhausted.</p>
<p>Each item yielded by the iterator is an <code>Result<Match, std::io::Error></code>, where an error is yielded if there was a problem
reading from the reader given.</p>
<p>When searching a stream, an internal buffer is used. Therefore, callers
should avoiding providing a buffered reader, if possible.</p>
<p>This is the infallible version of
<ahref="struct.AhoCorasick.html#method.try_stream_find_iter"title="method aho_corasick::AhoCorasick::try_stream_find_iter"><code>AhoCorasick::try_stream_find_iter</code></a>. Note that both methods return
iterators that produce <code>Result</code> values. The difference is that this
routine panics if <em>construction</em> of the iterator failed. The <code>Result</code>
values yield by the iterator come from whether the given reader returns
<p>This panics when <ahref="struct.AhoCorasick.html#method.try_stream_find_iter"title="method aho_corasick::AhoCorasick::try_stream_find_iter"><code>AhoCorasick::try_stream_find_iter</code></a> would return
an error. For example, when the Aho-Corasick searcher doesn’t support
stream searches. (Only searchers built with <ahref="enum.MatchKind.html#variant.Standard"title="variant aho_corasick::MatchKind::Standard"><code>MatchKind::Standard</code></a>
</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-AhoCorasick-2"class="impl"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#917-1844">source</a><ahref="#impl-AhoCorasick-2"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.AhoCorasick.html"title="struct aho_corasick::AhoCorasick">AhoCorasick</a></h3></section></summary><divclass="docblock"><p>Fallible search routines. These APIs return an error in cases where the
) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="struct.Match.html"title="struct aho_corasick::Match">Match</a>>, <aclass="struct"href="struct.MatchError.html"title="struct aho_corasick::MatchError">MatchError</a>></h4></section></summary><divclass="docblock"><p>Returns the location of the first match according to the match
semantics that this automaton was constructed with, and according
to the given <code>Input</code> configuration.</p>
<p>This is the fallible version of <ahref="struct.AhoCorasick.html#method.find"title="method aho_corasick::AhoCorasick::find"><code>AhoCorasick::find</code></a>.</p>
) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.unit.html">()</a>, <aclass="struct"href="struct.MatchError.html"title="struct aho_corasick::MatchError">MatchError</a>></h4></section></summary><divclass="docblock"><p>Returns the location of the first overlapping match in the given
input with respect to the current state of the underlying searcher.</p>
<p>Overlapping searches do not report matches in their return value.
Instead, matches can be accessed via <ahref="automaton/struct.OverlappingState.html#method.get_match"title="method aho_corasick::automaton::OverlappingState::get_match"><code>OverlappingState::get_match</code></a>
after a search call.</p>
<p>This is the fallible version of <ahref="struct.AhoCorasick.html#method.find_overlapping"title="method aho_corasick::AhoCorasick::find_overlapping"><code>AhoCorasick::find_overlapping</code></a>.</p>
<p>This returns an error when this Aho-Corasick searcher does not support
the given <code>Input</code> configuration or if overlapping search is not
supported.</p>
<p>One example is that only Aho-Corasicker searchers built with
<ahref="enum.MatchKind.html#variant.Standard"title="variant aho_corasick::MatchKind::Standard"><code>MatchKind::Standard</code></a> semantics support overlapping searches. Using
any other match semantics will result in this returning an error.</p>
<h5id="example-implementing-your-own-overlapping-iteration"><aclass="doc-anchor"href="#example-implementing-your-own-overlapping-iteration">§</a>Example: implementing your own overlapping iteration</h5>
<p>The previous example can be easily adapted to implement your own
iteration by repeatedly calling <code>try_find_overlapping</code> until either
an error occurs or no more matches are reported.</p>
<p>This is effectively equivalent to the iterator returned by
<ahref="struct.AhoCorasick.html#method.try_find_overlapping_iter"title="method aho_corasick::AhoCorasick::try_find_overlapping_iter"><code>AhoCorasick::try_find_overlapping_iter</code></a>, with the only difference
being that the iterator checks for errors before construction and
absolves the caller of needing to check for errors on every search
call. (Indeed, if the first <code>try_find_overlapping</code> call succeeds and
the same <code>Input</code> is given to subsequent calls, then all subsequent
<p>The previous example can also be adapted to implement
iteration over all anchored matches. In particular,
<ahref="struct.AhoCorasick.html#method.try_find_overlapping_iter"title="method aho_corasick::AhoCorasick::try_find_overlapping_iter"><code>AhoCorasick::try_find_overlapping_iter</code></a> does not support this
because it isn’t totally clear what the match semantics ought to be.</p>
<p>In this example, we will find all overlapping matches that start at
) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.FindIter.html"title="struct aho_corasick::FindIter">FindIter</a><'a, 'h>, <aclass="struct"href="struct.MatchError.html"title="struct aho_corasick::MatchError">MatchError</a>></h4></section></summary><divclass="docblock"><p>Returns an iterator of non-overlapping matches, using the match
semantics that this automaton was constructed with.</p>
<p>This is the fallible version of <ahref="struct.AhoCorasick.html#method.find_iter"title="method aho_corasick::AhoCorasick::find_iter"><code>AhoCorasick::find_iter</code></a>.</p>
<p>Note that the error returned by this method occurs during construction
of the iterator. The iterator itself yields <code>Match</code> values. That is,
once the iterator is constructed, the iteration itself will never
<p>This is the fallible version of <ahref="struct.AhoCorasick.html#method.find_overlapping_iter"title="method aho_corasick::AhoCorasick::find_overlapping_iter"><code>AhoCorasick::find_overlapping_iter</code></a>.</p>
<p>Note that the error returned by this method occurs during construction
of the iterator. The iterator itself yields <code>Match</code> values. That is,
once the iterator is constructed, the iteration itself will never
<p>This returns an error when this Aho-Corasick searcher does not support
the given <code>Input</code> configuration or does not support overlapping
searches.</p>
<p>One example is that only Aho-Corasicker searchers built with
<ahref="enum.MatchKind.html#variant.Standard"title="variant aho_corasick::MatchKind::Standard"><code>MatchKind::Standard</code></a> semantics support overlapping searches. Using
any other match semantics will result in this returning an error.</p>
<p>It isn’t clear what the match semantics for anchored overlapping
iterators <em>ought</em> to be, so currently an error is returned. Callers
may use <ahref="struct.AhoCorasick.html#method.try_find_overlapping"title="method aho_corasick::AhoCorasick::try_find_overlapping"><code>AhoCorasick::try_find_overlapping</code></a> to implement their own
B: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.AsRef.html"title="trait core::convert::AsRef">AsRef</a><<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.str.html">str</a>>,</div></h4></section></summary><divclass="docblock"><p>Replace all matches with a corresponding value in the <code>replace_with</code>
B: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.AsRef.html"title="trait core::convert::AsRef">AsRef</a><[<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.u8.html">u8</a>]>,</div></h4></section></summary><divclass="docblock"><p>Replace all matches using raw bytes with a corresponding value in the
<code>replace_with</code> slice given. Matches correspond to the same matches as
reported by <ahref="struct.AhoCorasick.html#method.try_find_iter"title="method aho_corasick::AhoCorasick::try_find_iter"><code>AhoCorasick::try_find_iter</code></a>.</p>
<p>Replacements are determined by the index of the matching pattern.
For example, if the pattern with index <code>2</code> is found, then it is
replaced by <code>replace_with[2]</code>.</p>
<p>This is the fallible version of <ahref="struct.AhoCorasick.html#method.replace_all_bytes"title="method aho_corasick::AhoCorasick::replace_all_bytes"><code>AhoCorasick::replace_all_bytes</code></a>.</p>
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(&<aclass="struct"href="struct.Match.html"title="struct aho_corasick::Match">Match</a>, &<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.str.html">str</a>, &mut <aclass="struct"href="https://doc.rust-lang.org/1.80.0/alloc/string/struct.String.html"title="struct alloc::string::String">String</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><divclass="docblock"><p>Replace all matches using a closure called on each match.
<p>The closure accepts three parameters: the match found, the text of
the match and a string buffer with which to write the replaced text
(if any). If the closure returns <code>true</code>, then it continues to the next
match. If the closure returns <code>false</code>, then searching is stopped.</p>
<p>Note that any matches with boundaries that don’t fall on a valid UTF-8
boundary are silently skipped.</p>
<p>This is the fallible version of <ahref="struct.AhoCorasick.html#method.replace_all_with"title="method aho_corasick::AhoCorasick::replace_all_with"><code>AhoCorasick::replace_all_with</code></a>.</p>
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(&<aclass="struct"href="struct.Match.html"title="struct aho_corasick::Match">Match</a>, &[<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.u8.html">u8</a>], &mut <aclass="struct"href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html"title="struct alloc::vec::Vec">Vec</a><<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.u8.html">u8</a>>) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><divclass="docblock"><p>Replace all matches using raw bytes with a closure called on each
) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.StreamFindIter.html"title="struct aho_corasick::StreamFindIter">StreamFindIter</a><'a, R>, <aclass="struct"href="struct.MatchError.html"title="struct aho_corasick::MatchError">MatchError</a>></h4></section></summary><divclass="docblock"><p>Returns an iterator of non-overlapping matches in the given
<p>The matches yielded by this iterator use absolute position offsets in
the stream given, where the first byte has index <code>0</code>. Matches are
yieled until the stream is exhausted.</p>
<p>Each item yielded by the iterator is an <code>Result<Match, std::io::Error></code>, where an error is yielded if there was a problem
reading from the reader given.</p>
<p>When searching a stream, an internal buffer is used. Therefore, callers
should avoiding providing a buffered reader, if possible.</p>
<p>This is the fallible version of <ahref="struct.AhoCorasick.html#method.stream_find_iter"title="method aho_corasick::AhoCorasick::stream_find_iter"><code>AhoCorasick::stream_find_iter</code></a>.
Note that both methods return iterators that produce <code>Result</code> values.
The difference is that this routine returns an error if <em>construction</em>
of the iterator failed. The <code>Result</code> values yield by the iterator
come from whether the given reader returns an error or not during the
<p>This returns an error when this Aho-Corasick searcher does not support
the default <code>Input</code> configuration. More specifically, this occurs only
when the Aho-Corasick searcher does not support unanchored searches
since this stream searching routine always does an unanchored search.</p>
<p>This also returns an error if the searcher does not support stream
searches. Only searchers built with <ahref="enum.MatchKind.html#variant.Standard"title="variant aho_corasick::MatchKind::Standard"><code>MatchKind::Standard</code></a> semantics
B: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.AsRef.html"title="trait core::convert::AsRef">AsRef</a><[<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.u8.html">u8</a>]>,</div></h4></section></summary><divclass="docblock"><p>Search for and replace all matches of this automaton in
<p>This returns an error when this Aho-Corasick searcher does not support
the default <code>Input</code> configuration. More specifically, this occurs only
when the Aho-Corasick searcher does not support unanchored searches
since this stream searching routine always does an unanchored search.</p>
<p>This also returns an error if the searcher does not support stream
searches. Only searchers built with <ahref="enum.MatchKind.html#variant.Standard"title="variant aho_corasick::MatchKind::Standard"><code>MatchKind::Standard</code></a> semantics
F: <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(&<aclass="struct"href="struct.Match.html"title="struct aho_corasick::Match">Match</a>, &[<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.u8.html">u8</a>], <aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&mut W</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.80.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.unit.html">()</a>, <aclass="struct"href="https://doc.rust-lang.org/1.80.0/std/io/error/struct.Error.html"title="struct std::io::error::Error">Error</a>>,</div></h4></section></summary><divclass="docblock"><p>Search the given reader and replace all matches of this automaton
<p>This returns an error when this Aho-Corasick searcher does not support
the default <code>Input</code> configuration. More specifically, this occurs only
when the Aho-Corasick searcher does not support unanchored searches
since this stream searching routine always does an unanchored search.</p>
<p>This also returns an error if the searcher does not support stream
searches. Only searchers built with <ahref="enum.MatchKind.html#variant.Standard"title="variant aho_corasick::MatchKind::Standard"><code>MatchKind::Standard</code></a> semantics
</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-AhoCorasick-3"class="impl"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#1847-2024">source</a><ahref="#impl-AhoCorasick-3"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.AhoCorasick.html"title="struct aho_corasick::AhoCorasick">AhoCorasick</a></h3></section></summary><divclass="docblock"><p>Routines for querying information about the Aho-Corasick automaton.</p>
</div><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.kind"class="method"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#1867-1869">source</a><h4class="code-header">pub fn <ahref="#method.kind"class="fn">kind</a>(&self) -><aclass="enum"href="enum.AhoCorasickKind.html"title="enum aho_corasick::AhoCorasickKind">AhoCorasickKind</a></h4></section></summary><divclass="docblock"><p>Returns the kind of the Aho-Corasick automaton used by this searcher.</p>
<p>Knowing the Aho-Corasick kind is principally useful for diagnostic
purposes. In particular, if no specific kind was given to
<ahref="struct.AhoCorasickBuilder.html#method.kind"title="method aho_corasick::AhoCorasickBuilder::kind"><code>AhoCorasickBuilder::kind</code></a>, then one is automatically chosen and
this routine will report which one.</p>
<p>Note that the heuristics used for choosing which <code>AhoCorasickKind</code>
may be changed in a semver compatible release.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.start_kind"class="method"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#1882-1884">source</a><h4class="code-header">pub fn <ahref="#method.start_kind"class="fn">start_kind</a>(&self) -><aclass="enum"href="enum.StartKind.html"title="enum aho_corasick::StartKind">StartKind</a></h4></section></summary><divclass="docblock"><p>Returns the type of starting search configuration supported by this
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.match_kind"class="method"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#1901-1903">source</a><h4class="code-header">pub fn <ahref="#method.match_kind"class="fn">match_kind</a>(&self) -><aclass="enum"href="enum.MatchKind.html"title="enum aho_corasick::MatchKind">MatchKind</a></h4></section></summary><divclass="docblock"><p>Returns the match kind used by this automaton.</p>
<p>The match kind is important because it determines what kinds of
matches are returned. Also, some operations (such as overlapping
search and stream searching) are only supported when using the
<ahref="enum.MatchKind.html#variant.Standard"title="variant aho_corasick::MatchKind::Standard"><code>MatchKind::Standard</code></a> match kind.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.min_pattern_len"class="method"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#1927-1929">source</a><h4class="code-header">pub fn <ahref="#method.min_pattern_len"class="fn">min_pattern_len</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the length of the shortest pattern matched by this automaton.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.max_pattern_len"class="method"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#1943-1945">source</a><h4class="code-header">pub fn <ahref="#method.max_pattern_len"class="fn">max_pattern_len</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the length of the longest pattern matched by this automaton.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.patterns_len"class="method"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#1965-1967">source</a><h4class="code-header">pub fn <ahref="#method.patterns_len"class="fn">patterns_len</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Return the total number of patterns matched by this automaton.</p>
<p>This includes patterns that may never participate in a match. For
example, if <ahref="enum.MatchKind.html#variant.LeftmostFirst"title="variant aho_corasick::MatchKind::LeftmostFirst"><code>MatchKind::LeftmostFirst</code></a> match semantics are used, and
the patterns <code>Sam</code> and <code>Samwise</code> were used to build the automaton (in
that order), then <code>Samwise</code> can never participate in a match because
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.memory_usage"class="method"><aclass="src rightside"href="../src/aho_corasick/ahocorasick.rs.html#2021-2023">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.80.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the approximate total amount of heap used by this automaton, in
<code><ahref="https://doc.rust-lang.org/1.80.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.80.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.80.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.80.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.80.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.80.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.80.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.80.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.80.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.80.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.80.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.80.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.80.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.80.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.80.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"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error"class="associatedtype">Error</a> = <aclass="enum"href="https://doc.rust-lang.org/1.80.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.80.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.80.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.80.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.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.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.80.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.80.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.80.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-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html#associatedtype.Error"class="associatedtype">Error</a> = <U as <aclass="trait"href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.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.80.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.80.0/core/convert/trait.TryInto.html#tymethod.try_into"class="fn">try_into</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.80.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.80.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.80.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><scripttype="text/json"id="notable-traits-data">{"FindIter<'a,'h>":"<h3>Notabletraitsfor<code><aclass=\"struct\"href=\"struct.FindIter.html\"title=\"structaho_corasick::FindIter\">FindIter</a><'a,'h></code></h3><pre><code><divclass=\"where\">impl<'a,'h><aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\"title=\"traitcore::iter::traits::iterator::Iterator\">Iterator</a>for<aclass=\"struct\"href=\"struct.FindIter.html\"title=\"structaho_corasick::FindIter\">FindIter</a><'a,'h></div><divclass=\"where\">type<ahref=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\"class=\"associatedtype\">Item</a>=<aclass=\"struct\"href=\"struct.Match.html\"title=\"structaho_corasick::Match\">Match</a>;</div>","FindOverlappingIter<'a,'h>":"<h3>Notabletraitsfor<code><aclass=\"struct\"href=\"struct.FindOverlappingIter.html\"title=\"structaho_corasick::FindOverlappingIter\">FindOverlappingIter</a><'a,'h></code></h3><pre><code><divclass=\"where\">impl<'a,'h><aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html\"title=\"traitcore::iter::traits::iterator::Iterator\">Iterator</a>for<aclass=\"struct\"href=\"struct.FindOverlappingIter.html\"title=\"structaho_corasick::FindOverlappingIter\">FindOverlappingIter</a><'a,'h></div><divclass=\"where\">type<ahref=\"https://doc.rust-lang.org/1.80.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\"class=\"associatedtype\">Item</a>=<aclass=\"struct\"href=\"struct.Match.html\"title=\"structaho_corasick::Match\">Match</a>;</div>","StreamFindIter<'a,R>":"<h3>Notabletraitsfor<code><aclass=\"struct\"href=\"struct.StreamFindIter.html\"title=\"structaho_corasick::StreamFindIter\">StreamFindIter</a><'a,R></code></h3><pre><code><divclass=\"where\">impl<'a,R:<aclass=\"trait\"href=\"https://doc.rust-lang.org/1.80.0/std/io/trait.Read.html\"title=\"traitstd::io::Read\">Read</a>&