<main><divclass="width-limiter"><navclass="sub"><formclass="search-form"><span></span><divid="sidebar-button"tabindex="-1"><ahref="../../../../../memchr/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">memchr</a>::<wbr><ahref="../../../index.html">arch</a>::<wbr><ahref="../../index.html">x86_64</a>::<wbr><ahref="../index.html">avx2</a>::<wbr><ahref="index.html">packedpair</a>::<wbr><aclass="struct"href="#">Finder</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/memchr/arch/x86_64/avx2/packedpair.rs.html#23-26">source</a> · <buttonid="toggle-all-docs"title="collapse all docs">[<span>−</span>]</button></span></div><preclass="rust item-decl"><code>pub struct Finder { <spanclass="comment">/* private fields */</span> }</code></pre><detailsclass="toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>A “packed pair” finder that uses 256-bit vector operations.</p>
<p>This finder picks two bytes that it believes have high predictive power
for indicating an overall match of a needle. Depending on whether
<code>Finder::find</code> or <code>Finder::find_prefilter</code> is used, it reports offsets
where the needle matches or could match. In the prefilter case, candidates
are reported whenever the <ahref="../../../all/packedpair/struct.Pair.html"title="struct memchr::arch::all::packedpair::Pair"><code>Pair</code></a> of bytes given matches.</p>
</div></details><h2id="implementations"class="section-header">Implementations<ahref="#implementations"class="anchor">§</a></h2><divid="implementations-list"><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Finder"class="impl"><aclass="src rightside"href="../../../../../src/memchr/arch/x86_64/avx2/packedpair.rs.html#28-213">source</a><ahref="#impl-Finder"class="anchor">§</a><h3class="code-header">impl <aclass="struct"href="struct.Finder.html"title="struct memchr::arch::x86_64::avx2::packedpair::Finder">Finder</a></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.new"class="method"><aclass="src rightside"href="../../../../../src/memchr/arch/x86_64/avx2/packedpair.rs.html#37-39">source</a><h4class="code-header">pub fn <ahref="#method.new"class="fn">new</a>(needle: &[<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="struct.Finder.html"title="struct memchr::arch::x86_64::avx2::packedpair::Finder">Finder</a>></h4></section></summary><divclass="docblock"><p>Create a new pair searcher. The searcher returned can either report
exact matches of <code>needle</code> or act as a prefilter and report candidate
positions of <code>needle</code>.</p>
<p>If AVX2 is unavailable in the current environment or if a <ahref="../../../all/packedpair/struct.Pair.html"title="struct memchr::arch::all::packedpair::Pair"><code>Pair</code></a>
could not be constructed from the needle given, then <code>None</code> is
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.with_pair"class="method"><aclass="src rightside"href="../../../../../src/memchr/arch/x86_64/avx2/packedpair.rs.html#49-58">source</a><h4class="code-header">pub fn <ahref="#method.with_pair"class="fn">with_pair</a>(needle: &[<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>], pair: <aclass="struct"href="../../../all/packedpair/struct.Pair.html"title="struct memchr::arch::all::packedpair::Pair">Pair</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="struct"href="struct.Finder.html"title="struct memchr::arch::x86_64::avx2::packedpair::Finder">Finder</a>></h4></section></summary><divclass="docblock"><p>Create a new “packed pair” finder using the pair of bytes given.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_available"class="method"><aclass="src rightside"href="../../../../../src/memchr/arch/x86_64/avx2/packedpair.rs.html#87-110">source</a><h4class="code-header">pub fn <ahref="#method.is_available"class="fn">is_available</a>() -><aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns true when this implementation is available in the current
<p>When this is true, it is guaranteed that <ahref="struct.Finder.html#method.with_pair"title="associated function memchr::arch::x86_64::avx2::packedpair::Finder::with_pair"><code>Finder::with_pair</code></a> will
return a <code>Some</code> value. Similarly, when it is false, it is guaranteed
that <code>Finder::with_pair</code> will return a <code>None</code> value. Notice that this
does not guarantee that <ahref="struct.Finder.html#method.new"title="associated function memchr::arch::x86_64::avx2::packedpair::Finder::new"><code>Finder::new</code></a> will return a <code>Finder</code>. Namely,
even when <code>Finder::is_available</code> is true, it is not guaranteed that a
valid <ahref="../../../all/packedpair/struct.Pair.html"title="struct memchr::arch::all::packedpair::Pair"><code>Pair</code></a> can be found from the needle given.</p>
<p>Note also that for the lifetime of a single program, if this returns
<p>When <code>haystack.len()</code> is less than <ahref="struct.Finder.html#method.min_haystack_len"title="method memchr::arch::x86_64::avx2::packedpair::Finder::min_haystack_len"><code>Finder::min_haystack_len</code></a>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.find_prefilter"class="method"><aclass="src rightside"href="../../../../../src/memchr/arch/x86_64/avx2/packedpair.rs.html#132-135">source</a><h4class="code-header">pub fn <ahref="#method.find_prefilter"class="fn">find_prefilter</a>(&self, haystack: &[<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.u8.html">u8</a>]) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>></h4></section></summary><divclass="docblock"><p>Run this finder on the given haystack as a prefilter.</p>
<p>When <code>haystack.len()</code> is less than <ahref="struct.Finder.html#method.min_haystack_len"title="method memchr::arch::x86_64::avx2::packedpair::Finder::min_haystack_len"><code>Finder::min_haystack_len</code></a>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.pair"class="method"><aclass="src rightside"href="../../../../../src/memchr/arch/x86_64/avx2/packedpair.rs.html#187-189">source</a><h4class="code-header">pub fn <ahref="#method.pair"class="fn">pair</a>(&self) ->&<aclass="struct"href="../../../all/packedpair/struct.Pair.html"title="struct memchr::arch::all::packedpair::Pair">Pair</a></h4></section></summary><divclass="docblock"><p>Returns the pair of offsets (into the needle) used to check as a
predicate before confirming whether a needle exists at a particular
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.min_haystack_len"class="method"><aclass="src rightside"href="../../../../../src/memchr/arch/x86_64/avx2/packedpair.rs.html#199-212">source</a><h4class="code-header">pub fn <ahref="#method.min_haystack_len"class="fn">min_haystack_len</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the minimum haystack length that this <code>Finder</code> can search.</p>
</div></details></div></details></div><h2id="trait-implementations"class="section-header">Trait Implementations<ahref="#trait-implementations"class="anchor">§</a></h2><divid="trait-implementations-list"><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Clone-for-Finder"class="impl"><aclass="src rightside"href="../../../../../src/memchr/arch/x86_64/avx2/packedpair.rs.html#22">source</a><ahref="#impl-Clone-for-Finder"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a> for <aclass="struct"href="struct.Finder.html"title="struct memchr::arch::x86_64::avx2::packedpair::Finder">Finder</a></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.clone"class="method trait-impl"><aclass="src rightside"href="../../../../../src/memchr/arch/x86_64/avx2/packedpair.rs.html#22">source</a><ahref="#method.clone"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html#tymethod.clone"class="fn">clone</a>(&self) -><aclass="struct"href="struct.Finder.html"title="struct memchr::arch::x86_64::avx2::packedpair::Finder">Finder</a></h4></section></summary><divclass='docblock'>Returns a copy of the value. <ahref="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.clone_from"class="method trait-impl"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="src"href="https://doc.rust-lang.org/1.76.0/src/core/clone.rs.html#169">source</a></span><ahref="#method.clone_from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html#method.clone_from"class="fn">clone_from</a>(&mut self, source: <aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&Self</a>)</h4></section></summary><divclass='docblock'>Performs copy-assignment from <code>source</code>. <ahref="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Debug-for-Finder"class="impl"><aclass="src rightside"href="../../../../../src/memchr/arch/x86_64/avx2/packedpair.rs.html#22">source</a><ahref="#impl-Debug-for-Finder"class="anchor">§</a><h3class="code-header">impl <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html"title="trait core::fmt::Debug">Debug</a> for <aclass="struct"href="struct.Finder.html"title="struct memchr::arch::x86_64::avx2::packedpair::Finder">Finder</a></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.fmt"class="method trait-impl"><aclass="src rightside"href="../../../../../src/memchr/arch/x86_64/avx2/packedpair.rs.html#22">source</a><ahref="#method.fmt"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html#tymethod.fmt"class="fn">fmt</a>(&self, f: &mut <aclass="struct"href="https://doc.rust-lang.org/1.76.0/core/fmt/struct.Formatter.html"title="struct core::fmt::Formatter">Formatter</a><'_>) -><aclass="type"href="https://doc.rust-lang.org/1.76.0/core/fmt/type.Result.html"title="type core::fmt::Result">Result</a></h4></section></summary><divclass='docblock'>Formats the value using the given formatter. <ahref="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><sectionid="impl-Copy-for-Finder"class="impl"><aclass="src rightside"href="../../../../../src/memchr/arch/x86_64/avx2/packedpair.rs.html#22">source</a><ahref="#impl-Copy-for-Finder"class="anchor">§</a><h3class="code-h
<p>That is, this conversion is whatever the implementation of
<code><ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html"title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-ToOwned-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#83-85">source</a><ahref="#impl-ToOwned-for-T"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html"title="trait alloc::borrow::ToOwned">ToOwned</a> for T<divclass="where">where
T: <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Owned"class="associatedtype trait-impl"><ahref="#associatedtype.Owned"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned"class="associatedtype">Owned</a> = T</h4></section></summary><divclass='docblock'>The resulting type after obtaining ownership.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.to_owned"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#88">source</a><ahref="#method.to_owned"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned"class="fn">to_owned</a>(&self) -> T</h4></section></summary><divclass='docblock'>Creates owned data from borrowed data, usually by cloning. <ahref="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.clone_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#92">source</a><ahref="#method.clone_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#method.clone_into"class="fn">clone_into</a>(&self, target: <aclass="primitive"href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&mut T</a>)</h4></section></summary><divclass='docblock'>Uses borrowed data to replace owned data, usually by cloning. <ahref="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryFrom%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#803-805">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.76.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error"class="associatedtype">Error</a> = <aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/convert/enum.Infallible.html"title="enum core::convert::Infallible">Infallible</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#810">source</a><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#tymethod.try_from"class="fn">try_from</a>(value: U) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><T, <T as <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryInto%3CU%3E-for-T"class="impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#788-790">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.76.0/core/convert/trait.TryInto.html"title="trait core::convert::TryInto">TryInto</a><U> for T<divclass="where">where
U: <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#associatedtype.Error"class="associatedtype">Error</a> = <U as <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_into"class="method trait-impl"><aclass="src rightside"href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#795">source</a><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#tymethod.try_into"class="fn">try_into</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><U, <U as <aclass="trait"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>