deploy: de38ae62916547ad097c066f94a32e9ba7790eeb

This commit is contained in:
NotAShelf 2025-02-05 00:10:33 +00:00
commit 9a86359447
28502 changed files with 1261284 additions and 0 deletions

View file

@ -0,0 +1,13 @@
<!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="Compare corresponding bytes in `x` and `y` for equality."><title>is_equal in memchr::arch::all - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="memchr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[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="../../../memchr/index.html">memchr</a><span class="version">2.7.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">is_<wbr>equal</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#inlining" title="Inlining">Inlining</a></li><li><a href="#motivation" title="Motivation">Motivation</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In memchr::<wbr>arch::<wbr>all</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="../../index.html">memchr</a>::<wbr><a href="../index.html">arch</a>::<wbr><a href="index.html">all</a></span><h1>Function <span class="fn">is_equal</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/memchr/arch/all/mod.rs.html#65-73">Source</a> </span></div><pre class="rust item-decl"><code>pub fn is_equal(x: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>], y: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.bool.html">bool</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Compare corresponding bytes in <code>x</code> and <code>y</code> for equality.</p>
<p>That is, this returns true if and only if <code>x.len() == y.len()</code> and
<code>x[i] == y[i]</code> for all <code>0 &lt;= i &lt; x.len()</code>.</p>
<h2 id="inlining"><a class="doc-anchor" href="#inlining">§</a>Inlining</h2>
<p>This routine is marked <code>inline(always)</code>. If you want to call this function
in a way that is not always inlined, youll need to wrap a call to it in
another function that is marked as <code>inline(never)</code> or just <code>inline</code>.</p>
<h2 id="motivation"><a class="doc-anchor" href="#motivation">§</a>Motivation</h2>
<p>Why not use slice equality instead? Well, slice equality usually results in
a call out to the current platforms <code>libc</code> which might not be inlineable
or have other overhead. This routine isnt guaranteed to be a win, but it
might be in some cases.</p>
</div></details></section></div></main></body></html>

View file

@ -0,0 +1,28 @@
<!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="Compare `n` bytes at the given pointers for equality."><title>is_equal_raw in memchr::arch::all - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="memchr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[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="../../../memchr/index.html">memchr</a><span class="version">2.7.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">is_<wbr>equal_<wbr>raw</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#inlining" title="Inlining">Inlining</a></li><li><a href="#motivation" title="Motivation">Motivation</a></li><li><a href="#safety" title="Safety">Safety</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In memchr::<wbr>arch::<wbr>all</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="../../index.html">memchr</a>::<wbr><a href="../index.html">arch</a>::<wbr><a href="index.html">all</a></span><h1>Function <span class="fn">is_equal_raw</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/memchr/arch/all/mod.rs.html#108-158">Source</a> </span></div><pre class="rust item-decl"><code>pub unsafe fn is_equal_raw(x: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.pointer.html">*const </a><a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>, y: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.pointer.html">*const </a><a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>, n: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.bool.html">bool</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Compare <code>n</code> bytes at the given pointers for equality.</p>
<p>This returns true if and only if <code>*x.add(i) == *y.add(i)</code> for all
<code>0 &lt;= i &lt; n</code>.</p>
<h2 id="inlining"><a class="doc-anchor" href="#inlining">§</a>Inlining</h2>
<p>This routine is marked <code>inline(always)</code>. If you want to call this function
in a way that is not always inlined, youll need to wrap a call to it in
another function that is marked as <code>inline(never)</code> or just <code>inline</code>.</p>
<h2 id="motivation"><a class="doc-anchor" href="#motivation">§</a>Motivation</h2>
<p>Why not use slice equality instead? Well, slice equality usually results in
a call out to the current platforms <code>libc</code> which might not be inlineable
or have other overhead. This routine isnt guaranteed to be a win, but it
might be in some cases.</p>
<h2 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h2>
<ul>
<li>Both <code>x</code> and <code>y</code> must be valid for reads of up to <code>n</code> bytes.</li>
<li>Both <code>x</code> and <code>y</code> must point to an initialized value.</li>
<li>Both <code>x</code> and <code>y</code> must each point to an allocated object and
must either be in bounds or at most one byte past the end of the
allocated object. <code>x</code> and <code>y</code> do not need to point to the same allocated
object, but they may.</li>
<li>Both <code>x</code> and <code>y</code> must be <em>derived from</em> a pointer to their respective
allocated objects.</li>
<li>The distance between <code>x</code> and <code>x+n</code> must not overflow <code>isize</code>. Similarly
for <code>y</code> and <code>y+n</code>.</li>
<li>The distance being in bounds must not rely on “wrapping around” the
address space.</li>
</ul>
</div></details></section></div></main></body></html>

View file

@ -0,0 +1,8 @@
<!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="Returns true if and only if `needle` is a prefix of `haystack`."><title>is_prefix in memchr::arch::all - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="memchr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[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="../../../memchr/index.html">memchr</a><span class="version">2.7.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">is_<wbr>prefix</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#inlining" title="Inlining">Inlining</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In memchr::<wbr>arch::<wbr>all</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="../../index.html">memchr</a>::<wbr><a href="../index.html">arch</a>::<wbr><a href="index.html">all</a></span><h1>Function <span class="fn">is_prefix</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/memchr/arch/all/mod.rs.html#26-29">Source</a> </span></div><pre class="rust item-decl"><code>pub fn is_prefix(haystack: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>], needle: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.bool.html">bool</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns true if and only if <code>needle</code> is a prefix of <code>haystack</code>.</p>
<p>This uses a latency optimized variant of <code>memcmp</code> internally which <em>might</em>
make this faster for very short strings.</p>
<h2 id="inlining"><a class="doc-anchor" href="#inlining">§</a>Inlining</h2>
<p>This routine is marked <code>inline(always)</code>. If you want to call this function
in a way that is not always inlined, youll need to wrap a call to it in
another function that is marked as <code>inline(never)</code> or just <code>inline</code>.</p>
</div></details></section></div></main></body></html>

View file

@ -0,0 +1,8 @@
<!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="Returns true if and only if `needle` is a suffix of `haystack`."><title>is_suffix in memchr::arch::all - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="memchr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[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="../../../memchr/index.html">memchr</a><span class="version">2.7.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">is_<wbr>suffix</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#inlining" title="Inlining">Inlining</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In memchr::<wbr>arch::<wbr>all</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="../../index.html">memchr</a>::<wbr><a href="../index.html">arch</a>::<wbr><a href="index.html">all</a></span><h1>Function <span class="fn">is_suffix</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/memchr/arch/all/mod.rs.html#42-45">Source</a> </span></div><pre class="rust item-decl"><code>pub fn is_suffix(haystack: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>], needle: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.bool.html">bool</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns true if and only if <code>needle</code> is a suffix of <code>haystack</code>.</p>
<p>This uses a latency optimized variant of <code>memcmp</code> internally which <em>might</em>
make this faster for very short strings.</p>
<h2 id="inlining"><a class="doc-anchor" href="#inlining">§</a>Inlining</h2>
<p>This routine is marked <code>inline(always)</code>. If you want to call this function
in a way that is not always inlined, youll need to wrap a call to it in
another function that is marked as <code>inline(never)</code> or just <code>inline</code>.</p>
</div></details></section></div></main></body></html>

View file

@ -0,0 +1,5 @@
<!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="Contains architecture independent routines."><title>memchr::arch::all - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="memchr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[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="../../../memchr/index.html">memchr</a><span class="version">2.7.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module all</a></h2><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In memchr::<wbr>arch</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="../../index.html">memchr</a>::<wbr><a href="../index.html">arch</a></span><h1>Module <span>all</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/memchr/arch/all/mod.rs.html#1-234">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Contains architecture independent routines.</p>
<p>These routines are often used as a “fallback” implementation when the more
specialized architecture dependent routines are unavailable.</p>
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="memchr/index.html" title="mod memchr::arch::all::memchr">memchr</a></div><div class="desc docblock-short">Provides architecture independent implementations of <code>memchr</code> and friends.</div></li><li><div class="item-name"><a class="mod" href="packedpair/index.html" title="mod memchr::arch::all::packedpair">packedpair</a></div><div class="desc docblock-short">Provides an architecture independent implementation of the “packed pair”
algorithm.</div></li><li><div class="item-name"><a class="mod" href="rabinkarp/index.html" title="mod memchr::arch::all::rabinkarp">rabinkarp</a></div><div class="desc docblock-short">An implementation of the <a href="https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm">Rabin-Karp substring search algorithm</a>.</div></li><li><div class="item-name"><a class="mod" href="shiftor/index.html" title="mod memchr::arch::all::shiftor">shiftor</a></div><div class="desc docblock-short">An implementation of the <a href="https://en.wikipedia.org/wiki/Bitap_algorithm">Shift-Or substring search algorithm</a>.</div></li><li><div class="item-name"><a class="mod" href="twoway/index.html" title="mod memchr::arch::all::twoway">twoway</a></div><div class="desc docblock-short">An implementation of the <a href="https://en.wikipedia.org/wiki/Two-way_string-matching_algorithm">Two-Way substring search algorithm</a>.</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.is_equal.html" title="fn memchr::arch::all::is_equal">is_<wbr>equal</a></div><div class="desc docblock-short">Compare corresponding bytes in <code>x</code> and <code>y</code> for equality.</div></li><li><div class="item-name"><a class="fn" href="fn.is_equal_raw.html" title="fn memchr::arch::all::is_equal_raw">is_<wbr>equal_<wbr>raw</a><sup title="unsafe function"></sup></div><div class="desc docblock-short">Compare <code>n</code> bytes at the given pointers for equality.</div></li><li><div class="item-name"><a class="fn" href="fn.is_prefix.html" title="fn memchr::arch::all::is_prefix">is_<wbr>prefix</a></div><div class="desc docblock-short">Returns true if and only if <code>needle</code> is a prefix of <code>haystack</code>.</div></li><li><div class="item-name"><a class="fn" href="fn.is_suffix.html" title="fn memchr::arch::all::is_suffix">is_<wbr>suffix</a></div><div class="desc docblock-short">Returns true if and only if <code>needle</code> is a suffix of <code>haystack</code>.</div></li></ul></section></div></main></body></html>

View file

@ -0,0 +1,20 @@
<!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="Provides architecture independent implementations of `memchr` and friends."><title>memchr::arch::all::memchr - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="memchr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[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="../../../../memchr/index.html">memchr</a><span class="version">2.7.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module memchr</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In memchr::<wbr>arch::<wbr>all</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="../../../index.html">memchr</a>::<wbr><a href="../../index.html">arch</a>::<wbr><a href="../index.html">all</a></span><h1>Module <span>memchr</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../../src/memchr/arch/all/memchr.rs.html#1-1022">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Provides architecture independent implementations of <code>memchr</code> and friends.</p>
<p>The main types in this module are <a href="struct.One.html" title="struct memchr::arch::all::memchr::One"><code>One</code></a>, <a href="struct.Two.html" title="struct memchr::arch::all::memchr::Two"><code>Two</code></a> and <a href="struct.Three.html" title="struct memchr::arch::all::memchr::Three"><code>Three</code></a>. They are for
searching for one, two or three distinct bytes, respectively, in a haystack.
Each type also has corresponding double ended iterators. These searchers
are typically slower than hand-coded vector routines accomplishing the same
task, but are also typically faster than naive scalar code. These routines
effectively work by treating a <code>usize</code> as a vector of 8-bit lanes, and thus
achieves some level of data parallelism even without explicit vector support.</p>
<p>The <code>One</code> searcher also provides a <a href="struct.One.html#method.count" title="method memchr::arch::all::memchr::One::count"><code>One::count</code></a> routine for efficiently
counting the number of times a single byte occurs in a haystack. This is
useful, for example, for counting the number of lines in a haystack. This
routine exists because it is usually faster, especially with a high match
count, then using <a href="struct.One.html#method.find" title="method memchr::arch::all::memchr::One::find"><code>One::find</code></a> repeatedly. (<a href="struct.OneIter.html" title="struct memchr::arch::all::memchr::OneIter"><code>OneIter</code></a> specializes its
<code>Iterator::count</code> implementation to use this routine.)</p>
<p>Only one, two and three bytes are supported because three bytes is about
the point where one sees diminishing returns. Beyond this point and its
probably (but not necessarily) better to just use a simple <code>[bool; 256]</code> array
or similar. However, it depends mightily on the specific work-load and the
expected match frequency.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.One.html" title="struct memchr::arch::all::memchr::One">One</a></div><div class="desc docblock-short">Finds all occurrences of a single byte in a haystack.</div></li><li><div class="item-name"><a class="struct" href="struct.OneIter.html" title="struct memchr::arch::all::memchr::OneIter">OneIter</a></div><div class="desc docblock-short">An iterator over all occurrences of a single byte in a haystack.</div></li><li><div class="item-name"><a class="struct" href="struct.Three.html" title="struct memchr::arch::all::memchr::Three">Three</a></div><div class="desc docblock-short">Finds all occurrences of three bytes in a haystack.</div></li><li><div class="item-name"><a class="struct" href="struct.ThreeIter.html" title="struct memchr::arch::all::memchr::ThreeIter">Three<wbr>Iter</a></div><div class="desc docblock-short">An iterator over all occurrences of three possible bytes in a haystack.</div></li><li><div class="item-name"><a class="struct" href="struct.Two.html" title="struct memchr::arch::all::memchr::Two">Two</a></div><div class="desc docblock-short">Finds all occurrences of two bytes in a haystack.</div></li><li><div class="item-name"><a class="struct" href="struct.TwoIter.html" title="struct memchr::arch::all::memchr::TwoIter">TwoIter</a></div><div class="desc docblock-short">An iterator over all occurrences of two possible bytes in a haystack.</div></li></ul></section></div></main></body></html>

View file

@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["One","OneIter","Three","ThreeIter","Two","TwoIter"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,10 @@
<!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="Provides an architecture independent implementation of the “packed pair” algorithm."><title>memchr::arch::all::packedpair - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="memchr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[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="../../../../memchr/index.html">memchr</a><span class="version">2.7.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module packedpair</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In memchr::<wbr>arch::<wbr>all</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="../../../index.html">memchr</a>::<wbr><a href="../../index.html">arch</a>::<wbr><a href="../index.html">all</a></span><h1>Module <span>packedpair</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../../src/memchr/arch/all/packedpair/mod.rs.html#1-359">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Provides an architecture independent implementation of the “packed pair”
algorithm.</p>
<p>The “packed pair” algorithm is based on the <a href="http://0x80.pl/articles/simd-strfind.html#first-and-last">generic SIMD</a> algorithm. The main
difference is that it (by default) uses a background distribution of byte
frequencies to heuristically select the pair of bytes to search for. Note that
this module provides an architecture independent version that doesnt do as
good of a job keeping the search for candidates inside a SIMD hot path. It
however can be good enough in many circumstances.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::packedpair::Finder">Finder</a></div><div class="desc docblock-short">An architecture independent “packed pair” finder.</div></li><li><div class="item-name"><a class="struct" href="struct.Pair.html" title="struct memchr::arch::all::packedpair::Pair">Pair</a></div><div class="desc docblock-short">A pair of byte offsets into a needle to use as a predicate.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.HeuristicFrequencyRank.html" title="trait memchr::arch::all::packedpair::HeuristicFrequencyRank">Heuristic<wbr>Frequency<wbr>Rank</a></div><div class="desc docblock-short">This trait allows the user to customize the heuristic used to determine the
relative frequency of a given byte in the dataset being searched.</div></li></ul></section></div></main></body></html>

View file

@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["Finder","Pair"],"trait":["HeuristicFrequencyRank"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,67 @@
<!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="This trait allows the user to customize the heuristic used to determine the relative frequency of a given byte in the dataset being searched."><title>HeuristicFrequencyRank in memchr::arch::all::packedpair - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="memchr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[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="../../../../memchr/index.html">memchr</a><span class="version">2.7.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Heuristic<wbr>Frequency<wbr>Rank</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.rank" title="rank">rank</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-HeuristicFrequencyRank-for-%26R" title="&#38;&#39;a R">&#38;&#39;a R</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In memchr::<wbr>arch::<wbr>all::<wbr>packedpair</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="../../../index.html">memchr</a>::<wbr><a href="../../index.html">arch</a>::<wbr><a href="../index.html">all</a>::<wbr><a href="index.html">packedpair</a></span><h1>Trait <span class="trait">HeuristicFrequencyRank</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../../src/memchr/arch/all/packedpair/mod.rs.html#309-318">Source</a> </span></div><pre class="rust item-decl"><code>pub trait HeuristicFrequencyRank {
// Required method
fn <a href="#tymethod.rank" class="fn">rank</a>(&amp;self, byte: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This trait allows the user to customize the heuristic used to determine the
relative frequency of a given byte in the dataset being searched.</p>
<p>The use of this trait can have a dramatic impact on performance depending
on the type of data being searched. The details of why are explained in the
docs of <a href="../../../memmem/enum.Prefilter.html" title="enum memchr::memmem::Prefilter"><code>crate::memmem::Prefilter</code></a>. To summarize, the core algorithm uses
a prefilter to quickly identify candidate matches that are later verified
more slowly. This prefilter is implemented in terms of trying to find
<code>rare</code> bytes at specific offsets that will occur less frequently in the
dataset. While the concept of a <code>rare</code> byte is similar for most datasets,
there are some specific datasets (like binary executables) that have
dramatically different byte distributions. For these datasets customizing
the byte frequency heuristic can have a massive impact on performance, and
might even need to be done at runtime.</p>
<p>The default implementation of <code>HeuristicFrequencyRank</code> reads from the
static frequency table defined in <code>src/memmem/byte_frequencies.rs</code>. This
is optimal for most inputs, so if you are unsure of the impact of using a
custom <code>HeuristicFrequencyRank</code> you should probably just use the default.</p>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::{
arch::all::packedpair::HeuristicFrequencyRank,
memmem::FinderBuilder,
};
<span class="doccomment">/// A byte-frequency table that is good for scanning binary executables.
</span><span class="kw">struct </span>Binary;
<span class="kw">impl </span>HeuristicFrequencyRank <span class="kw">for </span>Binary {
<span class="kw">fn </span>rank(<span class="kw-2">&amp;</span><span class="self">self</span>, byte: u8) -&gt; u8 {
<span class="kw">const </span>TABLE: [u8; <span class="number">256</span>] = [
<span class="number">255</span>, <span class="number">128</span>, <span class="number">61</span>, <span class="number">43</span>, <span class="number">50</span>, <span class="number">41</span>, <span class="number">27</span>, <span class="number">28</span>, <span class="number">57</span>, <span class="number">15</span>, <span class="number">21</span>, <span class="number">13</span>, <span class="number">24</span>, <span class="number">17</span>, <span class="number">17</span>,
<span class="number">89</span>, <span class="number">58</span>, <span class="number">16</span>, <span class="number">11</span>, <span class="number">7</span>, <span class="number">14</span>, <span class="number">23</span>, <span class="number">7</span>, <span class="number">6</span>, <span class="number">24</span>, <span class="number">9</span>, <span class="number">6</span>, <span class="number">5</span>, <span class="number">9</span>, <span class="number">4</span>, <span class="number">7</span>, <span class="number">16</span>,
<span class="number">68</span>, <span class="number">11</span>, <span class="number">9</span>, <span class="number">6</span>, <span class="number">88</span>, <span class="number">7</span>, <span class="number">4</span>, <span class="number">4</span>, <span class="number">23</span>, <span class="number">9</span>, <span class="number">4</span>, <span class="number">8</span>, <span class="number">8</span>, <span class="number">5</span>, <span class="number">10</span>, <span class="number">4</span>, <span class="number">30</span>, <span class="number">11</span>,
<span class="number">9</span>, <span class="number">24</span>, <span class="number">11</span>, <span class="number">5</span>, <span class="number">5</span>, <span class="number">5</span>, <span class="number">19</span>, <span class="number">11</span>, <span class="number">6</span>, <span class="number">17</span>, <span class="number">9</span>, <span class="number">9</span>, <span class="number">6</span>, <span class="number">8</span>,
<span class="number">48</span>, <span class="number">58</span>, <span class="number">11</span>, <span class="number">14</span>, <span class="number">53</span>, <span class="number">40</span>, <span class="number">9</span>, <span class="number">9</span>, <span class="number">254</span>, <span class="number">35</span>, <span class="number">3</span>, <span class="number">6</span>, <span class="number">52</span>, <span class="number">23</span>, <span class="number">6</span>, <span class="number">6</span>, <span class="number">27</span>,
<span class="number">4</span>, <span class="number">7</span>, <span class="number">11</span>, <span class="number">14</span>, <span class="number">13</span>, <span class="number">10</span>, <span class="number">11</span>, <span class="number">11</span>, <span class="number">5</span>, <span class="number">2</span>, <span class="number">10</span>, <span class="number">16</span>, <span class="number">12</span>, <span class="number">6</span>, <span class="number">19</span>,
<span class="number">19</span>, <span class="number">20</span>, <span class="number">5</span>, <span class="number">14</span>, <span class="number">16</span>, <span class="number">31</span>, <span class="number">19</span>, <span class="number">7</span>, <span class="number">14</span>, <span class="number">20</span>, <span class="number">4</span>, <span class="number">4</span>, <span class="number">19</span>, <span class="number">8</span>, <span class="number">18</span>, <span class="number">20</span>, <span class="number">24</span>,
<span class="number">1</span>, <span class="number">25</span>, <span class="number">19</span>, <span class="number">58</span>, <span class="number">29</span>, <span class="number">10</span>, <span class="number">5</span>, <span class="number">15</span>, <span class="number">20</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">9</span>, <span class="number">4</span>, <span class="number">3</span>, <span class="number">5</span>,
<span class="number">51</span>, <span class="number">11</span>, <span class="number">4</span>, <span class="number">53</span>, <span class="number">23</span>, <span class="number">39</span>, <span class="number">6</span>, <span class="number">4</span>, <span class="number">13</span>, <span class="number">81</span>, <span class="number">4</span>, <span class="number">186</span>, <span class="number">5</span>, <span class="number">67</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">15</span>,
<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">5</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>,
<span class="number">12</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">6</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">9</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>,
<span class="number">2</span>, <span class="number">2</span>, <span class="number">4</span>, <span class="number">4</span>, <span class="number">11</span>, <span class="number">6</span>, <span class="number">7</span>, <span class="number">3</span>, <span class="number">6</span>, <span class="number">9</span>, <span class="number">4</span>, <span class="number">5</span>,
<span class="number">46</span>, <span class="number">18</span>, <span class="number">8</span>, <span class="number">18</span>, <span class="number">17</span>, <span class="number">3</span>, <span class="number">8</span>, <span class="number">20</span>, <span class="number">16</span>, <span class="number">10</span>, <span class="number">3</span>, <span class="number">7</span>, <span class="number">175</span>, <span class="number">4</span>, <span class="number">6</span>, <span class="number">7</span>, <span class="number">13</span>,
<span class="number">3</span>, <span class="number">7</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">10</span>, <span class="number">3</span>, <span class="number">1</span>, <span class="number">5</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>,
<span class="number">16</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">1</span>, <span class="number">6</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">58</span>, <span class="number">20</span>, <span class="number">3</span>, <span class="number">14</span>, <span class="number">12</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">16</span>, <span class="number">3</span>, <span class="number">5</span>,
<span class="number">8</span>, <span class="number">3</span>, <span class="number">1</span>, <span class="number">8</span>, <span class="number">6</span>, <span class="number">17</span>, <span class="number">6</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">8</span>, <span class="number">6</span>, <span class="number">13</span>, <span class="number">175</span>,
];
TABLE[byte <span class="kw">as </span>usize]
}
}
<span class="comment">// Create a new finder with the custom heuristic.
</span><span class="kw">let </span>finder = FinderBuilder::new()
.build_forward_with_ranker(Binary, <span class="string">b"\x00\x00\xdd\xdd"</span>);
<span class="comment">// Find needle with custom heuristic.
</span><span class="macro">assert!</span>(finder.find(<span class="string">b"\x00\x00\x00\xdd\xdd"</span>).is_some());</code></pre></div>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.rank" class="method"><a class="src rightside" href="../../../../src/memchr/arch/all/packedpair/mod.rs.html#317">Source</a><h4 class="code-header">fn <a href="#tymethod.rank" class="fn">rank</a>(&amp;self, byte: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a></h4></section></summary><div class="docblock"><p>Return the heuristic frequency rank of the given byte. A lower rank
means the byte is believed to occur less frequently in the haystack.</p>
<p>Some uses of this heuristic may treat arbitrary absolute rank values as
significant. For example, an implementation detail in this crate may
determine that heuristic prefilters are inappropriate if every byte in
the needle has a “high” rank.</p>
</div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-HeuristicFrequencyRank-for-%26R" class="impl"><a class="src rightside" href="../../../../src/memchr/arch/all/packedpair/mod.rs.html#331-338">Source</a><a href="#impl-HeuristicFrequencyRank-for-%26R" class="anchor">§</a><h3 class="code-header">impl&lt;'a, R&gt; <a class="trait" href="trait.HeuristicFrequencyRank.html" title="trait memchr::arch::all::packedpair::HeuristicFrequencyRank">HeuristicFrequencyRank</a> for <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&amp;'a R</a><div class="where">where
R: <a class="trait" href="trait.HeuristicFrequencyRank.html" title="trait memchr::arch::all::packedpair::HeuristicFrequencyRank">HeuristicFrequencyRank</a>,</div></h3></section></summary><div class="docblock"><p>This permits passing any implementation of <code>HeuristicFrequencyRank</code> as a
borrowed version of itself.</p>
</div><div class="impl-items"><section id="method.rank" class="method trait-impl"><a class="src rightside" href="../../../../src/memchr/arch/all/packedpair/mod.rs.html#335-337">Source</a><a href="#method.rank" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.rank" class="fn">rank</a>(&amp;self, byte: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../../../trait.impl/memchr/arch/all/packedpair/trait.HeuristicFrequencyRank.js" async></script></section></div></main></body></html>

View file

@ -0,0 +1,11 @@
<!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="An implementation of the Rabin-Karp substring search algorithm."><title>memchr::arch::all::rabinkarp - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="memchr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[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="../../../../memchr/index.html">memchr</a><span class="version">2.7.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module rabinkarp</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In memchr::<wbr>arch::<wbr>all</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="../../../index.html">memchr</a>::<wbr><a href="../../index.html">arch</a>::<wbr><a href="../index.html">all</a></span><h1>Module <span>rabinkarp</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../../src/memchr/arch/all/rabinkarp.rs.html#1-390">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An implementation of the <a href="https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm">Rabin-Karp substring search algorithm</a>.</p>
<p>Rabin-Karp works by creating a hash of the needle provided and then computing
a rolling hash for each needle sized window in the haystack. When the rolling
hash matches the hash of the needle, a byte-wise comparison is done to check
if a match exists. The worst case time complexity of Rabin-Karp is <code>O(m * n)</code> where <code>m ~ len(needle)</code> and <code>n ~ len(haystack)</code>. Its worst case space
complexity is constant.</p>
<p>The main utility of Rabin-Karp is that the searcher can be constructed very
quickly with very little memory. This makes it especially useful when searching
for small needles in small haystacks, as it might finish its search before a
beefier algorithm (like Two-Way) even starts.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::rabinkarp::Finder">Finder</a></div><div class="desc docblock-short">A forward substring searcher using the Rabin-Karp algorithm.</div></li><li><div class="item-name"><a class="struct" href="struct.FinderRev.html" title="struct memchr::arch::all::rabinkarp::FinderRev">Finder<wbr>Rev</a></div><div class="desc docblock-short">A reverse substring searcher using the Rabin-Karp algorithm.</div></li></ul></section></div></main></body></html>

View file

@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["Finder","FinderRev"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,2 @@
<!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="An implementation of the Shift-Or substring search algorithm."><title>memchr::arch::all::shiftor - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="memchr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[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="../../../../memchr/index.html">memchr</a><span class="version">2.7.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module shiftor</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In memchr::<wbr>arch::<wbr>all</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="../../../index.html">memchr</a>::<wbr><a href="../../index.html">arch</a>::<wbr><a href="../index.html">all</a></span><h1>Module <span>shiftor</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../../src/memchr/arch/all/shiftor.rs.html#1-89">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An implementation of the <a href="https://en.wikipedia.org/wiki/Bitap_algorithm">Shift-Or substring search algorithm</a>.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::shiftor::Finder">Finder</a></div><div class="desc docblock-short">A forward substring searcher using the Shift-Or algorithm.</div></li></ul></section></div></main></body></html>

View file

@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["Finder"]};

View file

@ -0,0 +1,24 @@
<!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="A forward substring searcher using the Shift-Or algorithm."><title>Finder in memchr::arch::all::shiftor - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="memchr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-044be391.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="../../../../memchr/index.html">memchr</a><span class="version">2.7.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Finder</a></h2><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.find" title="find">find</a></li><li><a href="#method.new" title="new">new</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Debug-for-Finder" title="Debug">Debug</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-Finder" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-Finder" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Finder" title="Send">Send</a></li><li><a href="#impl-Sync-for-Finder" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-Finder" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Finder" title="UnwindSafe">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" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow&#60;T&#62;">Borrow&#60;T&#62;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut&#60;T&#62;">BorrowMut&#60;T&#62;</a></li><li><a href="#impl-From%3CT%3E-for-T" title="From&#60;T&#62;">From&#60;T&#62;</a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into&#60;U&#62;">Into&#60;U&#62;</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom&#60;U&#62;">TryFrom&#60;U&#62;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto&#60;U&#62;">TryInto&#60;U&#62;</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In memchr::<wbr>arch::<wbr>all::<wbr>shiftor</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="../../../index.html">memchr</a>::<wbr><a href="../../index.html">arch</a>::<wbr><a href="../index.html">all</a>::<wbr><a href="index.html">shiftor</a></span><h1>Struct <span class="struct">Finder</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../../src/memchr/arch/all/shiftor.rs.html#20-23">Source</a> </span></div><pre class="rust item-decl"><code>pub struct Finder { <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>A forward substring searcher using the Shift-Or algorithm.</p>
</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-Finder" class="impl"><a class="src rightside" href="../../../../src/memchr/arch/all/shiftor.rs.html#25-75">Source</a><a href="#impl-Finder" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::shiftor::Finder">Finder</a></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/memchr/arch/all/shiftor.rs.html#32-46">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>(needle: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::shiftor::Finder">Finder</a>&gt;</h4></section></summary><div class="docblock"><p>Create a new Shift-Or forward searcher for the given <code>needle</code>.</p>
<p>The needle may be empty. The empty needle matches at every byte offset.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.find" class="method"><a class="src rightside" href="../../../../src/memchr/arch/all/shiftor.rs.html#61-74">Source</a><h4 class="code-header">pub fn <a href="#method.find" class="fn">find</a>(&amp;self, haystack: &amp;[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>&gt;</h4></section></summary><div class="docblock"><p>Return the first occurrence of the needle given to <code>Finder::new</code> in
the <code>haystack</code> given. If no such occurrence exists, then <code>None</code> is
returned.</p>
<p>Unlike most other substring search implementations in this crate, this
finder does not require passing the needle at search time. A match can
be determined without the needle at all since the required information
is already encoded into this finder at construction time.</p>
<p>The maximum value this can return is <code>haystack.len()</code>, which can only
occur when the needle and haystack both have length zero. Otherwise,
for non-empty haystacks, the maximum value is <code>haystack.len() - 1</code>.</p>
</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-Debug-for-Finder" class="impl"><a class="src rightside" href="../../../../src/memchr/arch/all/shiftor.rs.html#19">Source</a><a href="#impl-Debug-for-Finder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::shiftor::Finder">Finder</a></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/memchr/arch/all/shiftor.rs.html#19">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.84.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.84.1/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.84.1/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></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-Finder" class="impl"><a href="#impl-Freeze-for-Finder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::shiftor::Finder">Finder</a></h3></section><section id="impl-RefUnwindSafe-for-Finder" class="impl"><a href="#impl-RefUnwindSafe-for-Finder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::shiftor::Finder">Finder</a></h3></section><section id="impl-Send-for-Finder" class="impl"><a href="#impl-Send-for-Finder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::shiftor::Finder">Finder</a></h3></section><section id="impl-Sync-for-Finder" class="impl"><a href="#impl-Sync-for-Finder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::shiftor::Finder">Finder</a></h3></section><section id="impl-Unpin-for-Finder" class="impl"><a href="#impl-Unpin-for-Finder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::shiftor::Finder">Finder</a></h3></section><section id="impl-UnwindSafe-for-Finder" class="impl"><a href="#impl-UnwindSafe-for-Finder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::shiftor::Finder">Finder</a></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.84.1/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.1/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.84.1/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.84.1/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.84.1/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.84.1/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.84.1/src/core/borrow.rs.html#209">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/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.84.1/src/core/borrow.rs.html#211">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.84.1/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.84.1/src/core/borrow.rs.html#217">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/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.84.1/src/core/borrow.rs.html#218">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.84.1/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.84.1/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&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</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="https://doc.rust-lang.org/1.84.1/src/core/convert/mod.rs.html#768">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; 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.84.1/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&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</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.84.1/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.84.1/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/1.84.1/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</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.84.1/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&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/convert/mod.rs.html#809">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.84.1/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.84.1/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.84.1/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</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.84.1/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&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/convert/mod.rs.html#794">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.1/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.84.1/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.84.1/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>

View file

@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"fn":["is_equal","is_equal_raw","is_prefix","is_suffix"],"mod":["memchr","packedpair","rabinkarp","shiftor","twoway"]};

View file

@ -0,0 +1,17 @@
<!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="An implementation of the Two-Way substring search algorithm."><title>memchr::arch::all::twoway - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.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-9960930a.css"><link rel="stylesheet" href="../../../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../../../" data-static-root-path="../../../../static.files/" data-current-crate="memchr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[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="../../../../memchr/index.html">memchr</a><span class="version">2.7.4</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module twoway</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In memchr::<wbr>arch::<wbr>all</a></h2></div></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"><span class="rustdoc-breadcrumbs"><a href="../../../index.html">memchr</a>::<wbr><a href="../../index.html">arch</a>::<wbr><a href="../index.html">all</a></span><h1>Module <span>twoway</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../../src/memchr/arch/all/twoway.rs.html#1-877">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An implementation of the <a href="https://en.wikipedia.org/wiki/Two-way_string-matching_algorithm">Two-Way substring search algorithm</a>.</p>
<p><a href="struct.Finder.html" title="struct memchr::arch::all::twoway::Finder"><code>Finder</code></a> can be built for forward searches, while <a href="struct.FinderRev.html" title="struct memchr::arch::all::twoway::FinderRev"><code>FinderRev</code></a> can be built
for reverse searches.</p>
<p>Two-Way makes for a nice general purpose substring search algorithm because of
its time and space complexity properties. It also performs well in practice.
Namely, with <code>m = len(needle)</code> and <code>n = len(haystack)</code>, Two-Way takes <code>O(m)</code>
time to create a finder, <code>O(1)</code> space and <code>O(n)</code> search time. In other words,
the preprocessing step is quick, doesnt require any heap memory and the worst
case search time is guaranteed to be linear in the haystack regardless of the
size of the needle.</p>
<p>While vector algorithms will usually beat Two-Way handedly, vector algorithms
also usually have pathological or edge cases that are better handled by Two-Way.
Moreover, not all targets support vector algorithms or implementations for them
simply may not exist yet.</p>
<p>Two-Way can be found in the <code>memmem</code> implementations in at least <a href="https://www.gnu.org/software/libc/">GNU libc</a> and
<a href="https://www.musl-libc.org/">musl</a>.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::twoway::Finder">Finder</a></div><div class="desc docblock-short">A forward substring searcher that uses the Two-Way algorithm.</div></li><li><div class="item-name"><a class="struct" href="struct.FinderRev.html" title="struct memchr::arch::all::twoway::FinderRev">Finder<wbr>Rev</a></div><div class="desc docblock-short">A reverse substring searcher that uses the Two-Way algorithm.</div></li></ul></section></div></main></body></html>

View file

@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["Finder","FinderRev"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long