mirror of
https://github.com/edg-l/edlang.git
synced 2024-11-22 16:08:24 +00:00
378 lines
66 KiB
HTML
378 lines
66 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The configuration and the haystack to use for an Aho-Corasick search."><title>Input 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><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="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" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../aho_corasick/index.html">aho_corasick</a><span class="version">1.1.3</span></h2></div><h2 class="location"><a href="#">Input</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><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 trait-implementation"><li><a href="#impl-Clone-for-Input%3C'h%3E">Clone</a></li><li><a href="#impl-Debug-for-Input%3C'h%3E">Debug</a></li><li><a href="#impl-From%3C%26H%3E-for-Input%3C'h%3E">From<&'h H></a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-Input%3C'h%3E">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-Input%3C'h%3E">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Input%3C'h%3E">Send</a></li><li><a href="#impl-Sync-for-Input%3C'h%3E">Sync</a></li><li><a href="#impl-Unpin-for-Input%3C'h%3E">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Input%3C'h%3E">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-ToOwned-for-T">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In crate aho_corasick</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="index.html">aho_corasick</a>::<wbr><a class="struct" href="#">Input</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../src/aho_corasick/util/search.rs.html#83-88">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct Input<'h> { <span class="comment">/* private fields */</span> }</code></pre><details class="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="associated function aho_corasick::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="method aho_corasick::Input::span"><code>Input::span</code></a> or
|
||
<a href="struct.Input.html#method.range" title="method aho_corasick::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="method aho_corasick::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="enum aho_corasick::MatchKind"><code>MatchKind</code></a> that the searcher was built with. This is configured
|
||
via <a href="struct.Input.html#method.earliest" title="method aho_corasick::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 class="doc-anchor" href="#valid-bounds-and-search-termination">§</a>Valid bounds and search termination</h2>
|
||
<p>An <code>Input</code> permits setting the bounds of a search via either
|
||
<a href="struct.Input.html#method.span" title="method aho_corasick::Input::span"><code>Input::span</code></a> or <a href="struct.Input.html#method.range" title="method aho_corasick::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="method aho_corasick::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>&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>&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 class="doc-anchor" href="#example-str-and-u8-automatically-convert-to-an-input">§</a>Example: <code>&str</code> and <code>&[u8]</code> automatically convert to an <code>Input</code></h2>
|
||
<p>There is a <code>From<&T> for Input</code> implementation for all <code>T: AsRef<[u8]></code>.
|
||
Additionally, the <a href="struct.AhoCorasick.html" title="struct aho_corasick::AhoCorasick"><code>AhoCorasick</code></a> search APIs accept
|
||
a <code>Into<Input></code>. These two things combined together mean you can provide
|
||
things like <code>&str</code> and <code>&[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">&</span>[<span class="string">"abcd"</span>, <span class="string">"b"</span>])
|
||
.unwrap();
|
||
<span class="kw">let </span>haystack = <span class="string">"abcd"</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 'find' routine, we can provide an 'Input' explicitly
|
||
// that is configured to do an anchored search. Since 'b' doesn'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="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Input%3C'h%3E" class="impl"><a class="src rightside" href="../src/aho_corasick/util/search.rs.html#90-630">source</a><a href="#impl-Input%3C'h%3E" class="anchor">§</a><h3 class="code-header">impl<'h> <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../src/aho_corasick/util/search.rs.html#93-100">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a><H: ?<a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><[<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.u8.html">u8</a>]>>(haystack: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&'h H</a>) -> <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></h4></section></summary><div class="docblock"><p>Create a new search configuration for the given haystack.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.span" class="method"><a class="src rightside" href="../src/aho_corasick/util/search.rs.html#142-145">source</a><h4 class="code-header">pub fn <a href="#method.span" class="fn">span</a><S: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="struct.Span.html" title="struct aho_corasick::Span">Span</a>>>(self, span: S) -> <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></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="struct aho_corasick::Span"><code>Span</code></a> may be given directly, one may also provide a
|
||
<code>std::ops::Range<usize></code>. To provide anything supported by range
|
||
syntax, use the <a href="struct.Input.html#method.range" title="method aho_corasick::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="method aho_corasick::Input::range"><code>Input::range</code></a> overrides this method and vice versa.</p>
|
||
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</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 class="doc-anchor" href="#example">§</a>Example</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">&</span>[<span class="string">"b"</span>, <span class="string">"abcd"</span>, <span class="string">"abc"</span>];
|
||
<span class="kw">let </span>haystack = <span class="string">"abcd"</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">"should have a match"</span>);
|
||
<span class="comment">// Without the span stopping the search early, 'abcd' would be reported
|
||
// because it is the correct leftmost-first match.
|
||
</span><span class="macro">assert_eq!</span>(<span class="string">"abc"</span>, <span class="kw-2">&</span>haystack[mat.span()]);
|
||
</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.range" class="method"><a class="src rightside" href="../src/aho_corasick/util/search.rs.html#175-178">source</a><h4 class="code-header">pub fn <a href="#method.range" class="fn">range</a><R: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/range/trait.RangeBounds.html" title="trait core::ops::range::RangeBounds">RangeBounds</a><<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>>>(self, range: R) -> <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></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="method aho_corasick::Input::span"><code>Input::span</code></a> overrides this method and vice versa.</p>
|
||
<h5 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h5>
|
||
<p>This routine will panic if the given range could not be converted
|
||
to a valid <a href="https://doc.rust-lang.org/1.80.0/core/ops/range/struct.Range.html" title="struct core::ops::range::Range"><code>Range</code></a>. 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 class="doc-anchor" href="#example-1">§</a>Example</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">"foobar"</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">"foobar"</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="toggle method-toggle" open><summary><section id="method.anchored" class="method"><a class="src rightside" href="../src/aho_corasick/util/search.rs.html#252-255">source</a><h4 class="code-header">pub fn <a href="#method.anchored" class="fn">anchored</a>(self, mode: <a class="enum" href="enum.Anchored.html" title="enum aho_corasick::Anchored">Anchored</a>) -> <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></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="variant aho_corasick::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="variant aho_corasick::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="variant aho_corasick::Anchored::No"><code>Anchored::No</code></a>.</p>
|
||
<h5 id="support-for-anchored-searches"><a class="doc-anchor" href="#support-for-anchored-searches">§</a>Support for anchored searches</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" title="struct aho_corasick::nfa::noncontiguous::NFA"><code>noncontiguous::NFA</code></a> always
|
||
supports both unanchored and anchored searches.</li>
|
||
<li><a href="nfa/contiguous/struct.NFA.html" title="struct aho_corasick::nfa::contiguous::NFA"><code>contiguous::NFA</code></a> always supports both
|
||
unanchored and anchored searches.</li>
|
||
<li><a href="dfa/struct.DFA.html" title="struct aho_corasick::dfa::DFA"><code>dfa::DFA</code></a> supports only unanchored
|
||
searches by default.
|
||
<a href="dfa/struct.Builder.html#method.start_kind" title="method aho_corasick::dfa::Builder::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" title="struct aho_corasick::AhoCorasick"><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" title="method aho_corasick::AhoCorasickBuilder::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 class="doc-anchor" href="#example-2">§</a>Example</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="variant aho_corasick::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">&</span>[<span class="string">"bcd"</span>];
|
||
<span class="kw">let </span>haystack = <span class="string">"abcd"</span>;
|
||
|
||
<span class="kw">let </span>ac = AhoCorasick::builder()
|
||
.start_kind(StartKind::Both)
|
||
.build(patterns)
|
||
.unwrap();
|
||
|
||
<span class="comment">// Note that 'Anchored::No' is the default, so it doesn'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">"should have a match"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="string">"bcd"</span>, <span class="kw-2">&</span>haystack[mat.span()]);
|
||
|
||
<span class="comment">// While 'bcd' 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 'bcd' 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">"should have a match"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="string">"bcd"</span>, <span class="kw-2">&</span>haystack[mat.span()]);
|
||
</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.earliest" class="method"><a class="src rightside" href="../src/aho_corasick/util/search.rs.html#302-305">source</a><h4 class="code-header">pub fn <a href="#method.earliest" class="fn">earliest</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -> <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></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="variant aho_corasick::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 class="doc-anchor" href="#example-3">§</a>Example</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">&</span>[<span class="string">"abc"</span>, <span class="string">"b"</span>];
|
||
<span class="kw">let </span>haystack = <span class="string">"abc"</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">"should have a match"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="string">"abc"</span>, <span class="kw-2">&</span>haystack[mat.span()]);
|
||
|
||
<span class="comment">// The "earliest" possible match, even if it isn'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">"should have a match"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="string">"b"</span>, <span class="kw-2">&</span>haystack[mat.span()]);
|
||
</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_span" class="method"><a class="src 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="fn">set_span</a><S: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="struct.Span.html" title="struct aho_corasick::Span">Span</a>>>(&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="method aho_corasick::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="struct aho_corasick::Span"><code>Span</code></a> may be given directly, one may also provide a
|
||
<code>std::ops::Range<usize></code>.</p>
|
||
<h5 id="panics-2"><a class="doc-anchor" href="#panics-2">§</a>Panics</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 class="doc-anchor" href="#example-4">§</a>Example</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">"foobar"</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="toggle method-toggle" open><summary><section id="method.set_range" class="method"><a class="src 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="fn">set_range</a><R: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/ops/range/trait.RangeBounds.html" title="trait core::ops::range::RangeBounds">RangeBounds</a><<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>>>(&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="method aho_corasick::Input::range"><code>Input::range</code></a> method, except this mutates the
|
||
span in place.</p>
|
||
<h5 id="panics-3"><a class="doc-anchor" href="#panics-3">§</a>Panics</h5>
|
||
<p>This routine will panic if the given range could not be converted
|
||
to a valid <a href="https://doc.rust-lang.org/1.80.0/core/ops/range/struct.Range.html" title="struct core::ops::range::Range"><code>Range</code></a>. 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 class="doc-anchor" href="#example-5">§</a>Example</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">"foobar"</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="toggle method-toggle" open><summary><section id="method.set_start" class="method"><a class="src 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="fn">set_start</a>(&mut self, start: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>)</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 class="doc-anchor" href="#panics-4">§</a>Panics</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 class="doc-anchor" href="#example-6">§</a>Example</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">"foobar"</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="toggle method-toggle" open><summary><section id="method.set_end" class="method"><a class="src 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="fn">set_end</a>(&mut self, end: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>)</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 class="doc-anchor" href="#panics-5">§</a>Panics</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 class="doc-anchor" href="#example-7">§</a>Example</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">"foobar"</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="toggle method-toggle" open><summary><section id="method.set_anchored" class="method"><a class="src 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="fn">set_anchored</a>(&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="method aho_corasick::Input::anchored"><code>Input::anchored</code></a>, except it mutates the search
|
||
configuration in place.</p>
|
||
<h5 id="example-8"><a class="doc-anchor" href="#example-8">§</a>Example</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">"foobar"</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="toggle method-toggle" open><summary><section id="method.set_earliest" class="method"><a class="src 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="fn">set_earliest</a>(&mut self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>)</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="method aho_corasick::Input::earliest"><code>Input::earliest</code></a>, except it mutates the search
|
||
configuration in place.</p>
|
||
<h5 id="example-9"><a class="doc-anchor" href="#example-9">§</a>Example</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">"foobar"</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="toggle method-toggle" open><summary><section id="method.haystack" class="method"><a class="src rightside" href="../src/aho_corasick/util/search.rs.html#493-495">source</a><h4 class="code-header">pub fn <a href="#method.haystack" class="fn">haystack</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></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 class="doc-anchor" href="#example-10">§</a>Example</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">"foobar"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="string">b"foobar"</span>, input.haystack());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.start" class="method"><a class="src rightside" href="../src/aho_corasick/util/search.rs.html#513-515">source</a><h4 class="code-header">pub fn <a href="#method.start" class="fn">start</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a></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 class="doc-anchor" href="#example-11">§</a>Example</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">"foobar"</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">"foobar"</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="toggle method-toggle" open><summary><section id="method.end" class="method"><a class="src rightside" href="../src/aho_corasick/util/search.rs.html#533-535">source</a><h4 class="code-header">pub fn <a href="#method.end" class="fn">end</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a></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 class="doc-anchor" href="#example-12">§</a>Example</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">"foobar"</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">"foobar"</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="toggle method-toggle" open><summary><section id="method.get_span" class="method"><a class="src 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="fn">get_span</a>(&self) -> <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 class="doc-anchor" href="#example-13">§</a>Example</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">"foobar"</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="toggle method-toggle" open><summary><section id="method.get_range" class="method"><a class="src 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="fn">get_range</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.80.0/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>></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 class="doc-anchor" href="#example-14">§</a>Example</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">"foobar"</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="toggle method-toggle" open><summary><section id="method.get_anchored" class="method"><a class="src 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="fn">get_anchored</a>(&self) -> <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="variant aho_corasick::Anchored::No"><code>Anchored::No</code></a>.</p>
|
||
<h5 id="example-15"><a class="doc-anchor" href="#example-15">§</a>Example</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">"foobar"</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="toggle method-toggle" open><summary><section id="method.get_earliest" class="method"><a class="src 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="fn">get_earliest</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Return whether this search should execute in “earliest” mode.</p>
|
||
<h5 id="example-16"><a class="doc-anchor" href="#example-16">§</a>Example</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">"foobar"</span>);
|
||
<span class="macro">assert!</span>(!input.get_earliest());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_done" class="method"><a class="src 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="fn">is_done</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></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 class="doc-anchor" href="#example-17">§</a>Example</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">"foobar"</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="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-Input%3C'h%3E" class="impl"><a class="src rightside" href="../src/aho_corasick/util/search.rs.html#82">source</a><a href="#impl-Clone-for-Input%3C'h%3E" class="anchor">§</a><h3 class="code-header">impl<'h> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src 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 href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&self) -> <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.80.0/src/core/clone.rs.html#169">source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&Self</a>)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Input%3C'h%3E" class="impl"><a class="src rightside" href="../src/aho_corasick/util/search.rs.html#632-644">source</a><a href="#impl-Debug-for-Input%3C'h%3E" class="anchor">§</a><h3 class="code-header">impl<'h> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src 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 href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.80.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.80.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3C%26H%3E-for-Input%3C'h%3E" class="impl"><a class="src rightside" href="../src/aho_corasick/util/search.rs.html#646-651">source</a><a href="#impl-From%3C%26H%3E-for-Input%3C'h%3E" class="anchor">§</a><h3 class="code-header">impl<'h, H: ?<a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><[<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.u8.html">u8</a>]>> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&'h H</a>> for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src 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 href="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(haystack: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&'h H</a>) -> <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-Input%3C'h%3E" class="impl"><a href="#impl-Freeze-for-Input%3C'h%3E" class="anchor">§</a><h3 class="code-header">impl<'h> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></h3></section><section id="impl-RefUnwindSafe-for-Input%3C'h%3E" class="impl"><a href="#impl-RefUnwindSafe-for-Input%3C'h%3E" class="anchor">§</a><h3 class="code-header">impl<'h> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></h3></section><section id="impl-Send-for-Input%3C'h%3E" class="impl"><a href="#impl-Send-for-Input%3C'h%3E" class="anchor">§</a><h3 class="code-header">impl<'h> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></h3></section><section id="impl-Sync-for-Input%3C'h%3E" class="impl"><a href="#impl-Sync-for-Input%3C'h%3E" class="anchor">§</a><h3 class="code-header">impl<'h> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></h3></section><section id="impl-Unpin-for-Input%3C'h%3E" class="impl"><a href="#impl-Unpin-for-Input%3C'h%3E" class="anchor">§</a><h3 class="code-header">impl<'h> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></h3></section><section id="impl-UnwindSafe-for-Input%3C'h%3E" class="impl"><a href="#impl-UnwindSafe-for-Input%3C'h%3E" class="anchor">§</a><h3 class="code-header">impl<'h> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Input.html" title="struct aho_corasick::Input">Input</a><'h></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/any.rs.html#141">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.80.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.80.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/borrow.rs.html#210">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/borrow.rs.html#216">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/borrow.rs.html#217">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#765">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#768">source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#748-750">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#758">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> 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><a href="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><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#83-85">source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where
|
||
T: <a class="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><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#88">source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="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><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#92">source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#805-807">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="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<div class="where">where
|
||
U: <a class="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><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="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><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#812">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="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 <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="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><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#790-792">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="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<div class="where">where
|
||
U: <a class="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><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="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><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#797">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="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 <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="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><div class='docblock'>Performs the conversion.</div></details></div></details></div><script type="text/json" id="notable-traits-data">{"&[u8]":"<h3>Notable traits for <code>&[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.80.0/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.80.0/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.80.0/std/primitive.u8.html\">u8</a>]</div>"}</script></section></div></main></body></html> |