mirror of
https://github.com/NotAShelf/mpvrc.git
synced 2026-04-18 08:39:53 +00:00
deploy: de38ae62916547ad097c066f94a32e9ba7790eeb
This commit is contained in:
commit
9a86359447
28502 changed files with 1261284 additions and 0 deletions
1
memchr/all.html
Normal file
1
memchr/all.html
Normal file
File diff suppressed because one or more lines are too long
13
memchr/arch/all/fn.is_equal.html
Normal file
13
memchr/arch/all/fn.is_equal.html
Normal 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: &[<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.u8.html">u8</a>]) -> <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 <= i < 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, you’ll 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 platform’s <code>libc</code> which might not be inlineable
|
||||
or have other overhead. This routine isn’t guaranteed to be a win, but it
|
||||
might be in some cases.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
28
memchr/arch/all/fn.is_equal_raw.html
Normal file
28
memchr/arch/all/fn.is_equal_raw.html
Normal 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>) -> <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 <= i < 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, you’ll 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 platform’s <code>libc</code> which might not be inlineable
|
||||
or have other overhead. This routine isn’t 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>
|
||||
8
memchr/arch/all/fn.is_prefix.html
Normal file
8
memchr/arch/all/fn.is_prefix.html
Normal 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: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>], needle: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <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, you’ll 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>
|
||||
8
memchr/arch/all/fn.is_suffix.html
Normal file
8
memchr/arch/all/fn.is_suffix.html
Normal 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: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>], needle: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <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, you’ll 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>
|
||||
5
memchr/arch/all/index.html
Normal file
5
memchr/arch/all/index.html
Normal 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>
|
||||
20
memchr/arch/all/memchr/index.html
Normal file
20
memchr/arch/all/memchr/index.html
Normal 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 it’s
|
||||
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>
|
||||
1
memchr/arch/all/memchr/sidebar-items.js
Normal file
1
memchr/arch/all/memchr/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["One","OneIter","Three","ThreeIter","Two","TwoIter"]};
|
||||
95
memchr/arch/all/memchr/struct.One.html
Normal file
95
memchr/arch/all/memchr/struct.One.html
Normal file
File diff suppressed because one or more lines are too long
235
memchr/arch/all/memchr/struct.OneIter.html
Normal file
235
memchr/arch/all/memchr/struct.OneIter.html
Normal file
File diff suppressed because one or more lines are too long
79
memchr/arch/all/memchr/struct.Three.html
Normal file
79
memchr/arch/all/memchr/struct.Three.html
Normal file
File diff suppressed because one or more lines are too long
236
memchr/arch/all/memchr/struct.ThreeIter.html
Normal file
236
memchr/arch/all/memchr/struct.ThreeIter.html
Normal file
File diff suppressed because one or more lines are too long
79
memchr/arch/all/memchr/struct.Two.html
Normal file
79
memchr/arch/all/memchr/struct.Two.html
Normal file
File diff suppressed because one or more lines are too long
236
memchr/arch/all/memchr/struct.TwoIter.html
Normal file
236
memchr/arch/all/memchr/struct.TwoIter.html
Normal file
File diff suppressed because one or more lines are too long
10
memchr/arch/all/packedpair/index.html
Normal file
10
memchr/arch/all/packedpair/index.html
Normal 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 doesn’t 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>
|
||||
1
memchr/arch/all/packedpair/sidebar-items.js
Normal file
1
memchr/arch/all/packedpair/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["Finder","Pair"],"trait":["HeuristicFrequencyRank"]};
|
||||
37
memchr/arch/all/packedpair/struct.Finder.html
Normal file
37
memchr/arch/all/packedpair/struct.Finder.html
Normal file
File diff suppressed because one or more lines are too long
59
memchr/arch/all/packedpair/struct.Pair.html
Normal file
59
memchr/arch/all/packedpair/struct.Pair.html
Normal file
File diff suppressed because one or more lines are too long
67
memchr/arch/all/packedpair/trait.HeuristicFrequencyRank.html
Normal file
67
memchr/arch/all/packedpair/trait.HeuristicFrequencyRank.html
Normal 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="&'a R">&'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>(&self, byte: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>) -> <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">&</span><span class="self">self</span>, byte: u8) -> 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>(&self, byte: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>) -> <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<'a, R> <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">&'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>(&self, byte: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>) -> <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>
|
||||
11
memchr/arch/all/rabinkarp/index.html
Normal file
11
memchr/arch/all/rabinkarp/index.html
Normal 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>
|
||||
1
memchr/arch/all/rabinkarp/sidebar-items.js
Normal file
1
memchr/arch/all/rabinkarp/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["Finder","FinderRev"]};
|
||||
63
memchr/arch/all/rabinkarp/struct.Finder.html
Normal file
63
memchr/arch/all/rabinkarp/struct.Finder.html
Normal file
File diff suppressed because one or more lines are too long
52
memchr/arch/all/rabinkarp/struct.FinderRev.html
Normal file
52
memchr/arch/all/rabinkarp/struct.FinderRev.html
Normal file
File diff suppressed because one or more lines are too long
2
memchr/arch/all/shiftor/index.html
Normal file
2
memchr/arch/all/shiftor/index.html
Normal 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>
|
||||
1
memchr/arch/all/shiftor/sidebar-items.js
Normal file
1
memchr/arch/all/shiftor/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["Finder"]};
|
||||
24
memchr/arch/all/shiftor/struct.Finder.html
Normal file
24
memchr/arch/all/shiftor/struct.Finder.html
Normal 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<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T" title="From<T>">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into<U>">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom<U>">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto<U>">TryInto<U></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: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.Finder.html" title="struct memchr::arch::all::shiftor::Finder">Finder</a>></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>(&self, haystack: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></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>(&self, f: &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><'_>) -> <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<T> <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>(&self) -> <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<T> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.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>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.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<T> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.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>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.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<T> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" 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) -> 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<T, 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><U> 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><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.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) -> 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><T> 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<T, 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><U> 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><T>,</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) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<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'>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<T, U> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
|
||||
U: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" 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> = <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><T>>::<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) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<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'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>
|
||||
1
memchr/arch/all/sidebar-items.js
Normal file
1
memchr/arch/all/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"fn":["is_equal","is_equal_raw","is_prefix","is_suffix"],"mod":["memchr","packedpair","rabinkarp","shiftor","twoway"]};
|
||||
17
memchr/arch/all/twoway/index.html
Normal file
17
memchr/arch/all/twoway/index.html
Normal 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, doesn’t 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>
|
||||
1
memchr/arch/all/twoway/sidebar-items.js
Normal file
1
memchr/arch/all/twoway/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["Finder","FinderRev"]};
|
||||
23
memchr/arch/all/twoway/struct.Finder.html
Normal file
23
memchr/arch/all/twoway/struct.Finder.html
Normal file
File diff suppressed because one or more lines are too long
23
memchr/arch/all/twoway/struct.FinderRev.html
Normal file
23
memchr/arch/all/twoway/struct.FinderRev.html
Normal file
File diff suppressed because one or more lines are too long
4
memchr/arch/index.html
Normal file
4
memchr/arch/index.html
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<!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 module with low-level architecture dependent routines."><title>memchr::arch - 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 arch</a></h2><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate memchr</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></span><h1>Module <span>arch</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/mod.rs.html#1-16">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A module with low-level architecture dependent routines.</p>
|
||||
<p>These routines are useful as primitives for tasks not covered by the higher
|
||||
level crate API.</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="all/index.html" title="mod memchr::arch::all">all</a></div><div class="desc docblock-short">Contains architecture independent routines.</div></li><li><div class="item-name"><a class="mod" href="x86_64/index.html" title="mod memchr::arch::x86_64">x86_64</a></div><div class="desc docblock-short">Vector algorithms for the <code>x86_64</code> target.</div></li></ul></section></div></main></body></html>
|
||||
1
memchr/arch/sidebar-items.js
Normal file
1
memchr/arch/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"mod":["all","x86_64"]};
|
||||
2
memchr/arch/x86_64/avx2/index.html
Normal file
2
memchr/arch/x86_64/avx2/index.html
Normal 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="Algorithms for the `x86_64` target using 256-bit vectors via AVX2."><title>memchr::arch::x86_64::avx2 - 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 avx2</a></h2><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In memchr::<wbr>arch::<wbr>x86_<wbr>64</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">x86_64</a></span><h1>Module <span>avx2</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/x86_64/avx2/mod.rs.html#1-6">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Algorithms for the <code>x86_64</code> target using 256-bit vectors via AVX2.</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::x86_64::avx2::memchr">memchr</a></div><div class="desc docblock-short">This module defines 256-bit vector 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::x86_64::avx2::packedpair">packedpair</a></div><div class="desc docblock-short">A 256-bit vector implementation of the “packed pair” SIMD algorithm.</div></li></ul></section></div></main></body></html>
|
||||
17
memchr/arch/x86_64/avx2/memchr/index.html
Normal file
17
memchr/arch/x86_64/avx2/memchr/index.html
Normal 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="This module defines 256-bit vector implementations of `memchr` and friends."><title>memchr::arch::x86_64::avx2::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>x86_<wbr>64::<wbr>avx2</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">x86_64</a>::<wbr><a href="../index.html">avx2</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/x86_64/avx2/memchr.rs.html#1-1352">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This module defines 256-bit vector 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::x86_64::avx2::memchr::One"><code>One</code></a>, <a href="struct.Two.html" title="struct memchr::arch::x86_64::avx2::memchr::Two"><code>Two</code></a> and <a href="struct.Three.html" title="struct memchr::arch::x86_64::avx2::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 much faster than scalar routines accomplishing the same task.</p>
|
||||
<p>The <code>One</code> searcher also provides a <a href="struct.One.html#method.count" title="method memchr::arch::x86_64::avx2::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::x86_64::avx2::memchr::One::find"><code>One::find</code></a> repeatedly. (<a href="struct.OneIter.html" title="struct memchr::arch::x86_64::avx2::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 it’s
|
||||
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::x86_64::avx2::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::x86_64::avx2::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::x86_64::avx2::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::x86_64::avx2::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::x86_64::avx2::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::x86_64::avx2::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>
|
||||
1
memchr/arch/x86_64/avx2/memchr/sidebar-items.js
Normal file
1
memchr/arch/x86_64/avx2/memchr/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["One","OneIter","Three","ThreeIter","Two","TwoIter"]};
|
||||
116
memchr/arch/x86_64/avx2/memchr/struct.One.html
Normal file
116
memchr/arch/x86_64/avx2/memchr/struct.One.html
Normal file
File diff suppressed because one or more lines are too long
235
memchr/arch/x86_64/avx2/memchr/struct.OneIter.html
Normal file
235
memchr/arch/x86_64/avx2/memchr/struct.OneIter.html
Normal file
File diff suppressed because one or more lines are too long
99
memchr/arch/x86_64/avx2/memchr/struct.Three.html
Normal file
99
memchr/arch/x86_64/avx2/memchr/struct.Three.html
Normal file
File diff suppressed because one or more lines are too long
236
memchr/arch/x86_64/avx2/memchr/struct.ThreeIter.html
Normal file
236
memchr/arch/x86_64/avx2/memchr/struct.ThreeIter.html
Normal file
File diff suppressed because one or more lines are too long
99
memchr/arch/x86_64/avx2/memchr/struct.Two.html
Normal file
99
memchr/arch/x86_64/avx2/memchr/struct.Two.html
Normal file
File diff suppressed because one or more lines are too long
236
memchr/arch/x86_64/avx2/memchr/struct.TwoIter.html
Normal file
236
memchr/arch/x86_64/avx2/memchr/struct.TwoIter.html
Normal file
File diff suppressed because one or more lines are too long
5
memchr/arch/x86_64/avx2/packedpair/index.html
Normal file
5
memchr/arch/x86_64/avx2/packedpair/index.html
Normal 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="A 256-bit vector implementation of the “packed pair” SIMD algorithm."><title>memchr::arch::x86_64::avx2::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></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In memchr::<wbr>arch::<wbr>x86_<wbr>64::<wbr>avx2</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">x86_64</a>::<wbr><a href="../index.html">avx2</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/x86_64/avx2/packedpair.rs.html#1-272">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A 256-bit vector implementation of the “packed pair” SIMD 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.</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::x86_64::avx2::packedpair::Finder">Finder</a></div><div class="desc docblock-short">A “packed pair” finder that uses 256-bit vector operations.</div></li></ul></section></div></main></body></html>
|
||||
1
memchr/arch/x86_64/avx2/packedpair/sidebar-items.js
Normal file
1
memchr/arch/x86_64/avx2/packedpair/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["Finder"]};
|
||||
57
memchr/arch/x86_64/avx2/packedpair/struct.Finder.html
Normal file
57
memchr/arch/x86_64/avx2/packedpair/struct.Finder.html
Normal file
File diff suppressed because one or more lines are too long
1
memchr/arch/x86_64/avx2/sidebar-items.js
Normal file
1
memchr/arch/x86_64/avx2/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"mod":["memchr","packedpair"]};
|
||||
2
memchr/arch/x86_64/index.html
Normal file
2
memchr/arch/x86_64/index.html
Normal 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="Vector algorithms for the `x86_64` target."><title>memchr::arch::x86_64 - 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 x86_64</a></h2><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</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>x86_64</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/x86_64/mod.rs.html#1-8">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Vector algorithms for the <code>x86_64</code> target.</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="avx2/index.html" title="mod memchr::arch::x86_64::avx2">avx2</a></div><div class="desc docblock-short">Algorithms for the <code>x86_64</code> target using 256-bit vectors via AVX2.</div></li><li><div class="item-name"><a class="mod" href="sse2/index.html" title="mod memchr::arch::x86_64::sse2">sse2</a></div><div class="desc docblock-short">Algorithms for the <code>x86_64</code> target using 128-bit vectors via SSE2.</div></li></ul></section></div></main></body></html>
|
||||
1
memchr/arch/x86_64/sidebar-items.js
Normal file
1
memchr/arch/x86_64/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"mod":["avx2","sse2"]};
|
||||
2
memchr/arch/x86_64/sse2/index.html
Normal file
2
memchr/arch/x86_64/sse2/index.html
Normal 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="Algorithms for the `x86_64` target using 128-bit vectors via SSE2."><title>memchr::arch::x86_64::sse2 - 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 sse2</a></h2><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In memchr::<wbr>arch::<wbr>x86_<wbr>64</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">x86_64</a></span><h1>Module <span>sse2</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/x86_64/sse2/mod.rs.html#1-6">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Algorithms for the <code>x86_64</code> target using 128-bit vectors via SSE2.</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::x86_64::sse2::memchr">memchr</a></div><div class="desc docblock-short">This module defines 128-bit vector 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::x86_64::sse2::packedpair">packedpair</a></div><div class="desc docblock-short">A 128-bit vector implementation of the “packed pair” SIMD algorithm.</div></li></ul></section></div></main></body></html>
|
||||
17
memchr/arch/x86_64/sse2/memchr/index.html
Normal file
17
memchr/arch/x86_64/sse2/memchr/index.html
Normal 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="This module defines 128-bit vector implementations of `memchr` and friends."><title>memchr::arch::x86_64::sse2::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>x86_<wbr>64::<wbr>sse2</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">x86_64</a>::<wbr><a href="../index.html">sse2</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/x86_64/sse2/memchr.rs.html#1-1077">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This module defines 128-bit vector 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::x86_64::sse2::memchr::One"><code>One</code></a>, <a href="struct.Two.html" title="struct memchr::arch::x86_64::sse2::memchr::Two"><code>Two</code></a> and <a href="struct.Three.html" title="struct memchr::arch::x86_64::sse2::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 much faster than scalar routines accomplishing the same task.</p>
|
||||
<p>The <code>One</code> searcher also provides a <a href="struct.One.html#method.count" title="method memchr::arch::x86_64::sse2::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::x86_64::sse2::memchr::One::find"><code>One::find</code></a> repeatedly. (<a href="struct.OneIter.html" title="struct memchr::arch::x86_64::sse2::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 it’s
|
||||
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::x86_64::sse2::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::x86_64::sse2::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::x86_64::sse2::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::x86_64::sse2::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::x86_64::sse2::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::x86_64::sse2::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>
|
||||
1
memchr/arch/x86_64/sse2/memchr/sidebar-items.js
Normal file
1
memchr/arch/x86_64/sse2/memchr/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["One","OneIter","Three","ThreeIter","Two","TwoIter"]};
|
||||
115
memchr/arch/x86_64/sse2/memchr/struct.One.html
Normal file
115
memchr/arch/x86_64/sse2/memchr/struct.One.html
Normal file
File diff suppressed because one or more lines are too long
235
memchr/arch/x86_64/sse2/memchr/struct.OneIter.html
Normal file
235
memchr/arch/x86_64/sse2/memchr/struct.OneIter.html
Normal file
File diff suppressed because one or more lines are too long
98
memchr/arch/x86_64/sse2/memchr/struct.Three.html
Normal file
98
memchr/arch/x86_64/sse2/memchr/struct.Three.html
Normal file
File diff suppressed because one or more lines are too long
236
memchr/arch/x86_64/sse2/memchr/struct.ThreeIter.html
Normal file
236
memchr/arch/x86_64/sse2/memchr/struct.ThreeIter.html
Normal file
File diff suppressed because one or more lines are too long
98
memchr/arch/x86_64/sse2/memchr/struct.Two.html
Normal file
98
memchr/arch/x86_64/sse2/memchr/struct.Two.html
Normal file
File diff suppressed because one or more lines are too long
236
memchr/arch/x86_64/sse2/memchr/struct.TwoIter.html
Normal file
236
memchr/arch/x86_64/sse2/memchr/struct.TwoIter.html
Normal file
File diff suppressed because one or more lines are too long
5
memchr/arch/x86_64/sse2/packedpair/index.html
Normal file
5
memchr/arch/x86_64/sse2/packedpair/index.html
Normal 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="A 128-bit vector implementation of the “packed pair” SIMD algorithm."><title>memchr::arch::x86_64::sse2::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></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In memchr::<wbr>arch::<wbr>x86_<wbr>64::<wbr>sse2</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">x86_64</a>::<wbr><a href="../index.html">sse2</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/x86_64/sse2/packedpair.rs.html#1-232">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A 128-bit vector implementation of the “packed pair” SIMD 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.</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::x86_64::sse2::packedpair::Finder">Finder</a></div><div class="desc docblock-short">A “packed pair” finder that uses 128-bit vector operations.</div></li></ul></section></div></main></body></html>
|
||||
1
memchr/arch/x86_64/sse2/packedpair/sidebar-items.js
Normal file
1
memchr/arch/x86_64/sse2/packedpair/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["Finder"]};
|
||||
57
memchr/arch/x86_64/sse2/packedpair/struct.Finder.html
Normal file
57
memchr/arch/x86_64/sse2/packedpair/struct.Finder.html
Normal file
File diff suppressed because one or more lines are too long
1
memchr/arch/x86_64/sse2/sidebar-items.js
Normal file
1
memchr/arch/x86_64/sse2/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"mod":["memchr","packedpair"]};
|
||||
16
memchr/fn.memchr.html
Normal file
16
memchr/fn.memchr.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<!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="Search for the first occurrence of a byte in a slice."><title>memchr in 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 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="#">memchr</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate memchr</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></span><h1>Function <span class="fn">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/memchr.rs.html#27-35">Source</a> </span></div><pre class="rust item-decl"><code>pub fn memchr(needle: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>, haystack: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Search for the first occurrence of a byte in a slice.</p>
|
||||
<p>This returns the index corresponding to the first occurrence of <code>needle</code> in
|
||||
<code>haystack</code>, or <code>None</code> if one is not found. If an index is returned, it is
|
||||
guaranteed to be less than <code>haystack.len()</code>.</p>
|
||||
<p>While this is semantically the same as something like
|
||||
<code>haystack.iter().position(|&b| b == needle)</code>, this routine will attempt to
|
||||
use highly optimized vector operations that can be an order of magnitude
|
||||
faster (or more).</p>
|
||||
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
||||
<p>This shows how to find the first position of a byte in a byte string.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memchr;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"the quick brown fox"</span>;
|
||||
<span class="macro">assert_eq!</span>(memchr(<span class="string">b'k'</span>, haystack), <span class="prelude-val">Some</span>(<span class="number">8</span>));</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
17
memchr/fn.memchr2.html
Normal file
17
memchr/fn.memchr2.html
Normal 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="Search for the first occurrence of two possible bytes in a haystack."><title>memchr2 in 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 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="#">memchr2</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate memchr</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></span><h1>Function <span class="fn">memchr2</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/memchr.rs.html#92-100">Source</a> </span></div><pre class="rust item-decl"><code>pub fn memchr2(needle1: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>, needle2: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>, haystack: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Search for the first occurrence of two possible bytes in a haystack.</p>
|
||||
<p>This returns the index corresponding to the first occurrence of one of the
|
||||
needle bytes in <code>haystack</code>, or <code>None</code> if one is not found. If an index is
|
||||
returned, it is guaranteed to be less than <code>haystack.len()</code>.</p>
|
||||
<p>While this is semantically the same as something like
|
||||
<code>haystack.iter().position(|&b| b == needle1 || b == needle2)</code>, this routine
|
||||
will attempt to use highly optimized vector operations that can be an order
|
||||
of magnitude faster (or more).</p>
|
||||
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
||||
<p>This shows how to find the first position of one of two possible bytes in a
|
||||
haystack.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memchr2;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"the quick brown fox"</span>;
|
||||
<span class="macro">assert_eq!</span>(memchr2(<span class="string">b'k'</span>, <span class="string">b'q'</span>, haystack), <span class="prelude-val">Some</span>(<span class="number">4</span>));</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
8
memchr/fn.memchr2_iter.html
Normal file
8
memchr/fn.memchr2_iter.html
Normal 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 an iterator over all occurrences of the needles in a haystack."><title>memchr2_iter in 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 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"><div id="rustdoc-modnav"></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></span><h1>Function <span class="fn">memchr2_iter</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/memchr.rs.html#232-238">Source</a> </span></div><pre class="rust item-decl"><code>pub fn memchr2_iter<'h>(
|
||||
needle1: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
needle2: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
haystack: &'h [<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>],
|
||||
) -> <a class="struct" href="struct.Memchr2.html" title="struct memchr::Memchr2">Memchr2</a><'h> <a href="#" class="tooltip" data-notable-ty="Memchr2<'h>">ⓘ</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns an iterator over all occurrences of the needles in a haystack.</p>
|
||||
<p>The iterator returned implements <code>DoubleEndedIterator</code>. This means it
|
||||
can also be used to find occurrences in reverse order.</p>
|
||||
</div></details><script type="text/json" id="notable-traits-data">{"Memchr2<'h>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Memchr2.html\" title=\"struct memchr::Memchr2\">Memchr2</a><'h></code></h3><pre><code><div class=\"where\">impl<'h> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.Memchr2.html\" title=\"struct memchr::Memchr2\">Memchr2</a><'h></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.84.1/std/primitive.usize.html\">usize</a>;</div>"}</script></section></div></main></body></html>
|
||||
22
memchr/fn.memchr3.html
Normal file
22
memchr/fn.memchr3.html
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<!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="Search for the first occurrence of three possible bytes in a haystack."><title>memchr3 in 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 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="#">memchr3</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate memchr</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></span><h1>Function <span class="fn">memchr3</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/memchr.rs.html#158-171">Source</a> </span></div><pre class="rust item-decl"><code>pub fn memchr3(
|
||||
needle1: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
needle2: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
needle3: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
haystack: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>],
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Search for the first occurrence of three possible bytes in a haystack.</p>
|
||||
<p>This returns the index corresponding to the first occurrence of one of the
|
||||
needle bytes in <code>haystack</code>, or <code>None</code> if one is not found. If an index is
|
||||
returned, it is guaranteed to be less than <code>haystack.len()</code>.</p>
|
||||
<p>While this is semantically the same as something like
|
||||
<code>haystack.iter().position(|&b| b == needle1 || b == needle2 || b == needle3)</code>,
|
||||
this routine will attempt to use highly optimized vector operations that
|
||||
can be an order of magnitude faster (or more).</p>
|
||||
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
||||
<p>This shows how to find the first position of one of three possible bytes in
|
||||
a haystack.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memchr3;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"the quick brown fox"</span>;
|
||||
<span class="macro">assert_eq!</span>(memchr3(<span class="string">b'k'</span>, <span class="string">b'q'</span>, <span class="string">b'u'</span>, haystack), <span class="prelude-val">Some</span>(<span class="number">4</span>));</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
9
memchr/fn.memchr3_iter.html
Normal file
9
memchr/fn.memchr3_iter.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<!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 an iterator over all occurrences of the needles in a haystack."><title>memchr3_iter in 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 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"><div id="rustdoc-modnav"></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></span><h1>Function <span class="fn">memchr3_iter</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/memchr.rs.html#256-263">Source</a> </span></div><pre class="rust item-decl"><code>pub fn memchr3_iter<'h>(
|
||||
needle1: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
needle2: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
needle3: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
haystack: &'h [<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>],
|
||||
) -> <a class="struct" href="struct.Memchr3.html" title="struct memchr::Memchr3">Memchr3</a><'h> <a href="#" class="tooltip" data-notable-ty="Memchr3<'h>">ⓘ</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns an iterator over all occurrences of the needles in a haystack.</p>
|
||||
<p>The iterator returned implements <code>DoubleEndedIterator</code>. This means it
|
||||
can also be used to find occurrences in reverse order.</p>
|
||||
</div></details><script type="text/json" id="notable-traits-data">{"Memchr3<'h>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Memchr3.html\" title=\"struct memchr::Memchr3\">Memchr3</a><'h></code></h3><pre><code><div class=\"where\">impl<'h> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.Memchr3.html\" title=\"struct memchr::Memchr3\">Memchr3</a><'h></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.84.1/std/primitive.usize.html\">usize</a>;</div>"}</script></section></div></main></body></html>
|
||||
4
memchr/fn.memchr_iter.html
Normal file
4
memchr/fn.memchr_iter.html
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<!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 an iterator over all occurrences of the needle in a haystack."><title>memchr_iter in 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 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"><div id="rustdoc-modnav"></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></span><h1>Function <span class="fn">memchr_iter</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/memchr.rs.html#216-218">Source</a> </span></div><pre class="rust item-decl"><code>pub fn memchr_iter<'h>(needle: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>, haystack: &'h [<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <a class="struct" href="struct.Memchr.html" title="struct memchr::Memchr">Memchr</a><'h> <a href="#" class="tooltip" data-notable-ty="Memchr<'h>">ⓘ</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns an iterator over all occurrences of the needle in a haystack.</p>
|
||||
<p>The iterator returned implements <code>DoubleEndedIterator</code>. This means it
|
||||
can also be used to find occurrences in reverse order.</p>
|
||||
</div></details><script type="text/json" id="notable-traits-data">{"Memchr<'h>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.Memchr.html\" title=\"struct memchr::Memchr\">Memchr</a><'h></code></h3><pre><code><div class=\"where\">impl<'h> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.Memchr.html\" title=\"struct memchr::Memchr\">Memchr</a><'h></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.84.1/std/primitive.usize.html\">usize</a>;</div>"}</script></section></div></main></body></html>
|
||||
16
memchr/fn.memrchr.html
Normal file
16
memchr/fn.memrchr.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<!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="Search for the last occurrence of a byte in a slice."><title>memrchr in 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 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="#">memrchr</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate memchr</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></span><h1>Function <span class="fn">memrchr</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/memchr.rs.html#59-67">Source</a> </span></div><pre class="rust item-decl"><code>pub fn memrchr(needle: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>, haystack: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Search for the last occurrence of a byte in a slice.</p>
|
||||
<p>This returns the index corresponding to the last occurrence of <code>needle</code> in
|
||||
<code>haystack</code>, or <code>None</code> if one is not found. If an index is returned, it is
|
||||
guaranteed to be less than <code>haystack.len()</code>.</p>
|
||||
<p>While this is semantically the same as something like
|
||||
<code>haystack.iter().rposition(|&b| b == needle)</code>, this routine will attempt to
|
||||
use highly optimized vector operations that can be an order of magnitude
|
||||
faster (or more).</p>
|
||||
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
||||
<p>This shows how to find the last position of a byte in a byte string.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memrchr;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"the quick brown fox"</span>;
|
||||
<span class="macro">assert_eq!</span>(memrchr(<span class="string">b'o'</span>, haystack), <span class="prelude-val">Some</span>(<span class="number">17</span>));</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
17
memchr/fn.memrchr2.html
Normal file
17
memchr/fn.memrchr2.html
Normal 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="Search for the last occurrence of two possible bytes in a haystack."><title>memrchr2 in 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 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="#">memrchr2</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate memchr</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></span><h1>Function <span class="fn">memrchr2</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/memchr.rs.html#125-133">Source</a> </span></div><pre class="rust item-decl"><code>pub fn memrchr2(needle1: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>, needle2: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>, haystack: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Search for the last occurrence of two possible bytes in a haystack.</p>
|
||||
<p>This returns the index corresponding to the last occurrence of one of the
|
||||
needle bytes in <code>haystack</code>, or <code>None</code> if one is not found. If an index is
|
||||
returned, it is guaranteed to be less than <code>haystack.len()</code>.</p>
|
||||
<p>While this is semantically the same as something like
|
||||
<code>haystack.iter().rposition(|&b| b == needle1 || b == needle2)</code>, this
|
||||
routine will attempt to use highly optimized vector operations that can be
|
||||
an order of magnitude faster (or more).</p>
|
||||
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
||||
<p>This shows how to find the last position of one of two possible bytes in a
|
||||
haystack.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memrchr2;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"the quick brown fox"</span>;
|
||||
<span class="macro">assert_eq!</span>(memrchr2(<span class="string">b'k'</span>, <span class="string">b'o'</span>, haystack), <span class="prelude-val">Some</span>(<span class="number">17</span>));</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
7
memchr/fn.memrchr2_iter.html
Normal file
7
memchr/fn.memrchr2_iter.html
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<!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 an iterator over all occurrences of the needles in a haystack, in reverse."><title>memrchr2_iter in 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 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"><div id="rustdoc-modnav"></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></span><h1>Function <span class="fn">memrchr2_iter</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/memchr.rs.html#243-249">Source</a> </span></div><pre class="rust item-decl"><code>pub fn memrchr2_iter(
|
||||
needle1: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
needle2: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
haystack: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>],
|
||||
) -> <a class="struct" href="https://doc.rust-lang.org/1.84.1/core/iter/adapters/rev/struct.Rev.html" title="struct core::iter::adapters::rev::Rev">Rev</a><<a class="struct" href="struct.Memchr2.html" title="struct memchr::Memchr2">Memchr2</a><'_>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns an iterator over all occurrences of the needles in a haystack, in
|
||||
reverse.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
22
memchr/fn.memrchr3.html
Normal file
22
memchr/fn.memrchr3.html
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<!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="Search for the last occurrence of three possible bytes in a haystack."><title>memrchr3 in 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 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="#">memrchr3</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate memchr</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></span><h1>Function <span class="fn">memrchr3</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/memchr.rs.html#196-209">Source</a> </span></div><pre class="rust item-decl"><code>pub fn memrchr3(
|
||||
needle1: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
needle2: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
needle3: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
haystack: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>],
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Search for the last occurrence of three possible bytes in a haystack.</p>
|
||||
<p>This returns the index corresponding to the last occurrence of one of the
|
||||
needle bytes in <code>haystack</code>, or <code>None</code> if one is not found. If an index is
|
||||
returned, it is guaranteed to be less than <code>haystack.len()</code>.</p>
|
||||
<p>While this is semantically the same as something like
|
||||
<code>haystack.iter().rposition(|&b| b == needle1 || b == needle2 || b == needle3)</code>,
|
||||
this routine will attempt to use highly optimized vector operations that
|
||||
can be an order of magnitude faster (or more).</p>
|
||||
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
||||
<p>This shows how to find the last position of one of three possible bytes in
|
||||
a haystack.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memrchr3;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"the quick brown fox"</span>;
|
||||
<span class="macro">assert_eq!</span>(memrchr3(<span class="string">b'k'</span>, <span class="string">b'o'</span>, <span class="string">b'n'</span>, haystack), <span class="prelude-val">Some</span>(<span class="number">17</span>));</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
8
memchr/fn.memrchr3_iter.html
Normal file
8
memchr/fn.memrchr3_iter.html
Normal 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 an iterator over all occurrences of the needles in a haystack, in reverse."><title>memrchr3_iter in 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 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"><div id="rustdoc-modnav"></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></span><h1>Function <span class="fn">memrchr3_iter</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/memchr.rs.html#268-275">Source</a> </span></div><pre class="rust item-decl"><code>pub fn memrchr3_iter(
|
||||
needle1: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
needle2: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
needle3: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>,
|
||||
haystack: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>],
|
||||
) -> <a class="struct" href="https://doc.rust-lang.org/1.84.1/core/iter/adapters/rev/struct.Rev.html" title="struct core::iter::adapters::rev::Rev">Rev</a><<a class="struct" href="struct.Memchr3.html" title="struct memchr::Memchr3">Memchr3</a><'_>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns an iterator over all occurrences of the needles in a haystack, in
|
||||
reverse.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
3
memchr/fn.memrchr_iter.html
Normal file
3
memchr/fn.memrchr_iter.html
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<!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 an iterator over all occurrences of the needle in a haystack, in reverse."><title>memrchr_iter in 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 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"><div id="rustdoc-modnav"></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></span><h1>Function <span class="fn">memrchr_iter</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/memchr.rs.html#223-225">Source</a> </span></div><pre class="rust item-decl"><code>pub fn memrchr_iter(needle: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>, haystack: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <a class="struct" href="https://doc.rust-lang.org/1.84.1/core/iter/adapters/rev/struct.Rev.html" title="struct core::iter::adapters::rev::Rev">Rev</a><<a class="struct" href="struct.Memchr.html" title="struct memchr::Memchr">Memchr</a><'_>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns an iterator over all occurrences of the needle in a haystack, in
|
||||
reverse.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
142
memchr/index.html
Normal file
142
memchr/index.html
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
<!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 library provides heavily optimized routines for string search primitives."><title>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="../crates.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 crate"><!--[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"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#overview" title="Overview">Overview</a></li><li><a href="#example-using-memchr" title="Example: using `memchr`">Example: using <code>memchr</code></a></li><li><a href="#example-matching-one-of-three-possible-bytes" title="Example: matching one of three possible bytes">Example: matching one of three possible bytes</a></li><li><a href="#example-iterating-over-substring-matches" title="Example: iterating over substring matches">Example: iterating over substring matches</a></li><li><a href="#example-repeating-a-search-for-the-same-needle" title="Example: repeating a search for the same needle">Example: repeating a search for the same needle</a></li><li><a href="#why-use-this-crate" title="Why use this crate?">Why use this crate?</a></li><li><a href="#crate-features" title="Crate features">Crate features</a></li></ul><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"></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"><h1>Crate <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/lib.rs.html#1-221">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This library provides heavily optimized routines for string search primitives.</p>
|
||||
<h2 id="overview"><a class="doc-anchor" href="#overview">§</a>Overview</h2>
|
||||
<p>This section gives a brief high level overview of what this crate offers.</p>
|
||||
<ul>
|
||||
<li>The top-level module provides routines for searching for 1, 2 or 3 bytes
|
||||
in the forward or reverse direction. When searching for more than one byte,
|
||||
positions are considered a match if the byte at that position matches any
|
||||
of the bytes.</li>
|
||||
<li>The <a href="memmem/index.html" title="mod memchr::memmem"><code>memmem</code></a> sub-module provides forward and reverse substring search
|
||||
routines.</li>
|
||||
</ul>
|
||||
<p>In all such cases, routines operate on <code>&[u8]</code> without regard to encoding. This
|
||||
is exactly what you want when searching either UTF-8 or arbitrary bytes.</p>
|
||||
<h2 id="example-using-memchr"><a class="doc-anchor" href="#example-using-memchr">§</a>Example: using <code>memchr</code></h2>
|
||||
<p>This example shows how to use <code>memchr</code> to find the first occurrence of <code>z</code> in
|
||||
a haystack:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memchr;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"foo bar baz quuz"</span>;
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">10</span>), memchr(<span class="string">b'z'</span>, haystack));</code></pre></div>
|
||||
<h2 id="example-matching-one-of-three-possible-bytes"><a class="doc-anchor" href="#example-matching-one-of-three-possible-bytes">§</a>Example: matching one of three possible bytes</h2>
|
||||
<p>This examples shows how to use <code>memrchr3</code> to find occurrences of <code>a</code>, <code>b</code> or
|
||||
<code>c</code>, starting at the end of the haystack.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memchr3_iter;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"xyzaxyzbxyzc"</span>;
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>it = memchr3_iter(<span class="string">b'a'</span>, <span class="string">b'b'</span>, <span class="string">b'c'</span>, haystack).rev();
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">11</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">7</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">3</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, it.next());</code></pre></div>
|
||||
<h2 id="example-iterating-over-substring-matches"><a class="doc-anchor" href="#example-iterating-over-substring-matches">§</a>Example: iterating over substring matches</h2>
|
||||
<p>This example shows how to use the <a href="memmem/index.html" title="mod memchr::memmem"><code>memmem</code></a> sub-module to find occurrences of
|
||||
a substring in a haystack.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memmem;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"foo bar foo baz foo"</span>;
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>it = memmem::find_iter(haystack, <span class="string">"foo"</span>);
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">0</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">8</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">16</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, it.next());</code></pre></div>
|
||||
<h2 id="example-repeating-a-search-for-the-same-needle"><a class="doc-anchor" href="#example-repeating-a-search-for-the-same-needle">§</a>Example: repeating a search for the same needle</h2>
|
||||
<p>It may be possible for the overhead of constructing a substring searcher to be
|
||||
measurable in some workloads. In cases where the same needle is used to search
|
||||
many haystacks, it is possible to do construction once and thus to avoid it for
|
||||
subsequent searches. This can be done with a <a href="memmem/struct.Finder.html" title="struct memchr::memmem::Finder"><code>memmem::Finder</code></a>:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memmem;
|
||||
|
||||
<span class="kw">let </span>finder = memmem::Finder::new(<span class="string">"foo"</span>);
|
||||
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">4</span>), finder.find(<span class="string">b"baz foo quux"</span>));
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, finder.find(<span class="string">b"quux baz bar"</span>));</code></pre></div>
|
||||
<h2 id="why-use-this-crate"><a class="doc-anchor" href="#why-use-this-crate">§</a>Why use this crate?</h2>
|
||||
<p>At first glance, the APIs provided by this crate might seem weird. Why provide
|
||||
a dedicated routine like <code>memchr</code> for something that could be implemented
|
||||
clearly and trivially in one line:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>memchr(needle: u8, haystack: <span class="kw-2">&</span>[u8]) -> <span class="prelude-ty">Option</span><usize> {
|
||||
haystack.iter().position(|<span class="kw-2">&</span>b| b == needle)
|
||||
}</code></pre></div>
|
||||
<p>Or similarly, why does this crate provide substring search routines when Rust’s
|
||||
core library already provides them?</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>search(haystack: <span class="kw-2">&</span>str, needle: <span class="kw-2">&</span>str) -> <span class="prelude-ty">Option</span><usize> {
|
||||
haystack.find(needle)
|
||||
}</code></pre></div>
|
||||
<p>The primary reason for both of them to exist is performance. When it comes to
|
||||
performance, at a high level at least, there are two primary ways to look at
|
||||
it:</p>
|
||||
<ul>
|
||||
<li><strong>Throughput</strong>: For this, think about it as, “given some very large haystack
|
||||
and a byte that never occurs in that haystack, how long does it take to
|
||||
search through it and determine that it, in fact, does not occur?”</li>
|
||||
<li><strong>Latency</strong>: For this, think about it as, “given a tiny haystack—just a
|
||||
few bytes—how long does it take to determine if a byte is in it?”</li>
|
||||
</ul>
|
||||
<p>The <code>memchr</code> routine in this crate has <em>slightly</em> worse latency than the
|
||||
solution presented above, however, its throughput can easily be over an
|
||||
order of magnitude faster. This is a good general purpose trade off to make.
|
||||
You rarely lose, but often gain big.</p>
|
||||
<p><strong>NOTE:</strong> The name <code>memchr</code> comes from the corresponding routine in <code>libc</code>. A
|
||||
key advantage of using this library is that its performance is not tied to its
|
||||
quality of implementation in the <code>libc</code> you happen to be using, which can vary
|
||||
greatly from platform to platform.</p>
|
||||
<p>But what about substring search? This one is a bit more complicated. The
|
||||
primary reason for its existence is still indeed performance, but it’s also
|
||||
useful because Rust’s core library doesn’t actually expose any substring
|
||||
search routine on arbitrary bytes. The only substring search routine that
|
||||
exists works exclusively on valid UTF-8.</p>
|
||||
<p>So if you have valid UTF-8, is there a reason to use this over the standard
|
||||
library substring search routine? Yes. This routine is faster on almost every
|
||||
metric, including latency. The natural question then, is why isn’t this
|
||||
implementation in the standard library, even if only for searching on UTF-8?
|
||||
The reason is that the implementation details for using SIMD in the standard
|
||||
library haven’t quite been worked out yet.</p>
|
||||
<p><strong>NOTE:</strong> Currently, only <code>x86_64</code>, <code>wasm32</code> and <code>aarch64</code> targets have vector
|
||||
accelerated implementations of <code>memchr</code> (and friends) and <code>memmem</code>.</p>
|
||||
<h2 id="crate-features"><a class="doc-anchor" href="#crate-features">§</a>Crate features</h2>
|
||||
<ul>
|
||||
<li><strong>std</strong> - When enabled (the default), this will permit features specific to
|
||||
the standard library. Currently, the only thing used from the standard library
|
||||
is runtime SIMD CPU feature detection. This means that this feature must be
|
||||
enabled to get AVX2 accelerated routines on <code>x86_64</code> targets without enabling
|
||||
the <code>avx2</code> feature at compile time, for example. When <code>std</code> is not enabled,
|
||||
this crate will still attempt to use SSE2 accelerated routines on <code>x86_64</code>. It
|
||||
will also use AVX2 accelerated routines when the <code>avx2</code> feature is enabled at
|
||||
compile time. In general, enable this feature if you can.</li>
|
||||
<li><strong>alloc</strong> - When enabled (the default), APIs in this crate requiring some
|
||||
kind of allocation will become available. For example, the
|
||||
<a href="memmem/struct.Finder.html#method.into_owned" title="method memchr::memmem::Finder::into_owned"><code>memmem::Finder::into_owned</code></a> API and the
|
||||
<a href="arch/all/shiftor/index.html" title="mod memchr::arch::all::shiftor"><code>arch::all::shiftor</code></a> substring search
|
||||
implementation. Otherwise, this crate is designed from the ground up to be
|
||||
usable in core-only contexts, so the <code>alloc</code> feature doesn’t add much
|
||||
currently. Notably, disabling <code>std</code> but enabling <code>alloc</code> will <strong>not</strong> result
|
||||
in the use of AVX2 on <code>x86_64</code> targets unless the <code>avx2</code> feature is enabled
|
||||
at compile time. (With <code>std</code> enabled, AVX2 can be used even without the <code>avx2</code>
|
||||
feature enabled at compile time by way of runtime CPU feature detection.)</li>
|
||||
<li><strong>logging</strong> - When enabled (disabled by default), the <code>log</code> crate is used
|
||||
to emit log messages about what kinds of <code>memchr</code> and <code>memmem</code> algorithms
|
||||
are used. Namely, both <code>memchr</code> and <code>memmem</code> have a number of different
|
||||
implementation choices depending on the target and CPU, and the log messages
|
||||
can help show what specific implementations are being used. Generally, this is
|
||||
useful for debugging performance issues.</li>
|
||||
<li><strong>libc</strong> - <strong>DEPRECATED</strong>. Previously, this enabled the use of the target’s
|
||||
<code>memchr</code> function from whatever <code>libc</code> was linked into the program. This
|
||||
feature is now a no-op because this crate’s implementation of <code>memchr</code> should
|
||||
now be sufficiently fast on a number of platforms that <code>libc</code> should no longer
|
||||
be needed. (This feature is somewhat of a holdover from this crate’s origins.
|
||||
Originally, this crate was literally just a safe wrapper function around the
|
||||
<code>memchr</code> function from <code>libc</code>.)</li>
|
||||
</ul>
|
||||
</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="arch/index.html" title="mod memchr::arch">arch</a></div><div class="desc docblock-short">A module with low-level architecture dependent routines.</div></li><li><div class="item-name"><a class="mod" href="memmem/index.html" title="mod memchr::memmem">memmem</a></div><div class="desc docblock-short">This module provides forward and reverse substring search routines.</div></li></ul><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.Memchr.html" title="struct memchr::Memchr">Memchr</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.Memchr2.html" title="struct memchr::Memchr2">Memchr2</a></div><div class="desc docblock-short">An iterator over all occurrences of two possible bytes in a haystack.</div></li><li><div class="item-name"><a class="struct" href="struct.Memchr3.html" title="struct memchr::Memchr3">Memchr3</a></div><div class="desc docblock-short">An iterator over all occurrences of three possible bytes in a haystack.</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.memchr.html" title="fn memchr::memchr">memchr</a></div><div class="desc docblock-short">Search for the first occurrence of a byte in a slice.</div></li><li><div class="item-name"><a class="fn" href="fn.memchr2.html" title="fn memchr::memchr2">memchr2</a></div><div class="desc docblock-short">Search for the first occurrence of two possible bytes in a haystack.</div></li><li><div class="item-name"><a class="fn" href="fn.memchr3.html" title="fn memchr::memchr3">memchr3</a></div><div class="desc docblock-short">Search for the first occurrence of three possible bytes in a haystack.</div></li><li><div class="item-name"><a class="fn" href="fn.memchr2_iter.html" title="fn memchr::memchr2_iter">memchr2_<wbr>iter</a></div><div class="desc docblock-short">Returns an iterator over all occurrences of the needles in a haystack.</div></li><li><div class="item-name"><a class="fn" href="fn.memchr3_iter.html" title="fn memchr::memchr3_iter">memchr3_<wbr>iter</a></div><div class="desc docblock-short">Returns an iterator over all occurrences of the needles in a haystack.</div></li><li><div class="item-name"><a class="fn" href="fn.memchr_iter.html" title="fn memchr::memchr_iter">memchr_<wbr>iter</a></div><div class="desc docblock-short">Returns an iterator over all occurrences of the needle in a haystack.</div></li><li><div class="item-name"><a class="fn" href="fn.memrchr.html" title="fn memchr::memrchr">memrchr</a></div><div class="desc docblock-short">Search for the last occurrence of a byte in a slice.</div></li><li><div class="item-name"><a class="fn" href="fn.memrchr2.html" title="fn memchr::memrchr2">memrchr2</a></div><div class="desc docblock-short">Search for the last occurrence of two possible bytes in a haystack.</div></li><li><div class="item-name"><a class="fn" href="fn.memrchr3.html" title="fn memchr::memrchr3">memrchr3</a></div><div class="desc docblock-short">Search for the last occurrence of three possible bytes in a haystack.</div></li><li><div class="item-name"><a class="fn" href="fn.memrchr2_iter.html" title="fn memchr::memrchr2_iter">memrchr2_<wbr>iter</a></div><div class="desc docblock-short">Returns an iterator over all occurrences of the needles in a haystack, in
|
||||
reverse.</div></li><li><div class="item-name"><a class="fn" href="fn.memrchr3_iter.html" title="fn memchr::memrchr3_iter">memrchr3_<wbr>iter</a></div><div class="desc docblock-short">Returns an iterator over all occurrences of the needles in a haystack, in
|
||||
reverse.</div></li><li><div class="item-name"><a class="fn" href="fn.memrchr_iter.html" title="fn memchr::memrchr_iter">memrchr_<wbr>iter</a></div><div class="desc docblock-short">Returns an iterator over all occurrences of the needle in a haystack, in
|
||||
reverse.</div></li></ul></section></div></main></body></html>
|
||||
11
memchr/memchr/fn.memchr.html
Normal file
11
memchr/memchr/fn.memchr.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/fn.memchr.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/fn.memchr.html">../../memchr/fn.memchr.html</a>...</p>
|
||||
<script>location.replace("../../memchr/fn.memchr.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/fn.memchr2.html
Normal file
11
memchr/memchr/fn.memchr2.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/fn.memchr2.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/fn.memchr2.html">../../memchr/fn.memchr2.html</a>...</p>
|
||||
<script>location.replace("../../memchr/fn.memchr2.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/fn.memchr2_iter.html
Normal file
11
memchr/memchr/fn.memchr2_iter.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/fn.memchr2_iter.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/fn.memchr2_iter.html">../../memchr/fn.memchr2_iter.html</a>...</p>
|
||||
<script>location.replace("../../memchr/fn.memchr2_iter.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/fn.memchr3.html
Normal file
11
memchr/memchr/fn.memchr3.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/fn.memchr3.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/fn.memchr3.html">../../memchr/fn.memchr3.html</a>...</p>
|
||||
<script>location.replace("../../memchr/fn.memchr3.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/fn.memchr3_iter.html
Normal file
11
memchr/memchr/fn.memchr3_iter.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/fn.memchr3_iter.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/fn.memchr3_iter.html">../../memchr/fn.memchr3_iter.html</a>...</p>
|
||||
<script>location.replace("../../memchr/fn.memchr3_iter.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/fn.memchr_iter.html
Normal file
11
memchr/memchr/fn.memchr_iter.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/fn.memchr_iter.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/fn.memchr_iter.html">../../memchr/fn.memchr_iter.html</a>...</p>
|
||||
<script>location.replace("../../memchr/fn.memchr_iter.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/fn.memrchr.html
Normal file
11
memchr/memchr/fn.memrchr.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/fn.memrchr.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/fn.memrchr.html">../../memchr/fn.memrchr.html</a>...</p>
|
||||
<script>location.replace("../../memchr/fn.memrchr.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/fn.memrchr2.html
Normal file
11
memchr/memchr/fn.memrchr2.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/fn.memrchr2.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/fn.memrchr2.html">../../memchr/fn.memrchr2.html</a>...</p>
|
||||
<script>location.replace("../../memchr/fn.memrchr2.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/fn.memrchr2_iter.html
Normal file
11
memchr/memchr/fn.memrchr2_iter.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/fn.memrchr2_iter.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/fn.memrchr2_iter.html">../../memchr/fn.memrchr2_iter.html</a>...</p>
|
||||
<script>location.replace("../../memchr/fn.memrchr2_iter.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/fn.memrchr3.html
Normal file
11
memchr/memchr/fn.memrchr3.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/fn.memrchr3.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/fn.memrchr3.html">../../memchr/fn.memrchr3.html</a>...</p>
|
||||
<script>location.replace("../../memchr/fn.memrchr3.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/fn.memrchr3_iter.html
Normal file
11
memchr/memchr/fn.memrchr3_iter.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/fn.memrchr3_iter.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/fn.memrchr3_iter.html">../../memchr/fn.memrchr3_iter.html</a>...</p>
|
||||
<script>location.replace("../../memchr/fn.memrchr3_iter.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/fn.memrchr_iter.html
Normal file
11
memchr/memchr/fn.memrchr_iter.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/fn.memrchr_iter.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/fn.memrchr_iter.html">../../memchr/fn.memrchr_iter.html</a>...</p>
|
||||
<script>location.replace("../../memchr/fn.memrchr_iter.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/struct.Memchr.html
Normal file
11
memchr/memchr/struct.Memchr.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/struct.Memchr.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/struct.Memchr.html">../../memchr/struct.Memchr.html</a>...</p>
|
||||
<script>location.replace("../../memchr/struct.Memchr.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/struct.Memchr2.html
Normal file
11
memchr/memchr/struct.Memchr2.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/struct.Memchr2.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/struct.Memchr2.html">../../memchr/struct.Memchr2.html</a>...</p>
|
||||
<script>location.replace("../../memchr/struct.Memchr2.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
memchr/memchr/struct.Memchr3.html
Normal file
11
memchr/memchr/struct.Memchr3.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../memchr/struct.Memchr3.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../memchr/struct.Memchr3.html">../../memchr/struct.Memchr3.html</a>...</p>
|
||||
<script>location.replace("../../memchr/struct.Memchr3.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
41
memchr/memmem/enum.Prefilter.html
Normal file
41
memchr/memmem/enum.Prefilter.html
Normal file
File diff suppressed because one or more lines are too long
20
memchr/memmem/fn.find.html
Normal file
20
memchr/memmem/fn.find.html
Normal 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="Returns the index of the first occurrence of the given needle."><title>find in memchr::memmem - 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="#">find</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#complexity" title="Complexity">Complexity</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In memchr::<wbr>memmem</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">memmem</a></span><h1>Function <span class="fn">find</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/memmem/mod.rs.html#185-191">Source</a> </span></div><pre class="rust item-decl"><code>pub fn find(haystack: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>], needle: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns the index of the first occurrence of the given needle.</p>
|
||||
<p>Note that if you’re are searching for the same needle in many different
|
||||
small haystacks, it may be faster to initialize a <a href="struct.Finder.html" title="struct memchr::memmem::Finder"><code>Finder</code></a> once,
|
||||
and reuse it for each search.</p>
|
||||
<h2 id="complexity"><a class="doc-anchor" href="#complexity">§</a>Complexity</h2>
|
||||
<p>This routine is guaranteed to have worst case linear time complexity
|
||||
with respect to both the needle and the haystack. That is, this runs
|
||||
in <code>O(needle.len() + haystack.len())</code> time.</p>
|
||||
<p>This routine is also guaranteed to have worst case constant space
|
||||
complexity.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<p>Basic usage:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memmem;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"foo bar baz"</span>;
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">0</span>), memmem::find(haystack, <span class="string">b"foo"</span>));
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">4</span>), memmem::find(haystack, <span class="string">b"bar"</span>));
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, memmem::find(haystack, <span class="string">b"quux"</span>));</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
23
memchr/memmem/fn.find_iter.html
Normal file
23
memchr/memmem/fn.find_iter.html
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<!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 an iterator over all non-overlapping occurrences of a substring in a haystack."><title>find_iter in memchr::memmem - 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="#">find_<wbr>iter</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#complexity" title="Complexity">Complexity</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In memchr::<wbr>memmem</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">memmem</a></span><h1>Function <span class="fn">find_iter</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/memmem/mod.rs.html#116-121">Source</a> </span></div><pre class="rust item-decl"><code>pub fn find_iter<'h, 'n, N: 'n + ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]>>(
|
||||
haystack: &'h [<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>],
|
||||
needle: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&'n N</a>,
|
||||
) -> <a class="struct" href="struct.FindIter.html" title="struct memchr::memmem::FindIter">FindIter</a><'h, 'n> <a href="#" class="tooltip" data-notable-ty="FindIter<'h, 'n>">ⓘ</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns an iterator over all non-overlapping occurrences of a substring in
|
||||
a haystack.</p>
|
||||
<h2 id="complexity"><a class="doc-anchor" href="#complexity">§</a>Complexity</h2>
|
||||
<p>This routine is guaranteed to have worst case linear time complexity
|
||||
with respect to both the needle and the haystack. That is, this runs
|
||||
in <code>O(needle.len() + haystack.len())</code> time.</p>
|
||||
<p>This routine is also guaranteed to have worst case constant space
|
||||
complexity.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<p>Basic usage:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memmem;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"foo bar foo baz foo"</span>;
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>it = memmem::find_iter(haystack, <span class="string">b"foo"</span>);
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">0</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">8</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">16</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, it.next());</code></pre></div>
|
||||
</div></details><script type="text/json" id="notable-traits-data">{"FindIter<'h, 'n>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.FindIter.html\" title=\"struct memchr::memmem::FindIter\">FindIter</a><'h, 'n></code></h3><pre><code><div class=\"where\">impl<'h, 'n> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.FindIter.html\" title=\"struct memchr::memmem::FindIter\">FindIter</a><'h, 'n></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.84.1/std/primitive.usize.html\">usize</a>;</div>"}</script></section></div></main></body></html>
|
||||
21
memchr/memmem/fn.rfind.html
Normal file
21
memchr/memmem/fn.rfind.html
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<!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 the index of the last occurrence of the given needle."><title>rfind in memchr::memmem - 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="#">rfind</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#complexity" title="Complexity">Complexity</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In memchr::<wbr>memmem</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">memmem</a></span><h1>Function <span class="fn">rfind</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/memmem/mod.rs.html#222-228">Source</a> </span></div><pre class="rust item-decl"><code>pub fn rfind(haystack: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>], needle: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns the index of the last occurrence of the given needle.</p>
|
||||
<p>Note that if you’re are searching for the same needle in many different
|
||||
small haystacks, it may be faster to initialize a <a href="struct.FinderRev.html" title="struct memchr::memmem::FinderRev"><code>FinderRev</code></a> once,
|
||||
and reuse it for each search.</p>
|
||||
<h2 id="complexity"><a class="doc-anchor" href="#complexity">§</a>Complexity</h2>
|
||||
<p>This routine is guaranteed to have worst case linear time complexity
|
||||
with respect to both the needle and the haystack. That is, this runs
|
||||
in <code>O(needle.len() + haystack.len())</code> time.</p>
|
||||
<p>This routine is also guaranteed to have worst case constant space
|
||||
complexity.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<p>Basic usage:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memmem;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"foo bar baz"</span>;
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">0</span>), memmem::rfind(haystack, <span class="string">b"foo"</span>));
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">4</span>), memmem::rfind(haystack, <span class="string">b"bar"</span>));
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">8</span>), memmem::rfind(haystack, <span class="string">b"ba"</span>));
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, memmem::rfind(haystack, <span class="string">b"quux"</span>));</code></pre></div>
|
||||
</div></details></section></div></main></body></html>
|
||||
23
memchr/memmem/fn.rfind_iter.html
Normal file
23
memchr/memmem/fn.rfind_iter.html
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<!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 a reverse iterator over all non-overlapping occurrences of a substring in a haystack."><title>rfind_iter in memchr::memmem - 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="#">rfind_<wbr>iter</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#complexity" title="Complexity">Complexity</a></li><li><a href="#examples" title="Examples">Examples</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In memchr::<wbr>memmem</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">memmem</a></span><h1>Function <span class="fn">rfind_iter</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/memmem/mod.rs.html#150-155">Source</a> </span></div><pre class="rust item-decl"><code>pub fn rfind_iter<'h, 'n, N: 'n + ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]>>(
|
||||
haystack: &'h [<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>],
|
||||
needle: <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&'n N</a>,
|
||||
) -> <a class="struct" href="struct.FindRevIter.html" title="struct memchr::memmem::FindRevIter">FindRevIter</a><'h, 'n> <a href="#" class="tooltip" data-notable-ty="FindRevIter<'h, 'n>">ⓘ</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns a reverse iterator over all non-overlapping occurrences of a
|
||||
substring in a haystack.</p>
|
||||
<h2 id="complexity"><a class="doc-anchor" href="#complexity">§</a>Complexity</h2>
|
||||
<p>This routine is guaranteed to have worst case linear time complexity
|
||||
with respect to both the needle and the haystack. That is, this runs
|
||||
in <code>O(needle.len() + haystack.len())</code> time.</p>
|
||||
<p>This routine is also guaranteed to have worst case constant space
|
||||
complexity.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<p>Basic usage:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memmem;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"foo bar foo baz foo"</span>;
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>it = memmem::rfind_iter(haystack, <span class="string">b"foo"</span>);
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">16</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">8</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">0</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, it.next());</code></pre></div>
|
||||
</div></details><script type="text/json" id="notable-traits-data">{"FindRevIter<'h, 'n>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.FindRevIter.html\" title=\"struct memchr::memmem::FindRevIter\">FindRevIter</a><'h, 'n></code></h3><pre><code><div class=\"where\">impl<'h, 'n> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.FindRevIter.html\" title=\"struct memchr::memmem::FindRevIter\">FindRevIter</a><'h, 'n></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.84.1/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.84.1/std/primitive.usize.html\">usize</a>;</div>"}</script></section></div></main></body></html>
|
||||
53
memchr/memmem/index.html
Normal file
53
memchr/memmem/index.html
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<!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 module provides forward and reverse substring search routines."><title>memchr::memmem - 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 memmem</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example-iterating-over-substring-matches" title="Example: iterating over substring matches">Example: iterating over substring matches</a></li><li><a href="#example-iterating-over-substring-matches-in-reverse" title="Example: iterating over substring matches in reverse">Example: iterating over substring matches in reverse</a></li><li><a href="#example-repeating-a-search-for-the-same-needle" title="Example: repeating a search for the same needle">Example: repeating a search for the same needle</a></li></ul><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate memchr</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></span><h1>Module <span>memmem</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/memmem/mod.rs.html#1-737">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This module provides forward and reverse substring search routines.</p>
|
||||
<p>Unlike the standard library’s substring search routines, these work on
|
||||
arbitrary bytes. For all non-empty needles, these routines will report exactly
|
||||
the same values as the corresponding routines in the standard library. For
|
||||
the empty needle, the standard library reports matches only at valid UTF-8
|
||||
boundaries, where as these routines will report matches at every position.</p>
|
||||
<p>Other than being able to work on arbitrary bytes, the primary reason to prefer
|
||||
these routines over the standard library routines is that these will generally
|
||||
be faster. In some cases, significantly so.</p>
|
||||
<h2 id="example-iterating-over-substring-matches"><a class="doc-anchor" href="#example-iterating-over-substring-matches">§</a>Example: iterating over substring matches</h2>
|
||||
<p>This example shows how to use <a href="fn.find_iter.html" title="fn memchr::memmem::find_iter"><code>find_iter</code></a> to find occurrences of a substring
|
||||
in a haystack.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memmem;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"foo bar foo baz foo"</span>;
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>it = memmem::find_iter(haystack, <span class="string">"foo"</span>);
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">0</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">8</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">16</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, it.next());</code></pre></div>
|
||||
<h2 id="example-iterating-over-substring-matches-in-reverse"><a class="doc-anchor" href="#example-iterating-over-substring-matches-in-reverse">§</a>Example: iterating over substring matches in reverse</h2>
|
||||
<p>This example shows how to use <a href="fn.rfind_iter.html" title="fn memchr::memmem::rfind_iter"><code>rfind_iter</code></a> to find occurrences of a substring
|
||||
in a haystack starting from the end of the haystack.</p>
|
||||
<p><strong>NOTE:</strong> This module does not implement double ended iterators, so reverse
|
||||
searches aren’t done by calling <code>rev</code> on a forward iterator.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memmem;
|
||||
|
||||
<span class="kw">let </span>haystack = <span class="string">b"foo bar foo baz foo"</span>;
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>it = memmem::rfind_iter(haystack, <span class="string">"foo"</span>);
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">16</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">8</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">0</span>), it.next());
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, it.next());</code></pre></div>
|
||||
<h2 id="example-repeating-a-search-for-the-same-needle"><a class="doc-anchor" href="#example-repeating-a-search-for-the-same-needle">§</a>Example: repeating a search for the same needle</h2>
|
||||
<p>It may be possible for the overhead of constructing a substring searcher to be
|
||||
measurable in some workloads. In cases where the same needle is used to search
|
||||
many haystacks, it is possible to do construction once and thus to avoid it for
|
||||
subsequent searches. This can be done with a <a href="struct.Finder.html" title="struct memchr::memmem::Finder"><code>Finder</code></a> (or a <a href="struct.FinderRev.html" title="struct memchr::memmem::FinderRev"><code>FinderRev</code></a> for
|
||||
reverse searches).</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>memchr::memmem;
|
||||
|
||||
<span class="kw">let </span>finder = memmem::Finder::new(<span class="string">"foo"</span>);
|
||||
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">4</span>), finder.find(<span class="string">b"baz foo quux"</span>));
|
||||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, finder.find(<span class="string">b"quux baz bar"</span>));</code></pre></div>
|
||||
</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.FindIter.html" title="struct memchr::memmem::FindIter">Find<wbr>Iter</a></div><div class="desc docblock-short">An iterator over non-overlapping substring matches.</div></li><li><div class="item-name"><a class="struct" href="struct.FindRevIter.html" title="struct memchr::memmem::FindRevIter">Find<wbr>RevIter</a></div><div class="desc docblock-short">An iterator over non-overlapping substring matches in reverse.</div></li><li><div class="item-name"><a class="struct" href="struct.Finder.html" title="struct memchr::memmem::Finder">Finder</a></div><div class="desc docblock-short">A single substring searcher fixed to a particular needle.</div></li><li><div class="item-name"><a class="struct" href="struct.FinderBuilder.html" title="struct memchr::memmem::FinderBuilder">Finder<wbr>Builder</a></div><div class="desc docblock-short">A builder for constructing non-default forward or reverse memmem finders.</div></li><li><div class="item-name"><a class="struct" href="struct.FinderRev.html" title="struct memchr::memmem::FinderRev">Finder<wbr>Rev</a></div><div class="desc docblock-short">A single substring reverse searcher fixed to a particular needle.</div></li></ul><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.Prefilter.html" title="enum memchr::memmem::Prefilter">Prefilter</a></div><div class="desc docblock-short">Prefilter controls whether heuristics are used to accelerate searching.</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.find.html" title="fn memchr::memmem::find">find</a></div><div class="desc docblock-short">Returns the index of the first occurrence of the given needle.</div></li><li><div class="item-name"><a class="fn" href="fn.find_iter.html" title="fn memchr::memmem::find_iter">find_<wbr>iter</a></div><div class="desc docblock-short">Returns an iterator over all non-overlapping occurrences of a substring in
|
||||
a haystack.</div></li><li><div class="item-name"><a class="fn" href="fn.rfind.html" title="fn memchr::memmem::rfind">rfind</a></div><div class="desc docblock-short">Returns the index of the last occurrence of the given needle.</div></li><li><div class="item-name"><a class="fn" href="fn.rfind_iter.html" title="fn memchr::memmem::rfind_iter">rfind_<wbr>iter</a></div><div class="desc docblock-short">Returns a reverse iterator over all non-overlapping occurrences of a
|
||||
substring in a haystack.</div></li></ul></section></div></main></body></html>
|
||||
11
memchr/memmem/searcher/enum.PrefilterConfig.html
Normal file
11
memchr/memmem/searcher/enum.PrefilterConfig.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../memchr/memmem/enum.Prefilter.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../memchr/memmem/enum.Prefilter.html">../../../memchr/memmem/enum.Prefilter.html</a>...</p>
|
||||
<script>location.replace("../../../memchr/memmem/enum.Prefilter.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
1
memchr/memmem/sidebar-items.js
Normal file
1
memchr/memmem/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"enum":["Prefilter"],"fn":["find","find_iter","rfind","rfind_iter"],"struct":["FindIter","FindRevIter","Finder","FinderBuilder","FinderRev"]};
|
||||
221
memchr/memmem/struct.FindIter.html
Normal file
221
memchr/memmem/struct.FindIter.html
Normal file
File diff suppressed because one or more lines are too long
221
memchr/memmem/struct.FindRevIter.html
Normal file
221
memchr/memmem/struct.FindRevIter.html
Normal file
File diff suppressed because one or more lines are too long
79
memchr/memmem/struct.Finder.html
Normal file
79
memchr/memmem/struct.Finder.html
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue