<!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="A virtual machine for executing regex searches with capturing groups."><title>PikeVM in regex_automata::nfa::thompson::pikevm - Rust</title><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><linkrel="stylesheet"href="../../../../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../../../../static.files/rustdoc-5bc39a1768837dd0.css"><metaname="rustdoc-vars"data-root-path="../../../../"data-static-root-path="../../../../static.files/"data-current-crate="regex_automata"data-themes=""data-resource-suffix=""data-rustdoc-version="1.77.1 (7cf61ebde 2024-03-27)"data-channel="1.77.1"data-search-js="search-dd67cee4cfa65049.js"data-settings-js="settings-4313503d2e1961c2.js"><scriptsrc="../../../../static.files/storage-4c98445ec4002617.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../../../../static.files/main-48f368f3872407c8.js"></script><noscript><linkrel="stylesheet"href="../../../../static.files/noscript-04d5337699b92874.css"></noscript><linkrel="alternate icon"type="image/png"href="../../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><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="../../../../regex_automata/index.html">regex_automata</a><spanclass="version">0.4.6</span></h2></div><h2class="location"><ahref="#">PikeVM</a></h2><divclass="sidebar-elems"><section><h3><ahref="#implementations">Methods</a></h3><ulclass="block method"><li><ahref="#method.always_match">always_match</a></li><li><ahref="#method.builder">builder</a></li><li><ahref="#method.captures">captures</a></li><li><ahref="#method.captures_iter">captures_iter</a></li><li><ahref="#method.config">config</a></li><li><ahref="#method.create_cache">create_cache</a></li><li><ahref="#method.create_captures">create_captures</a></li><li><ahref="#method.find">find</a></li><li><ahref="#method.find_iter">find_iter</a></li><li><ahref="#method.get_config">get_config</a></li><li><ahref="#method.get_nfa">get_nfa</a></li><li><ahref="#method.is_match">is_match</a></li><li><ahref="#method.never_match">never_match</a></li><li><ahref="#method.new">new</a></li><li><ahref="#method.new_from_nfa">new_from_nfa</a></li><li><ahref="#method.new_many">new_many</a></li><li><ahref="#method.pattern_len">pattern_len</a></li><li><ahref="#method.reset_cache">reset_cache</a></li><li><ahref="#method.search">search</a></li><li><ahref="#method.search_slots">search_slots</a></li><li><ahref="#method.which_overlapping_matches">which_overlapping_matches</a></li></ul><h3><ahref="#trait-implementations">Trait Implementations</a></h3><ulclass="block trait-implementation"><li><ahref="#impl-Clone-for-PikeVM">Clone</a></li><li><ahref="#impl-Debug-for-PikeVM">Debug</a></li></ul><h3><ahref="#syntheti
<main><divclass="width-limiter"><navclass="sub"><formclass="search-form"><span></span><divid="sidebar-button"tabindex="-1"><ahref="../../../../regex_automata/all.html"title="show sidebar"></a></div><inputclass="search-input"name="search"aria-label="Run search in the documentation"autocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"><divid="help-button"tabindex="-1"><ahref="../../../../help.html"title="help">?</a></div><divid="settings-menu"tabindex="-1"><ahref="../../../../settings.html"title="settings"><imgwidth="22"height="22"alt="Change settings"src="../../../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><sectionid="main-content"class="content"><divclass="main-heading"><h1>Struct <ahref="../../../index.html">regex_automata</a>::<wbr><ahref="../../index.html">nfa</a>::<wbr><ahref="../index.html">thompson</a>::<wbr><ahref="index.html">pikevm</a>::<wbr><aclass="struct"href="#">PikeVM</a><buttonid="copy-path"title="Copy item path to clipboard"><imgsrc="../../../../static.files/clipboard-7571035ce49a181d.svg"width="19"height="18"alt="Copy item path"></button></h1><spanclass="out-of-band"><aclass="src"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#387-390">source</a> · <buttonid="toggle-all-docs"title="collapse all docs">[<span>−</span>]</button></span></div><preclass="rust item-decl"><code>pub struct PikeVM { <spanclass="comment">/* private fields */</span> }</code></pre><detailsclass="toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>A virtual machine for executing regex searches with capturing groups.</p>
<p>Unlike most other regex engines in this crate, a <code>PikeVM</code> never returns an
error at search time. It supports all <ahref="../../../enum.Anchored.html"title="enum regex_automata::Anchored"><code>Anchored</code></a> configurations, never
quits and works on haystacks of arbitrary length.</p>
<p>There are two caveats to mention though:</p>
<ul>
<li>If an invalid pattern ID is given to a search via <ahref="../../../enum.Anchored.html#variant.Pattern"title="variant regex_automata::Anchored::Pattern"><code>Anchored::Pattern</code></a>,
then the PikeVM will report “no match.” This is consistent with all other
regex engines in this crate.</li>
<li>When using <ahref="struct.PikeVM.html#method.which_overlapping_matches"title="method regex_automata::nfa::thompson::pikevm::PikeVM::which_overlapping_matches"><code>PikeVM::which_overlapping_matches</code></a> with a <ahref="../../../struct.PatternSet.html"title="struct regex_automata::PatternSet"><code>PatternSet</code></a>
that has insufficient capacity to store all valid pattern IDs, then if a
match occurs for a <code>PatternID</code> that cannot be inserted, it is silently
DFA-based regex engine at all (unless you <ahref="../../../hybrid/dfa/struct.Config.html#method.unicode_word_boundary"title="method regex_automata::hybrid::dfa::Config::unicode_word_boundary">enable heuristic support for
</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-PikeVM"class="impl"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#392-706">source</a><ahref="#impl-PikeVM"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.PikeVM.html"title="struct regex_automata::nfa::thompson::pikevm::PikeVM">PikeVM</a></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.new"class="method"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#413-415">source</a><h4class="code-header">pub fn <ahref="#method.new"class="fn">new</a>(pattern: &<aclass="primitive"href="https://doc.rust-lang.org/1.77.1/std/primitive.str.html">str</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.77.1/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.PikeVM.html"title="struct regex_automata::nfa::thompson::pikevm::PikeVM">PikeVM</a>, <aclass="struct"href="../struct.BuildError.html"title="struct regex_automata::nfa::thompson::BuildError">BuildError</a>></h4></section></summary><divclass="docblock"><p>Parse the given regular expression using the default configuration and
<p>If you want a non-default configuration, then use the <ahref="struct.Builder.html"title="struct regex_automata::nfa::thompson::pikevm::Builder"><code>Builder</code></a> to
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.new_from_nfa"class="method"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#475-477">source</a><h4class="code-header">pub fn <ahref="#method.new_from_nfa"class="fn">new_from_nfa</a>(nfa: <aclass="struct"href="../struct.NFA.html"title="struct regex_automata::nfa::thompson::NFA">NFA</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.77.1/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.PikeVM.html"title="struct regex_automata::nfa::thompson::pikevm::PikeVM">PikeVM</a>, <aclass="struct"href="../struct.BuildError.html"title="struct regex_automata::nfa::thompson::BuildError">BuildError</a>></h4></section></summary><divclass="docblock"><p>Like <code>new</code>, but builds a PikeVM directly from an NFA. This is useful
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.always_match"class="method"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#494-497">source</a><h4class="code-header">pub fn <ahref="#method.always_match"class="fn">always_match</a>() -><aclass="enum"href="https://doc.rust-lang.org/1.77.1/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.PikeVM.html"title="struct regex_automata::nfa::thompson::pikevm::PikeVM">PikeVM</a>, <aclass="struct"href="../struct.BuildError.html"title="struct regex_automata::nfa::thompson::BuildError">BuildError</a>></h4></section></summary><divclass="docblock"><p>Create a new <code>PikeVM</code> that matches every input.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.never_match"class="method"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#513-516">source</a><h4class="code-header">pub fn <ahref="#method.never_match"class="fn">never_match</a>() -><aclass="enum"href="https://doc.rust-lang.org/1.77.1/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="struct"href="struct.PikeVM.html"title="struct regex_automata::nfa::thompson::pikevm::PikeVM">PikeVM</a>, <aclass="struct"href="../struct.BuildError.html"title="struct regex_automata::nfa::thompson::BuildError">BuildError</a>></h4></section></summary><divclass="docblock"><p>Create a new <code>PikeVM</code> that never matches any input.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.config"class="method"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#552-554">source</a><h4class="code-header">pub fn <ahref="#method.config"class="fn">config</a>() -><aclass="struct"href="struct.Config.html"title="struct regex_automata::nfa::thompson::pikevm::Config">Config</a></h4></section></summary><divclass="docblock"><p>Return a default configuration for a <code>PikeVM</code>.</p>
<p>This is a convenience routine to avoid needing to import the <code>Config</code>
type when customizing the construction of a <code>PikeVM</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.builder"class="method"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#586-588">source</a><h4class="code-header">pub fn <ahref="#method.builder"class="fn">builder</a>() -><aclass="struct"href="struct.Builder.html"title="struct regex_automata::nfa::thompson::pikevm::Builder">Builder</a></h4></section></summary><divclass="docblock"><p>Return a builder for configuring the construction of a <code>PikeVM</code>.</p>
<p>This is a convenience routine to avoid needing to import the
<ahref="struct.Builder.html"title="struct regex_automata::nfa::thompson::pikevm::Builder"><code>Builder</code></a> type in common cases.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.create_captures"class="method"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#600-602">source</a><h4class="code-header">pub fn <ahref="#method.create_captures"class="fn">create_captures</a>(&self) -><aclass="struct"href="../../../util/captures/struct.Captures.html"title="struct regex_automata::util::captures::Captures">Captures</a></h4></section></summary><divclass="docblock"><p>Create a new empty set of capturing groups that is guaranteed to be
valid for the search APIs on this <code>PikeVM</code>.</p>
<p>A <code>Captures</code> value created for a specific <code>PikeVM</code> cannot be used with
any other <code>PikeVM</code>.</p>
<p>This is a convenience function for <ahref="../../../util/captures/struct.Captures.html#method.all"title="associated function regex_automata::util::captures::Captures::all"><code>Captures::all</code></a>. See the
<ahref="../../../util/captures/struct.Captures.html"title="struct regex_automata::util::captures::Captures"><code>Captures</code></a> documentation for an explanation of its alternative
constructors that permit the <code>PikeVM</code> to do less work during a search,
and thus might make it faster.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.create_cache"class="method"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#610-612">source</a><h4class="code-header">pub fn <ahref="#method.create_cache"class="fn">create_cache</a>(&self) -><aclass="struct"href="struct.Cache.html"title="struct regex_automata::nfa::thompson::pikevm::Cache">Cache</a></h4></section></summary><divclass="docblock"><p>Create a new cache for this <code>PikeVM</code>.</p>
<p>The cache returned should only be used for searches for this
<code>PikeVM</code>. If you want to reuse the cache for another <code>PikeVM</code>, then
you must call <ahref="struct.Cache.html#method.reset"title="method regex_automata::nfa::thompson::pikevm::Cache::reset"><code>Cache::reset</code></a> with that <code>PikeVM</code> (or, equivalently,
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.reset_cache"class="method"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#651-653">source</a><h4class="code-header">pub fn <ahref="#method.reset_cache"class="fn">reset_cache</a>(&self, cache: &mut <aclass="struct"href="struct.Cache.html"title="struct regex_automata::nfa::thompson::pikevm::Cache">Cache</a>)</h4></section></summary><divclass="docblock"><p>Reset the given cache such that it can be used for searching with the
this <code>PikeVM</code> (and only this <code>PikeVM</code>).</p>
<p>A cache reset permits reusing memory already allocated in this cache
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.pattern_len"class="method"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#691-693">source</a><h4class="code-header">pub fn <ahref="#method.pattern_len"class="fn">pattern_len</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.77.1/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the total number of patterns compiled into this <code>PikeVM</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_config"class="method"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#697-699">source</a><h4class="code-header">pub fn <ahref="#method.get_config"class="fn">get_config</a>(&self) ->&<aclass="struct"href="struct.Config.html"title="struct regex_automata::nfa::thompson::pikevm::Config">Config</a></h4></section></summary><divclass="docblock"><p>Return the config for this <code>PikeVM</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get_nfa"class="method"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#703-705">source</a><h4class="code-header">pub fn <ahref="#method.get_nfa"class="fn">get_nfa</a>(&self) ->&<aclass="struct"href="../struct.NFA.html"title="struct regex_automata::nfa::thompson::NFA">NFA</a></h4></section></summary><divclass="docblock"><p>Returns a reference to the underlying NFA.</p>
) -><aclass="primitive"href="https://doc.rust-lang.org/1.77.1/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns true if and only if this <code>PikeVM</code> matches the given haystack.</p>
<h5id="example-consistency-with-search-apis"><aclass="doc-anchor"href="#example-consistency-with-search-apis">§</a>Example: consistency with search APIs</h5>
) -><aclass="enum"href="https://doc.rust-lang.org/1.77.1/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="../../../struct.Match.html"title="struct regex_automata::Match">Match</a>></h4></section></summary><divclass="docblock"><p>Executes a leftmost forward search and returns a <code>Match</code> if one exists.</p>
<p>This routine only includes the overall match span. To get access to the
individual spans of each capturing group, use <ahref="struct.PikeVM.html#method.captures"title="method regex_automata::nfa::thompson::pikevm::PikeVM::captures"><code>PikeVM::captures</code></a>.</p>
)</h4></section></summary><divclass="docblock"><p>Executes a leftmost forward search and writes the spans of capturing
groups that participated in a match into the provided <ahref="../../../util/captures/struct.Captures.html"title="struct regex_automata::util::captures::Captures"><code>Captures</code></a>
value. If no match was found, then <ahref="../../../util/captures/struct.Captures.html#method.is_match"title="method regex_automata::util::captures::Captures::is_match"><code>Captures::is_match</code></a> is guaranteed
) -><aclass="struct"href="struct.FindMatches.html"title="struct regex_automata::nfa::thompson::pikevm::FindMatches">FindMatches</a><'r, 'c, 'h><ahref="#"class="tooltip"data-notable-ty="FindMatches<'r, 'c, 'h>">ⓘ</a></h4></section></summary><divclass="docblock"><p>Returns an iterator over all non-overlapping leftmost matches in the
given bytes. If no match exists, then the iterator yields no elements.</p>
) -><aclass="struct"href="struct.CapturesMatches.html"title="struct regex_automata::nfa::thompson::pikevm::CapturesMatches">CapturesMatches</a><'r, 'c, 'h><ahref="#"class="tooltip"data-notable-ty="CapturesMatches<'r, 'c, 'h>">ⓘ</a></h4></section></summary><divclass="docblock"><p>Returns an iterator over all non-overlapping <code>Captures</code> values. If no
match exists, then the iterator yields no elements.</p>
<p>This yields the same matches as <ahref="struct.PikeVM.html#method.find_iter"title="method regex_automata::nfa::thompson::pikevm::PikeVM::find_iter"><code>PikeVM::find_iter</code></a>, but it includes
the spans of all capturing groups that participate in each match.</p>
<p><strong>Tip:</strong> See <ahref="../../../util/iter/struct.Searcher.html"title="struct regex_automata::util::iter::Searcher"><code>util::iter::Searcher</code></a> for
how to correctly iterate over all matches in a haystack while avoiding
the creation of a new <code>Captures</code> value for every match. (Which you are
</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-PikeVM-2"class="impl"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#943-1216">source</a><ahref="#impl-PikeVM-2"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.PikeVM.html"title="struct regex_automata::nfa::thompson::pikevm::PikeVM">PikeVM</a></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.search"class="method"><aclass="src rightside"href="../../../../src/regex_automata/nfa/thompson/pikevm.rs.html#1020-1029">source</a><h4class="code-header">pub fn <ahref="#method.search"class="fn">search</a>(&self, cache: &mut <aclass="struct"href="struct.Cache.html"title="struct regex_automata::nfa::thompson::pikevm::Cache">Cache</a>, input: &<aclass="struct"href="../../../struct.Input.html"title="struct regex_automata::Input">Input</a><'_>, caps: &mut <aclass="struct"href="../../../util/captures/struct.Captures.html"title="struct regex_automata::util::captures::Captures">Captures</a>)</h4></section></summary><divclass="docblock"><p>Executes a leftmost forward search and writes the spans of capturing
groups that participated in a match into the provided <ahref="../../../util/captures/struct.Captures.html"title="struct regex_automata::util::captures::Captures"><code>Captures</code></a>
value. If no match was found, then <ahref="../../../util/captures/struct.Captures.html#method.is_match"title="method regex_automata::util::captures::Captures::is_match"><code>Captures::is_match</code></a> is guaranteed
to return <code>false</code>.</p>
<p>This is like <ahref="struct.PikeVM.html#method.captures"title="method regex_automata::nfa::thompson::pikevm::PikeVM::captures"><code>PikeVM::captures</code></a>, but it accepts a concrete <code>&Input</code>
<h5id="example-specifying-the-bounds-of-a-search"><aclass="doc-anchor"href="#example-specifying-the-bounds-of-a-search">§</a>Example: specifying the bounds of a search</h5>
) -><aclass="enum"href="https://doc.rust-lang.org/1.77.1/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="../../../struct.PatternID.html"title="struct regex_automata::PatternID">PatternID</a>></h4></section></summary><divclass="docblock"><p>Executes a leftmost forward search and writes the spans of capturing
groups that participated in a match into the provided <code>slots</code>, and
returns the matching pattern ID. The contents of the slots for patterns
other than the matching pattern are unspecified. If no match was found,
then <code>None</code> is returned and the contents of <code>slots</code> is unspecified.</p>
<p>This is like <ahref="struct.PikeVM.html#method.search"title="method regex_automata::nfa::thompson::pikevm::PikeVM::search"><code>PikeVM::search</code></a>, but it accepts a raw slots slice
instead of a <code>Captures</code> value. This is useful in contexts where you
don’t want or need to allocate a <code>Captures</code>.</p>
<p>It is legal to pass <em>any</em> number of slots to this routine. If the regex
engine would otherwise write a slot offset that doesn’t fit in the
provided slice, then it is simply skipped. In general though, there are
usually three slice lengths you might want to use:</p>
<ul>
<li>An empty slice, if you only care about which pattern matched.</li>
slots, if you only care about the overall match spans for each matching
pattern.</li>
<li>A slice with
<ahref="../../../util/captures/struct.GroupInfo.html#method.slot_len"title="method regex_automata::util::captures::GroupInfo::slot_len"><code>slot_len()</code></a> slots, which
permits recording match offsets for every capturing group in every
)</h4></section></summary><divclass="docblock"><p>Writes the set of patterns that match anywhere in the given search
configuration to <code>patset</code>. If multiple patterns match at the same
position and this <code>PikeVM</code> was configured with <ahref="../../../enum.MatchKind.html#variant.All"title="variant regex_automata::MatchKind::All"><code>MatchKind::All</code></a>
semantics, then all matching patterns are written to the given set.</p>
<p>Unless all of the patterns in this <code>PikeVM</code> are anchored, then
generally speaking, this will visit every byte in the haystack.</p>
<p>This search routine <em>does not</em> clear the pattern set. This gives some
flexibility to the caller (e.g., running multiple searches with the
same pattern set), but does make the API bug-prone if you’re reusing
the same pattern set for multiple searches but intended them to be
independent.</p>
<p>If a pattern ID matched but the given <code>PatternSet</code> does not have
sufficient capacity to store it, then it is not inserted and silently
<code><ahref="https://doc.rust-lang.org/1.77.1/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.77.1/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.77.1/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.77.1/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.77.1/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.77.1/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.77.1/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.77.1/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.77.1/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.77.1/alloc/borrow/trait.ToOwned.html#method.clone_into"class="fn">clone_into</a>(&self, target: <aclass="primitive"href="https://doc.rust-lang.org/1.77.1/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.77.1/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.77.1/src/core/convert/mod.rs.html#804-806">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.77.1/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.77.1/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html#associatedtype.Error"class="associatedtype">Error</a> = <aclass="enum"href="https://doc.rust-lang.org/1.77.1/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.77.1/src/core/convert/mod.rs.html#811">source</a><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html#tymethod.try_from"class="fn">try_from</a>(value: U) -><aclass="enum"href="https://doc.rust-lang.org/1.77.1/core/result/enum.Result.html"title="enum core::result::Result">Result</a><T, <T as <aclass="trait"href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.77.1/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.77.1/src/core/convert/mod.rs.html#789-791">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.77.1/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.77.1/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryInto.html#associatedtype.Error"class="associatedtype">Error</a> = <U as <aclass="trait"href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.77.1/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.77.1/src/core/convert/mod.rs.html#796">source</a><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryInto.html#tymethod.try_into"class="fn">try_into</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.77.1/core/result/enum.Result.html"title="enum core::result::Result">Result</a><U, <U as <aclass="trait"href="https://doc.rust-lang.org/1.77.1/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.77.1/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">{"CapturesMatches<'r, 'c, 'h>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.CapturesMatches.html\" title=\"struct regex_automata::nfa::thompson::pikevm::CapturesMatches\">CapturesMatches</a><'r, 'c, 'h></code></h3><pre><code><div class=\"where\">impl<'r, 'c, 'h> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.CapturesMatches.html\" title=\"struct regex_automata::nfa::thompson::pikevm::CapturesMatches\">CapturesMatches</a><'r, 'c, 'h></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"../../../util/captures/struct.Captures.html\" title=\"struct regex_automata::util::captures::Captures\">Captures</a>;</div>","FindMatches<'r, 'c, 'h>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.FindMatches.html\" title=\"struct regex_automata::nfa::thompson::pikevm::FindMatches\">FindMatches</a><'r, 'c, 'h></code></h3><pre><code><div class=\"where\">impl<'r, 'c, 'h> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.FindMatches.html\" title=\"struct regex_automata::nfa::thompson::pikevm::FindMatches\">FindMatches</a><'r, 'c, 'h></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"struct\" href=\"../../../struct.Match.html\" title=\"struct regex_automata::Match\">Match</a>;</div>"}</script></section></div></main></body></html>