mirror of
https://github.com/edg-l/edlang.git
synced 2024-11-23 08:28:24 +00:00
1120 lines
346 KiB
HTML
1120 lines
346 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Improved `Debug` experience for `&[u8]` UTF-8-ish streams"><title>BStr in winnow::stream - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-5bc39a1768837dd0.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="winnow" data-themes="" data-resource-suffix="" data-rustdoc-version="1.77.0 (aedd173a2 2024-03-17)" data-channel="1.77.0" data-search-js="search-dd67cee4cfa65049.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-4c98445ec4002617.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-48f368f3872407c8.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-04d5337699b92874.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../winnow/index.html">winnow</a><span class="version">0.6.5</span></h2></div><h2 class="location"><a href="#">BStr</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.new">new</a></li></ul><h3><a href="#deref-methods-%5Bu8%5D">Methods from Deref<Target=[u8]></a></h3><ul class="block deref-methods"><li><a href="#method.align_to">align_to</a></li><li><a href="#method.array_chunks">array_chunks</a></li><li><a href="#method.array_windows">array_windows</a></li><li><a href="#method.as_ascii">as_ascii</a></li><li><a href="#method.as_ascii_unchecked">as_ascii_unchecked</a></li><li><a href="#method.as_bytes">as_bytes</a></li><li><a href="#method.as_chunks">as_chunks</a></li><li><a href="#method.as_chunks_unchecked">as_chunks_unchecked</a></li><li><a href="#method.as_ptr">as_ptr</a></li><li><a href="#method.as_ptr_range">as_ptr_range</a></li><li><a href="#method.as_rchunks">as_rchunks</a></li><li><a href="#method.as_simd">as_simd</a></li><li><a href="#method.as_str">as_str</a></li><li><a href="#method.binary_search">binary_search</a></li><li><a href="#method.binary_search_by">binary_search_by</a></li><li><a href="#method.binary_search_by_key">binary_search_by_key</a></li><li><a href="#method.chunk_by">chunk_by</a></li><li><a href="#method.chunks">chunks</a></li><li><a href="#method.chunks_exact">chunks_exact</a></li><li><a href="#method.concat">concat</a></li><li><a href="#method.connect">connect</a></li><li><a href="#method.contains">contains</a></li><li><a href="#method.ends_with">ends_with</a></li><li><a href="#method.eq_ignore_ascii_case">eq_ignore_ascii_case</a></li><li><a href="#method.escape_ascii">escape_ascii</a></li><li><a href="#method.first">first</a></li><li><a href="#method.first_chunk">first_chunk</a></li><li><a href="#method.flatten">flatten</a></li><li><a href="#method.get">get</a></li><li><a href="#method.get_unchecked">get_unchecked</a></li><li><a href="#method.is_ascii">is_ascii</a></li><li><a href="#method.is_empty">is_empty</a></li><li><a href="#method.is_sorted">is_sorted</a></li><li><a href="#method.is_sorted_by">is_sorted_by</a></li><li><a href="#method.is_sorted_by_key">is_sorted_by_key</a></li><li><a href="#method.iter">iter</a></li><li><a href="#method.join">join</a></li><li><a href="#method.last">last</a></li><li><a href="#method.last_chunk">last_chunk</a></li><li><a href="#method.len">len</a></li><li><a href="#method.partition_point">partition_point</a></li><li><a href="#method.rchunks">rchunks</a></li><li><a href="#method.rchunks_exact">rchunks_exact</a></li><li><a href="#method.repeat">repeat</a></li><li><a href="#method.rsplit">rsplit</a></li><li><a href="#method.rsplit_once">rsplit_once</a></li><li><a href="#method.rsplitn">rsplitn</a></li><li><a href="#method.split">split</a></li><li><a href="#method.split_at">split_at</a></li><li><a href="#method.split_at_checked">split_at_checked</a></li><li><a href="#method.split_at_unchecked">split_at_unchecked</a></li><li><a href="#method.split_first">split_first</a></li><li><a href="#method.split_first_chunk">split_first_chunk</a></li><li><a href="#method.split_inclusive">split_inclusive</a></li><li><a href="#method.split_last">split_last</a></li><li><a href="#method.split_last_chunk">split_last_chunk</a></li><li><a href="#method.split_once">split_once</a></li><li><a href="#method.splitn">splitn</a></li><li><a href="#method.starts_with">starts_with</a></li><li><a href="#method.strip_prefix">strip_prefix</a></li><li><a href="#method.strip_suffix">strip_suffix</a></li><li><a href="#method.to_ascii_lowercase">to_ascii_lowercase</a></li><li><a href="#method.to_ascii_uppercase">to_ascii_uppercase</a></li><li><a href="#method.to_vec">to_vec</a></li><li><a href="#method.to_vec_in">to_vec_in</a></li><li><a href="#method.trim_ascii">trim_ascii</a></li><li><a href="#method.trim_ascii_end">trim_ascii_end</a></li><li><a href="#method.trim_ascii_start">trim_ascii_start</a></li><li><a href="#method.windows">windows</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-AsBStr-for-%26BStr">AsBStr</a></li><li><a href="#impl-AsRef%3CBStr%3E-for-%5Bu8%5D">AsRef<BStr></a></li><li><a href="#impl-AsRef%3CBStr%3E-for-str">AsRef<BStr></a></li><li><a href="#impl-AsRef%3C%5Bu8%5D%3E-for-BStr">AsRef<[u8]></a></li><li><a href="#impl-Borrow%3CBStr%3E-for-Vec%3Cu8%3E">Borrow<BStr></a></li><li><a href="#impl-Compare%3CT%3E-for-%26BStr">Compare<T></a></li><li><a href="#impl-Debug-for-BStr">Debug</a></li><li><a href="#impl-Default-for-%26BStr">Default</a></li><li><a href="#impl-Deref-for-BStr">Deref</a></li><li><a href="#impl-Display-for-BStr">Display</a></li><li><a href="#impl-Eq-for-BStr">Eq</a></li><li><a href="#impl-FindSlice%3CS%3E-for-%26BStr">FindSlice<S></a></li><li><a href="#impl-From%3C%26BStr%3E-for-%26%5Bu8%5D">From<&'a BStr></a></li><li><a href="#impl-From%3C%26%5Bu8%5D%3E-for-%26BStr">From<&'a [u8]></a></li><li><a href="#impl-From%3C%26str%3E-for-%26BStr">From<&'a str></a></li><li><a href="#impl-Hash-for-BStr">Hash</a></li><li><a href="#impl-Index%3CRange%3Cusize%3E%3E-for-BStr">Index<Range<usize>></a></li><li><a href="#impl-Index%3CRangeFrom%3Cusize%3E%3E-for-BStr">Index<RangeFrom<usize>></a></li><li><a href="#impl-Index%3CRangeFull%3E-for-BStr">Index<RangeFull></a></li><li><a href="#impl-Index%3CRangeInclusive%3Cusize%3E%3E-for-BStr">Index<RangeInclusive<usize>></a></li><li><a href="#impl-Index%3CRangeTo%3Cusize%3E%3E-for-BStr">Index<RangeTo<usize>></a></li><li><a href="#impl-Index%3CRangeToInclusive%3Cusize%3E%3E-for-BStr">Index<RangeToInclusive<usize>></a></li><li><a href="#impl-Index%3Cusize%3E-for-BStr">Index<usize></a></li><li><a href="#impl-Offset-for-%26BStr">Offset</a></li><li><a href="#impl-Offset%3C%3C%26BStr+as+Stream%3E::Checkpoint%3E-for-%26BStr">Offset<<&'a BStr as Stream>::Checkpoint></a></li><li><a href="#impl-Ord-for-BStr">Ord</a></li><li><a href="#impl-PartialEq-for-BStr">PartialEq</a></li><li><a href="#impl-PartialEq%3C%26%5Bu8%5D%3E-for-BStr">PartialEq<&'a [u8]></a></li><li><a href="#impl-PartialEq%3C%26str%3E-for-BStr">PartialEq<&'a str></a></li><li><a href="#impl-PartialEq%3CBStr%3E-for-%26%5Bu8%5D">PartialEq<BStr></a></li><li><a href="#impl-PartialEq%3CBStr%3E-for-%26str">PartialEq<BStr></a></li><li><a href="#impl-PartialEq%3CBStr%3E-for-%5Bu8%5D">PartialEq<BStr></a></li><li><a href="#impl-PartialEq%3CBStr%3E-for-str">PartialEq<BStr></a></li><li><a href="#impl-PartialEq%3C%5Bu8%5D%3E-for-BStr">PartialEq<[u8]></a></li><li><a href="#impl-PartialEq%3Cstr%3E-for-BStr">PartialEq<str></a></li><li><a href="#impl-PartialOrd-for-BStr">PartialOrd</a></li><li><a href="#impl-PartialOrd%3C%26%5Bu8%5D%3E-for-BStr">PartialOrd<&'a [u8]></a></li><li><a href="#impl-PartialOrd%3C%26str%3E-for-BStr">PartialOrd<&'a str></a></li><li><a href="#impl-PartialOrd%3CBStr%3E-for-%26%5Bu8%5D">PartialOrd<BStr></a></li><li><a href="#impl-PartialOrd%3CBStr%3E-for-%26str">PartialOrd<BStr></a></li><li><a href="#impl-PartialOrd%3CBStr%3E-for-%5Bu8%5D">PartialOrd<BStr></a></li><li><a href="#impl-PartialOrd%3CBStr%3E-for-str">PartialOrd<BStr></a></li><li><a href="#impl-PartialOrd%3C%5Bu8%5D%3E-for-BStr">PartialOrd<[u8]></a></li><li><a href="#impl-PartialOrd%3Cstr%3E-for-BStr">PartialOrd<str></a></li><li><a href="#impl-SliceLen-for-%26BStr">SliceLen</a></li><li><a href="#impl-Stream-for-%26BStr">Stream</a></li><li><a href="#impl-StreamIsPartial-for-%26BStr">StreamIsPartial</a></li><li><a href="#impl-ToOwned-for-BStr">ToOwned</a></li><li><a href="#impl-UpdateSlice-for-%26BStr">UpdateSlice</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Sized-for-BStr">!Sized</a></li><li><a href="#impl-RefUnwindSafe-for-BStr">RefUnwindSafe</a></li><li><a href="#impl-Send-for-BStr">Send</a></li><li><a href="#impl-Sync-for-BStr">Sync</a></li><li><a href="#impl-Unpin-for-BStr">Unpin</a></li><li><a href="#impl-UnwindSafe-for-BStr">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-ToString-for-T">ToString</a></li></ul></section><h2><a href="index.html">In winnow::stream</a></h2></div></nav><div class="sidebar-resizer"></div>
|
||
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../winnow/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="../index.html">winnow</a>::<wbr><a href="index.html">stream</a>::<wbr><a class="struct" href="#">BStr</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/winnow/stream/mod.rs.html#77">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct BStr(<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>Improved <code>Debug</code> experience for <code>&[u8]</code> UTF-8-ish streams</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-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#79-95">source</a><a href="#impl-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</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/winnow/stream/mod.rs.html#82-84">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a><B: ?<a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]>>(bytes: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&B</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Self</a></h4></section></summary><div class="docblock"><p>Make a stream out of a byte slice-like.</p>
|
||
</div></details></div></details></div><h2 id="deref-methods-%5Bu8%5D" class="section-header"><span>Methods from <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a><Target = [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]></span><a href="#deref-methods-%5Bu8%5D" class="anchor">§</a></h2><div id="deref-methods-%5Bu8%5D-1" class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.len" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#138">source</a></span><h4 class="code-header">pub fn <a href="#method.len" class="fn">len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a></h4></section></summary><div class="docblock"><p>Returns the number of elements in the slice.</p>
|
||
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>a = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
|
||
<span class="macro">assert_eq!</span>(a.len(), <span class="number">3</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_empty" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#154">source</a></span><h4 class="code-header">pub fn <a href="#method.is_empty" class="fn">is_empty</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if the slice has a length of 0.</p>
|
||
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>a = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
|
||
<span class="macro">assert!</span>(!a.is_empty());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.first" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#173">source</a></span><h4 class="code-header">pub fn <a href="#method.first" class="fn">first</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>></h4></section></summary><div class="docblock"><p>Returns the first element of the slice, or <code>None</code> if it is empty.</p>
|
||
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">10</span>), v.first());
|
||
|
||
<span class="kw">let </span>w: <span class="kw-2">&</span>[i32] = <span class="kw-2">&</span>[];
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, w.first());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.split_first" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#213">source</a></span><h4 class="code-header">pub fn <a href="#method.split_first" class="fn">split_first</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>)></h4></section></summary><div class="docblock"><p>Returns the first and all the rest of the elements of the slice, or <code>None</code> if it is empty.</p>
|
||
<h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>];
|
||
|
||
<span class="kw">if let </span><span class="prelude-val">Some</span>((first, elements)) = x.split_first() {
|
||
<span class="macro">assert_eq!</span>(first, <span class="kw-2">&</span><span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(elements, <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>]);
|
||
}</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.split_last" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#255">source</a></span><h4 class="code-header">pub fn <a href="#method.split_last" class="fn">split_last</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>)></h4></section></summary><div class="docblock"><p>Returns the last and all the rest of the elements of the slice, or <code>None</code> if it is empty.</p>
|
||
<h5 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>];
|
||
|
||
<span class="kw">if let </span><span class="prelude-val">Some</span>((last, elements)) = x.split_last() {
|
||
<span class="macro">assert_eq!</span>(last, <span class="kw-2">&</span><span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(elements, <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>]);
|
||
}</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.last" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#296">source</a></span><h4 class="code-header">pub fn <a href="#method.last" class="fn">last</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>></h4></section></summary><div class="docblock"><p>Returns the last element of the slice, or <code>None</code> if it is empty.</p>
|
||
<h5 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">30</span>), v.last());
|
||
|
||
<span class="kw">let </span>w: <span class="kw-2">&</span>[i32] = <span class="kw-2">&</span>[];
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, w.last());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.first_chunk" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.77.0">1.77.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#339">source</a></span><h4 class="code-header">pub fn <a href="#method.first_chunk" class="fn">first_chunk</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.array.html">[T; N]</a>></h4></section></summary><div class="docblock"><p>Return an array reference to the first <code>N</code> items in the slice.</p>
|
||
<p>If the slice is not at least <code>N</code> in length, this will return <code>None</code>.</p>
|
||
<h5 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>u = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>]), u.first_chunk::<<span class="number">2</span>>());
|
||
|
||
<span class="kw">let </span>v: <span class="kw-2">&</span>[i32] = <span class="kw-2">&</span>[<span class="number">10</span>];
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, v.first_chunk::<<span class="number">2</span>>());
|
||
|
||
<span class="kw">let </span>w: <span class="kw-2">&</span>[i32] = <span class="kw-2">&</span>[];
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span>[]), w.first_chunk::<<span class="number">0</span>>());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.split_first_chunk" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.77.0">1.77.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#399">source</a></span><h4 class="code-header">pub fn <a href="#method.split_first_chunk" class="fn">split_first_chunk</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.array.html">[T; N]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>)></h4></section></summary><div class="docblock"><p>Return an array reference to the first <code>N</code> items in the slice and the remaining slice.</p>
|
||
<p>If the slice is not at least <code>N</code> in length, this will return <code>None</code>.</p>
|
||
<h5 id="examples-7"><a class="doc-anchor" href="#examples-7">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>];
|
||
|
||
<span class="kw">if let </span><span class="prelude-val">Some</span>((first, elements)) = x.split_first_chunk::<<span class="number">2</span>>() {
|
||
<span class="macro">assert_eq!</span>(first, <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>]);
|
||
<span class="macro">assert_eq!</span>(elements, <span class="kw-2">&</span>[<span class="number">2</span>]);
|
||
}
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, x.split_first_chunk::<<span class="number">4</span>>());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.split_last_chunk" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.77.0">1.77.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#469">source</a></span><h4 class="code-header">pub fn <a href="#method.split_last_chunk" class="fn">split_last_chunk</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.array.html">[T; N]</a>)></h4></section></summary><div class="docblock"><p>Return an array reference to the last <code>N</code> items in the slice and the remaining slice.</p>
|
||
<p>If the slice is not at least <code>N</code> in length, this will return <code>None</code>.</p>
|
||
<h5 id="examples-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>];
|
||
|
||
<span class="kw">if let </span><span class="prelude-val">Some</span>((elements, last)) = x.split_last_chunk::<<span class="number">2</span>>() {
|
||
<span class="macro">assert_eq!</span>(elements, <span class="kw-2">&</span>[<span class="number">0</span>]);
|
||
<span class="macro">assert_eq!</span>(last, <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>]);
|
||
}
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, x.split_last_chunk::<<span class="number">4</span>>());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.last_chunk" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.77.0">1.77.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#539">source</a></span><h4 class="code-header">pub fn <a href="#method.last_chunk" class="fn">last_chunk</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.array.html">[T; N]</a>></h4></section></summary><div class="docblock"><p>Return an array reference to the last <code>N</code> items in the slice.</p>
|
||
<p>If the slice is not at least <code>N</code> in length, this will return <code>None</code>.</p>
|
||
<h5 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>u = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>]), u.last_chunk::<<span class="number">2</span>>());
|
||
|
||
<span class="kw">let </span>v: <span class="kw-2">&</span>[i32] = <span class="kw-2">&</span>[<span class="number">10</span>];
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, v.last_chunk::<<span class="number">2</span>>());
|
||
|
||
<span class="kw">let </span>w: <span class="kw-2">&</span>[i32] = <span class="kw-2">&</span>[];
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span>[]), w.last_chunk::<<span class="number">0</span>>());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.get" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#608-610">source</a></span><h4 class="code-header">pub fn <a href="#method.get" class="fn">get</a><I>(&self, index: I) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<I as <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.0/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a>><div class="where">where
|
||
I: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>>,</div></h4></section></summary><div class="docblock"><p>Returns a reference to an element or subslice depending on the type of
|
||
index.</p>
|
||
<ul>
|
||
<li>If given a position, returns a reference to the element at that
|
||
position or <code>None</code> if out of bounds.</li>
|
||
<li>If given a range, returns the subslice corresponding to that range,
|
||
or <code>None</code> if out of bounds.</li>
|
||
</ul>
|
||
<h5 id="examples-10"><a class="doc-anchor" href="#examples-10">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">40</span>), v.get(<span class="number">1</span>));
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>][..]), v.get(<span class="number">0</span>..<span class="number">2</span>));
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, v.get(<span class="number">3</span>));
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, v.get(<span class="number">0</span>..<span class="number">4</span>));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_unchecked" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#670-672">source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.get_unchecked" class="fn">get_unchecked</a><I>(
|
||
&self,
|
||
index: I
|
||
) -> &<I as <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.0/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a><div class="where">where
|
||
I: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>>,</div></h4></section></summary><div class="docblock"><p>Returns a reference to an element or subslice, without doing bounds
|
||
checking.</p>
|
||
<p>For a safe alternative see <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.get" title="method slice::get"><code>get</code></a>.</p>
|
||
<h5 id="safety"><a class="doc-anchor" href="#safety">§</a>Safety</h5>
|
||
<p>Calling this method with an out-of-bounds index is <em><a href="https://doc.rust-lang.org/reference/behavior-considered-undefined.html">undefined behavior</a></em>
|
||
even if the resulting reference is not used.</p>
|
||
<p>You can think of this like <code>.get(index).unwrap_unchecked()</code>. It’s UB
|
||
to call <code>.get_unchecked(len)</code>, even if you immediately convert to a
|
||
pointer. And it’s UB to call <code>.get_unchecked(..len + 1)</code>,
|
||
<code>.get_unchecked(..=len)</code>, or similar.</p>
|
||
<h5 id="examples-11"><a class="doc-anchor" href="#examples-11">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
|
||
|
||
<span class="kw">unsafe </span>{
|
||
<span class="macro">assert_eq!</span>(x.get_unchecked(<span class="number">1</span>), <span class="kw-2">&</span><span class="number">2</span>);
|
||
}</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_ptr" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#753">source</a></span><h4 class="code-header">pub fn <a href="#method.as_ptr" class="fn">as_ptr</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.pointer.html">*const T</a></h4></section></summary><div class="docblock"><p>Returns a raw pointer to the slice’s buffer.</p>
|
||
<p>The caller must ensure that the slice outlives the pointer this
|
||
function returns, or else it will end up pointing to garbage.</p>
|
||
<p>The caller must also ensure that the memory the pointer (non-transitively) points to
|
||
is never written to (except inside an <code>UnsafeCell</code>) using this pointer or any pointer
|
||
derived from it. If you need to mutate the contents of the slice, use <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.as_mut_ptr" title="method slice::as_mut_ptr"><code>as_mut_ptr</code></a>.</p>
|
||
<p>Modifying the container referenced by this slice may cause its buffer
|
||
to be reallocated, which would also make any pointers to it invalid.</p>
|
||
<h5 id="examples-12"><a class="doc-anchor" href="#examples-12">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
|
||
<span class="kw">let </span>x_ptr = x.as_ptr();
|
||
|
||
<span class="kw">unsafe </span>{
|
||
<span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..x.len() {
|
||
<span class="macro">assert_eq!</span>(x.get_unchecked(i), <span class="kw-2">&*</span>x_ptr.add(i));
|
||
}
|
||
}</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_ptr_range" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.48.0">1.48.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#820">source</a></span><h4 class="code-header">pub fn <a href="#method.as_ptr_range" class="fn">as_ptr_range</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.pointer.html">*const T</a>> <a href="#" class="tooltip" data-notable-ty="Range<*const T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns the two raw pointers spanning the slice.</p>
|
||
<p>The returned range is half-open, which means that the end pointer
|
||
points <em>one past</em> the last element of the slice. This way, an empty
|
||
slice is represented by two equal pointers, and the difference between
|
||
the two pointers represents the size of the slice.</p>
|
||
<p>See <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.as_ptr" title="method slice::as_ptr"><code>as_ptr</code></a> for warnings on using these pointers. The end pointer
|
||
requires extra caution, as it does not point to a valid element in the
|
||
slice.</p>
|
||
<p>This function is useful for interacting with foreign interfaces which
|
||
use two pointers to refer to a range of elements in memory, as is
|
||
common in C++.</p>
|
||
<p>It can also be useful to check if a pointer to an element refers to an
|
||
element of this slice:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>a = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
|
||
<span class="kw">let </span>x = <span class="kw-2">&</span>a[<span class="number">1</span>] <span class="kw">as </span><span class="kw-2">*const </span><span class="kw">_</span>;
|
||
<span class="kw">let </span>y = <span class="kw-2">&</span><span class="number">5 </span><span class="kw">as </span><span class="kw-2">*const </span><span class="kw">_</span>;
|
||
|
||
<span class="macro">assert!</span>(a.as_ptr_range().contains(<span class="kw-2">&</span>x));
|
||
<span class="macro">assert!</span>(!a.as_ptr_range().contains(<span class="kw-2">&</span>y));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.iter" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1020">source</a></span><h4 class="code-header">pub fn <a href="#method.iter" class="fn">iter</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.Iter.html" title="struct core::slice::iter::Iter">Iter</a><'_, T> <a href="#" class="tooltip" data-notable-ty="Iter<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over the slice.</p>
|
||
<p>The iterator yields all items from start to end.</p>
|
||
<h5 id="examples-13"><a class="doc-anchor" href="#examples-13">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iterator = x.iter();
|
||
|
||
<span class="macro">assert_eq!</span>(iterator.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">1</span>));
|
||
<span class="macro">assert_eq!</span>(iterator.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">2</span>));
|
||
<span class="macro">assert_eq!</span>(iterator.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="number">4</span>));
|
||
<span class="macro">assert_eq!</span>(iterator.next(), <span class="prelude-val">None</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.windows" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1088">source</a></span><h4 class="code-header">pub fn <a href="#method.windows" class="fn">windows</a>(&self, size: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.Windows.html" title="struct core::slice::iter::Windows">Windows</a><'_, T> <a href="#" class="tooltip" data-notable-ty="Windows<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over all contiguous windows of length
|
||
<code>size</code>. The windows overlap. If the slice is shorter than
|
||
<code>size</code>, the iterator returns no values.</p>
|
||
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
|
||
<p>Panics if <code>size</code> is 0.</p>
|
||
<h5 id="examples-14"><a class="doc-anchor" href="#examples-14">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.windows(<span class="number">3</span>);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
<p>If the slice is shorter than <code>size</code>:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'f'</span>, <span class="string">'o'</span>, <span class="string">'o'</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.windows(<span class="number">4</span>);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
<p>There’s no <code>windows_mut</code>, as that existing would let safe code violate the
|
||
“only one <code>&mut</code> at a time to the same thing” rule. However, you can sometimes
|
||
use <a href="https://doc.rust-lang.org/1.77.0/core/cell/struct.Cell.html#method.as_slice_of_cells" title="method core::cell::Cell::as_slice_of_cells"><code>Cell::as_slice_of_cells</code></a> in
|
||
conjunction with <code>windows</code> to accomplish something similar:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::cell::Cell;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>array = [<span class="string">'R'</span>, <span class="string">'u'</span>, <span class="string">'s'</span>, <span class="string">'t'</span>, <span class="string">' '</span>, <span class="string">'2'</span>, <span class="string">'0'</span>, <span class="string">'1'</span>, <span class="string">'5'</span>];
|
||
<span class="kw">let </span>slice = <span class="kw-2">&mut </span>array[..];
|
||
<span class="kw">let </span>slice_of_cells: <span class="kw-2">&</span>[Cell<char>] = Cell::from_mut(slice).as_slice_of_cells();
|
||
<span class="kw">for </span>w <span class="kw">in </span>slice_of_cells.windows(<span class="number">3</span>) {
|
||
Cell::swap(<span class="kw-2">&</span>w[<span class="number">0</span>], <span class="kw-2">&</span>w[<span class="number">2</span>]);
|
||
}
|
||
<span class="macro">assert_eq!</span>(array, [<span class="string">'s'</span>, <span class="string">'t'</span>, <span class="string">' '</span>, <span class="string">'2'</span>, <span class="string">'0'</span>, <span class="string">'1'</span>, <span class="string">'5'</span>, <span class="string">'u'</span>, <span class="string">'R'</span>]);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.chunks" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1123">source</a></span><h4 class="code-header">pub fn <a href="#method.chunks" class="fn">chunks</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.Chunks.html" title="struct core::slice::iter::Chunks">Chunks</a><'_, T> <a href="#" class="tooltip" data-notable-ty="Chunks<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time, starting at the
|
||
beginning of the slice.</p>
|
||
<p>The chunks are slices and do not overlap. If <code>chunk_size</code> does not divide the length of the
|
||
slice, then the last chunk will not have length <code>chunk_size</code>.</p>
|
||
<p>See <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.chunks_exact" title="method slice::chunks_exact"><code>chunks_exact</code></a> for a variant of this iterator that returns chunks of always exactly
|
||
<code>chunk_size</code> elements, and <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.rchunks" title="method slice::rchunks"><code>rchunks</code></a> for the same iterator but starting at the end of the
|
||
slice.</p>
|
||
<h5 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h5>
|
||
<p>Panics if <code>chunk_size</code> is 0.</p>
|
||
<h5 id="examples-15"><a class="doc-anchor" href="#examples-15">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.chunks(<span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'l'</span>, <span class="string">'o'</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'r'</span>, <span class="string">'e'</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'m'</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.chunks_exact" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.31.0">1.31.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1200">source</a></span><h4 class="code-header">pub fn <a href="#method.chunks_exact" class="fn">chunks_exact</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.ChunksExact.html" title="struct core::slice::iter::ChunksExact">ChunksExact</a><'_, T> <a href="#" class="tooltip" data-notable-ty="ChunksExact<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time, starting at the
|
||
beginning of the slice.</p>
|
||
<p>The chunks are slices and do not overlap. If <code>chunk_size</code> does not divide the length of the
|
||
slice, then the last up to <code>chunk_size-1</code> elements will be omitted and can be retrieved
|
||
from the <code>remainder</code> function of the iterator.</p>
|
||
<p>Due to each chunk having exactly <code>chunk_size</code> elements, the compiler can often optimize the
|
||
resulting code better than in the case of <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.chunks" title="method slice::chunks"><code>chunks</code></a>.</p>
|
||
<p>See <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.chunks" title="method slice::chunks"><code>chunks</code></a> for a variant of this iterator that also returns the remainder as a smaller
|
||
chunk, and <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.rchunks_exact" title="method slice::rchunks_exact"><code>rchunks_exact</code></a> for the same iterator but starting at the end of the slice.</p>
|
||
<h5 id="panics-2"><a class="doc-anchor" href="#panics-2">§</a>Panics</h5>
|
||
<p>Panics if <code>chunk_size</code> is 0.</p>
|
||
<h5 id="examples-16"><a class="doc-anchor" href="#examples-16">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.chunks_exact(<span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'l'</span>, <span class="string">'o'</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'r'</span>, <span class="string">'e'</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());
|
||
<span class="macro">assert_eq!</span>(iter.remainder(), <span class="kw-2">&</span>[<span class="string">'m'</span>]);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_chunks_unchecked" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1278">source</a><h4 class="code-header">pub unsafe fn <a href="#method.as_chunks_unchecked" class="fn">as_chunks_unchecked</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.array.html">[T; N]</a>]</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_as_chunks</code>)</span></div></span></summary><div class="docblock"><p>Splits the slice into a slice of <code>N</code>-element arrays,
|
||
assuming that there’s no remainder.</p>
|
||
<h5 id="safety-1"><a class="doc-anchor" href="#safety-1">§</a>Safety</h5>
|
||
<p>This may only be called when</p>
|
||
<ul>
|
||
<li>The slice splits exactly into <code>N</code>-element chunks (aka <code>self.len() % N == 0</code>).</li>
|
||
<li><code>N != 0</code>.</li>
|
||
</ul>
|
||
<h5 id="examples-17"><a class="doc-anchor" href="#examples-17">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_as_chunks)]
|
||
</span><span class="kw">let </span>slice: <span class="kw-2">&</span>[char] = <span class="kw-2">&</span>[<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>, <span class="string">'!'</span>];
|
||
<span class="kw">let </span>chunks: <span class="kw-2">&</span>[[char; <span class="number">1</span>]] =
|
||
<span class="comment">// SAFETY: 1-element chunks never have remainder
|
||
</span><span class="kw">unsafe </span>{ slice.as_chunks_unchecked() };
|
||
<span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&</span>[[<span class="string">'l'</span>], [<span class="string">'o'</span>], [<span class="string">'r'</span>], [<span class="string">'e'</span>], [<span class="string">'m'</span>], [<span class="string">'!'</span>]]);
|
||
<span class="kw">let </span>chunks: <span class="kw-2">&</span>[[char; <span class="number">3</span>]] =
|
||
<span class="comment">// SAFETY: The slice length (6) is a multiple of 3
|
||
</span><span class="kw">unsafe </span>{ slice.as_chunks_unchecked() };
|
||
<span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&</span>[[<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>], [<span class="string">'e'</span>, <span class="string">'m'</span>, <span class="string">'!'</span>]]);
|
||
|
||
<span class="comment">// These would be unsound:
|
||
// let chunks: &[[_; 5]] = slice.as_chunks_unchecked() // The slice length is not a multiple of 5
|
||
// let chunks: &[[_; 0]] = slice.as_chunks_unchecked() // Zero-length chunks are never allowed</span></code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_chunks" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1323">source</a><h4 class="code-header">pub fn <a href="#method.as_chunks" class="fn">as_chunks</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>(&self) -> (&[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.array.html">[T; N]</a>], &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>)</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_as_chunks</code>)</span></div></span></summary><div class="docblock"><p>Splits the slice into a slice of <code>N</code>-element arrays,
|
||
starting at the beginning of the slice,
|
||
and a remainder slice with length strictly less than <code>N</code>.</p>
|
||
<h5 id="panics-3"><a class="doc-anchor" href="#panics-3">§</a>Panics</h5>
|
||
<p>Panics if <code>N</code> is 0. This check will most probably get changed to a compile time
|
||
error before this method gets stabilized.</p>
|
||
<h5 id="examples-18"><a class="doc-anchor" href="#examples-18">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_as_chunks)]
|
||
</span><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>];
|
||
<span class="kw">let </span>(chunks, remainder) = slice.as_chunks();
|
||
<span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&</span>[[<span class="string">'l'</span>, <span class="string">'o'</span>], [<span class="string">'r'</span>, <span class="string">'e'</span>]]);
|
||
<span class="macro">assert_eq!</span>(remainder, <span class="kw-2">&</span>[<span class="string">'m'</span>]);</code></pre></div>
|
||
<p>If you expect the slice to be an exact multiple, you can combine
|
||
<code>let</code>-<code>else</code> with an empty slice pattern:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_as_chunks)]
|
||
</span><span class="kw">let </span>slice = [<span class="string">'R'</span>, <span class="string">'u'</span>, <span class="string">'s'</span>, <span class="string">'t'</span>];
|
||
<span class="kw">let </span>(chunks, []) = slice.as_chunks::<<span class="number">2</span>>() <span class="kw">else </span>{
|
||
<span class="macro">panic!</span>(<span class="string">"slice didn't have even length"</span>)
|
||
};
|
||
<span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&</span>[[<span class="string">'R'</span>, <span class="string">'u'</span>], [<span class="string">'s'</span>, <span class="string">'t'</span>]]);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_rchunks" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1355">source</a><h4 class="code-header">pub fn <a href="#method.as_rchunks" class="fn">as_rchunks</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>(&self) -> (&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>, &[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.array.html">[T; N]</a>])</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_as_chunks</code>)</span></div></span></summary><div class="docblock"><p>Splits the slice into a slice of <code>N</code>-element arrays,
|
||
starting at the end of the slice,
|
||
and a remainder slice with length strictly less than <code>N</code>.</p>
|
||
<h5 id="panics-4"><a class="doc-anchor" href="#panics-4">§</a>Panics</h5>
|
||
<p>Panics if <code>N</code> is 0. This check will most probably get changed to a compile time
|
||
error before this method gets stabilized.</p>
|
||
<h5 id="examples-19"><a class="doc-anchor" href="#examples-19">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_as_chunks)]
|
||
</span><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>];
|
||
<span class="kw">let </span>(remainder, chunks) = slice.as_rchunks();
|
||
<span class="macro">assert_eq!</span>(remainder, <span class="kw-2">&</span>[<span class="string">'l'</span>]);
|
||
<span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&</span>[[<span class="string">'o'</span>, <span class="string">'r'</span>], [<span class="string">'e'</span>, <span class="string">'m'</span>]]);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.array_chunks" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1395">source</a><h4 class="code-header">pub fn <a href="#method.array_chunks" class="fn">array_chunks</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.ArrayChunks.html" title="struct core::slice::iter::ArrayChunks">ArrayChunks</a><'_, T, N> <a href="#" class="tooltip" data-notable-ty="ArrayChunks<'_, T, N>">ⓘ</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>array_chunks</code>)</span></div></span></summary><div class="docblock"><p>Returns an iterator over <code>N</code> elements of the slice at a time, starting at the
|
||
beginning of the slice.</p>
|
||
<p>The chunks are array references and do not overlap. If <code>N</code> does not divide the
|
||
length of the slice, then the last up to <code>N-1</code> elements will be omitted and can be
|
||
retrieved from the <code>remainder</code> function of the iterator.</p>
|
||
<p>This method is the const generic equivalent of <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.chunks_exact" title="method slice::chunks_exact"><code>chunks_exact</code></a>.</p>
|
||
<h5 id="panics-5"><a class="doc-anchor" href="#panics-5">§</a>Panics</h5>
|
||
<p>Panics if <code>N</code> is 0. This check will most probably get changed to a compile time
|
||
error before this method gets stabilized.</p>
|
||
<h5 id="examples-20"><a class="doc-anchor" href="#examples-20">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(array_chunks)]
|
||
</span><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.array_chunks();
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'l'</span>, <span class="string">'o'</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'r'</span>, <span class="string">'e'</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());
|
||
<span class="macro">assert_eq!</span>(iter.remainder(), <span class="kw-2">&</span>[<span class="string">'m'</span>]);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.array_windows" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1585">source</a><h4 class="code-header">pub fn <a href="#method.array_windows" class="fn">array_windows</a><const N: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.ArrayWindows.html" title="struct core::slice::iter::ArrayWindows">ArrayWindows</a><'_, T, N> <a href="#" class="tooltip" data-notable-ty="ArrayWindows<'_, T, N>">ⓘ</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>array_windows</code>)</span></div></span></summary><div class="docblock"><p>Returns an iterator over overlapping windows of <code>N</code> elements of a slice,
|
||
starting at the beginning of the slice.</p>
|
||
<p>This is the const generic equivalent of <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.windows" title="method slice::windows"><code>windows</code></a>.</p>
|
||
<p>If <code>N</code> is greater than the size of the slice, it will return no windows.</p>
|
||
<h5 id="panics-6"><a class="doc-anchor" href="#panics-6">§</a>Panics</h5>
|
||
<p>Panics if <code>N</code> is 0. This check will most probably get changed to a compile time
|
||
error before this method gets stabilized.</p>
|
||
<h5 id="examples-21"><a class="doc-anchor" href="#examples-21">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(array_windows)]
|
||
</span><span class="kw">let </span>slice = [<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.array_windows();
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">2</span>, <span class="number">3</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.rchunks" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.31.0">1.31.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1620">source</a></span><h4 class="code-header">pub fn <a href="#method.rchunks" class="fn">rchunks</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.RChunks.html" title="struct core::slice::iter::RChunks">RChunks</a><'_, T> <a href="#" class="tooltip" data-notable-ty="RChunks<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time, starting at the end
|
||
of the slice.</p>
|
||
<p>The chunks are slices and do not overlap. If <code>chunk_size</code> does not divide the length of the
|
||
slice, then the last chunk will not have length <code>chunk_size</code>.</p>
|
||
<p>See <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.rchunks_exact" title="method slice::rchunks_exact"><code>rchunks_exact</code></a> for a variant of this iterator that returns chunks of always exactly
|
||
<code>chunk_size</code> elements, and <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.chunks" title="method slice::chunks"><code>chunks</code></a> for the same iterator but starting at the beginning
|
||
of the slice.</p>
|
||
<h5 id="panics-7"><a class="doc-anchor" href="#panics-7">§</a>Panics</h5>
|
||
<p>Panics if <code>chunk_size</code> is 0.</p>
|
||
<h5 id="examples-22"><a class="doc-anchor" href="#examples-22">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.rchunks(<span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'e'</span>, <span class="string">'m'</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'o'</span>, <span class="string">'r'</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'l'</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.rchunks_exact" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.31.0">1.31.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1699">source</a></span><h4 class="code-header">pub fn <a href="#method.rchunks_exact" class="fn">rchunks_exact</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.RChunksExact.html" title="struct core::slice::iter::RChunksExact">RChunksExact</a><'_, T> <a href="#" class="tooltip" data-notable-ty="RChunksExact<'_, T>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time, starting at the
|
||
end of the slice.</p>
|
||
<p>The chunks are slices and do not overlap. If <code>chunk_size</code> does not divide the length of the
|
||
slice, then the last up to <code>chunk_size-1</code> elements will be omitted and can be retrieved
|
||
from the <code>remainder</code> function of the iterator.</p>
|
||
<p>Due to each chunk having exactly <code>chunk_size</code> elements, the compiler can often optimize the
|
||
resulting code better than in the case of <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.rchunks" title="method slice::rchunks"><code>rchunks</code></a>.</p>
|
||
<p>See <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.rchunks" title="method slice::rchunks"><code>rchunks</code></a> for a variant of this iterator that also returns the remainder as a smaller
|
||
chunk, and <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.chunks_exact" title="method slice::chunks_exact"><code>chunks_exact</code></a> for the same iterator but starting at the beginning of the
|
||
slice.</p>
|
||
<h5 id="panics-8"><a class="doc-anchor" href="#panics-8">§</a>Panics</h5>
|
||
<p>Panics if <code>chunk_size</code> is 0.</p>
|
||
<h5 id="examples-23"><a class="doc-anchor" href="#examples-23">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.rchunks_exact(<span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'e'</span>, <span class="string">'m'</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="string">'o'</span>, <span class="string">'r'</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());
|
||
<span class="macro">assert_eq!</span>(iter.remainder(), <span class="kw-2">&</span>[<span class="string">'l'</span>]);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.chunk_by" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.77.0">1.77.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1782-1784">source</a></span><h4 class="code-header">pub fn <a href="#method.chunk_by" class="fn">chunk_by</a><F>(&self, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.ChunkBy.html" title="struct core::slice::iter::ChunkBy">ChunkBy</a><'_, T, F> <a href="#" class="tooltip" data-notable-ty="ChunkBy<'_, T, F>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over the slice producing non-overlapping runs
|
||
of elements using the predicate to separate them.</p>
|
||
<p>The predicate is called for every pair of consecutive elements,
|
||
meaning that it is called on <code>slice[0]</code> and <code>slice[1]</code>,
|
||
followed by <code>slice[1]</code> and <code>slice[2]</code>, and so on.</p>
|
||
<h5 id="examples-24"><a class="doc-anchor" href="#examples-24">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">2</span>];
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.chunk_by(|a, b| a == b);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>][..]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">3</span>, <span class="number">3</span>][..]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">2</span>, <span class="number">2</span>, <span class="number">2</span>][..]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">None</span>);</code></pre></div>
|
||
<p>This method can be used to extract the sorted subslices:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>];
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.chunk_by(|a, b| a <= b);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>][..]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">2</span>, <span class="number">3</span>][..]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>][..]));
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">None</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.split_at" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1870">source</a></span><h4 class="code-header">pub fn <a href="#method.split_at" class="fn">split_at</a>(&self, mid: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -> (&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>)</h4></section></summary><div class="docblock"><p>Divides one slice into two at an index.</p>
|
||
<p>The first will contain all indices from <code>[0, mid)</code> (excluding
|
||
the index <code>mid</code> itself) and the second will contain all
|
||
indices from <code>[mid, len)</code> (excluding the index <code>len</code> itself).</p>
|
||
<h5 id="panics-9"><a class="doc-anchor" href="#panics-9">§</a>Panics</h5>
|
||
<p>Panics if <code>mid > len</code>. For a non-panicking alternative see
|
||
<a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.split_at_checked" title="method slice::split_at_checked"><code>split_at_checked</code></a>.</p>
|
||
<h5 id="examples-25"><a class="doc-anchor" href="#examples-25">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>];
|
||
|
||
{
|
||
<span class="kw">let </span>(left, right) = v.split_at(<span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(left, []);
|
||
<span class="macro">assert_eq!</span>(right, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
|
||
}
|
||
|
||
{
|
||
<span class="kw">let </span>(left, right) = v.split_at(<span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(left, [<span class="number">1</span>, <span class="number">2</span>]);
|
||
<span class="macro">assert_eq!</span>(right, [<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
|
||
}
|
||
|
||
{
|
||
<span class="kw">let </span>(left, right) = v.split_at(<span class="number">6</span>);
|
||
<span class="macro">assert_eq!</span>(left, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
|
||
<span class="macro">assert_eq!</span>(right, []);
|
||
}</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.split_at_unchecked" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#1960">source</a><h4 class="code-header">pub unsafe fn <a href="#method.split_at_unchecked" class="fn">split_at_unchecked</a>(&self, mid: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -> (&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>)</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_split_at_unchecked</code>)</span></div></span></summary><div class="docblock"><p>Divides one slice into two at an index, without doing bounds checking.</p>
|
||
<p>The first will contain all indices from <code>[0, mid)</code> (excluding
|
||
the index <code>mid</code> itself) and the second will contain all
|
||
indices from <code>[mid, len)</code> (excluding the index <code>len</code> itself).</p>
|
||
<p>For a safe alternative see <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.split_at" title="method slice::split_at"><code>split_at</code></a>.</p>
|
||
<h5 id="safety-2"><a class="doc-anchor" href="#safety-2">§</a>Safety</h5>
|
||
<p>Calling this method with an out-of-bounds index is <em><a href="https://doc.rust-lang.org/reference/behavior-considered-undefined.html">undefined behavior</a></em>
|
||
even if the resulting reference is not used. The caller has to ensure that
|
||
<code>0 <= mid <= self.len()</code>.</p>
|
||
<h5 id="examples-26"><a class="doc-anchor" href="#examples-26">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_split_at_unchecked)]
|
||
|
||
</span><span class="kw">let </span>v = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>];
|
||
|
||
<span class="kw">unsafe </span>{
|
||
<span class="kw">let </span>(left, right) = v.split_at_unchecked(<span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(left, []);
|
||
<span class="macro">assert_eq!</span>(right, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
|
||
}
|
||
|
||
<span class="kw">unsafe </span>{
|
||
<span class="kw">let </span>(left, right) = v.split_at_unchecked(<span class="number">2</span>);
|
||
<span class="macro">assert_eq!</span>(left, [<span class="number">1</span>, <span class="number">2</span>]);
|
||
<span class="macro">assert_eq!</span>(right, [<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
|
||
}
|
||
|
||
<span class="kw">unsafe </span>{
|
||
<span class="kw">let </span>(left, right) = v.split_at_unchecked(<span class="number">6</span>);
|
||
<span class="macro">assert_eq!</span>(left, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
|
||
<span class="macro">assert_eq!</span>(right, []);
|
||
}</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.split_at_checked" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2071">source</a><h4 class="code-header">pub fn <a href="#method.split_at_checked" class="fn">split_at_checked</a>(&self, mid: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>)></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>split_at_checked</code>)</span></div></span></summary><div class="docblock"><p>Divides one slice into two at an index, returning <code>None</code> if the slice is
|
||
too short.</p>
|
||
<p>If <code>mid ≤ len</code> returns a pair of slices where the first will contain all
|
||
indices from <code>[0, mid)</code> (excluding the index <code>mid</code> itself) and the
|
||
second will contain all indices from <code>[mid, len)</code> (excluding the index
|
||
<code>len</code> itself).</p>
|
||
<p>Otherwise, if <code>mid > len</code>, returns <code>None</code>.</p>
|
||
<h5 id="examples-27"><a class="doc-anchor" href="#examples-27">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(split_at_checked)]
|
||
|
||
</span><span class="kw">let </span>v = [<span class="number">1</span>, -<span class="number">2</span>, <span class="number">3</span>, -<span class="number">4</span>, <span class="number">5</span>, -<span class="number">6</span>];
|
||
|
||
{
|
||
<span class="kw">let </span>(left, right) = v.split_at_checked(<span class="number">0</span>).unwrap();
|
||
<span class="macro">assert_eq!</span>(left, []);
|
||
<span class="macro">assert_eq!</span>(right, [<span class="number">1</span>, -<span class="number">2</span>, <span class="number">3</span>, -<span class="number">4</span>, <span class="number">5</span>, -<span class="number">6</span>]);
|
||
}
|
||
|
||
{
|
||
<span class="kw">let </span>(left, right) = v.split_at_checked(<span class="number">2</span>).unwrap();
|
||
<span class="macro">assert_eq!</span>(left, [<span class="number">1</span>, -<span class="number">2</span>]);
|
||
<span class="macro">assert_eq!</span>(right, [<span class="number">3</span>, -<span class="number">4</span>, <span class="number">5</span>, -<span class="number">6</span>]);
|
||
}
|
||
|
||
{
|
||
<span class="kw">let </span>(left, right) = v.split_at_checked(<span class="number">6</span>).unwrap();
|
||
<span class="macro">assert_eq!</span>(left, [<span class="number">1</span>, -<span class="number">2</span>, <span class="number">3</span>, -<span class="number">4</span>, <span class="number">5</span>, -<span class="number">6</span>]);
|
||
<span class="macro">assert_eq!</span>(right, []);
|
||
}
|
||
|
||
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, v.split_at_checked(<span class="number">7</span>));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.split" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2164-2166">source</a></span><h4 class="code-header">pub fn <a href="#method.split" class="fn">split</a><F>(&self, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.Split.html" title="struct core::slice::iter::Split">Split</a><'_, T, F> <a href="#" class="tooltip" data-notable-ty="Split<'_, T, F>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over subslices separated by elements that match
|
||
<code>pred</code>. The matched element is not contained in the subslices.</p>
|
||
<h5 id="examples-28"><a class="doc-anchor" href="#examples-28">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>, <span class="number">20</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.split(|num| num % <span class="number">3 </span>== <span class="number">0</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">20</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
<p>If the first element is matched, an empty slice will be the first item
|
||
returned by the iterator. Similarly, if the last element in the slice
|
||
is matched, an empty slice will be the last item returned by the
|
||
iterator:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.split(|num| num % <span class="number">3 </span>== <span class="number">0</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
<p>If two matched elements are directly adjacent, an empty slice will be
|
||
present between them:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="number">10</span>, <span class="number">6</span>, <span class="number">33</span>, <span class="number">20</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.split(|num| num % <span class="number">3 </span>== <span class="number">0</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">10</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">20</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.split_inclusive" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.51.0">1.51.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2222-2224">source</a></span><h4 class="code-header">pub fn <a href="#method.split_inclusive" class="fn">split_inclusive</a><F>(&self, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.SplitInclusive.html" title="struct core::slice::iter::SplitInclusive">SplitInclusive</a><'_, T, F> <a href="#" class="tooltip" data-notable-ty="SplitInclusive<'_, T, F>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over subslices separated by elements that match
|
||
<code>pred</code>. The matched element is contained in the end of the previous
|
||
subslice as a terminator.</p>
|
||
<h5 id="examples-29"><a class="doc-anchor" href="#examples-29">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>, <span class="number">20</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.split_inclusive(|num| num % <span class="number">3 </span>== <span class="number">0</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">20</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
<p>If the last element of the slice is matched,
|
||
that element will be considered the terminator of the preceding slice.
|
||
That slice will be the last item returned by the iterator.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="number">3</span>, <span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.split_inclusive(|num| num % <span class="number">3 </span>== <span class="number">0</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">3</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>]);
|
||
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.rsplit" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.27.0">1.27.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2282-2284">source</a></span><h4 class="code-header">pub fn <a href="#method.rsplit" class="fn">rsplit</a><F>(&self, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.RSplit.html" title="struct core::slice::iter::RSplit">RSplit</a><'_, T, F> <a href="#" class="tooltip" data-notable-ty="RSplit<'_, T, F>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over subslices separated by elements that match
|
||
<code>pred</code>, starting at the end of the slice and working backwards.
|
||
The matched element is not contained in the subslices.</p>
|
||
<h5 id="examples-30"><a class="doc-anchor" href="#examples-30">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="number">11</span>, <span class="number">22</span>, <span class="number">33</span>, <span class="number">0</span>, <span class="number">44</span>, <span class="number">55</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.rsplit(|num| <span class="kw-2">*</span>num == <span class="number">0</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">44</span>, <span class="number">55</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&</span>[<span class="number">11</span>, <span class="number">22</span>, <span class="number">33</span>]);
|
||
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">None</span>);</code></pre></div>
|
||
<p>As with <code>split()</code>, if the first or last element is matched, an empty
|
||
slice will be the first (or last) item returned by the iterator.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>];
|
||
<span class="kw">let </span><span class="kw-2">mut </span>it = v.rsplit(|n| <span class="kw-2">*</span>n % <span class="number">2 </span>== <span class="number">0</span>);
|
||
<span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&</span>[]);
|
||
<span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&</span>[<span class="number">3</span>, <span class="number">5</span>]);
|
||
<span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">1</span>]);
|
||
<span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&</span>[]);
|
||
<span class="macro">assert_eq!</span>(it.next(), <span class="prelude-val">None</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.splitn" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2336-2338">source</a></span><h4 class="code-header">pub fn <a href="#method.splitn" class="fn">splitn</a><F>(&self, n: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.SplitN.html" title="struct core::slice::iter::SplitN">SplitN</a><'_, T, F> <a href="#" class="tooltip" data-notable-ty="SplitN<'_, T, F>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over subslices separated by elements that match
|
||
<code>pred</code>, limited to returning at most <code>n</code> items. The matched element is
|
||
not contained in the subslices.</p>
|
||
<p>The last element returned, if any, will contain the remainder of the
|
||
slice.</p>
|
||
<h5 id="examples-31"><a class="doc-anchor" href="#examples-31">§</a>Examples</h5>
|
||
<p>Print the slice split once by numbers divisible by 3 (i.e., <code>[10, 40]</code>,
|
||
<code>[20, 60, 50]</code>):</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>, <span class="number">20</span>, <span class="number">60</span>, <span class="number">50</span>];
|
||
|
||
<span class="kw">for </span>group <span class="kw">in </span>v.splitn(<span class="number">2</span>, |num| <span class="kw-2">*</span>num % <span class="number">3 </span>== <span class="number">0</span>) {
|
||
<span class="macro">println!</span>(<span class="string">"{group:?}"</span>);
|
||
}</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.rsplitn" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2391-2393">source</a></span><h4 class="code-header">pub fn <a href="#method.rsplitn" class="fn">rsplitn</a><F>(&self, n: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.RSplitN.html" title="struct core::slice::iter::RSplitN">RSplitN</a><'_, T, F> <a href="#" class="tooltip" data-notable-ty="RSplitN<'_, T, F>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns an iterator over subslices separated by elements that match
|
||
<code>pred</code> limited to returning at most <code>n</code> items. This starts at the end of
|
||
the slice and works backwards. The matched element is not contained in
|
||
the subslices.</p>
|
||
<p>The last element returned, if any, will contain the remainder of the
|
||
slice.</p>
|
||
<h5 id="examples-32"><a class="doc-anchor" href="#examples-32">§</a>Examples</h5>
|
||
<p>Print the slice split once, starting from the end, by numbers divisible
|
||
by 3 (i.e., <code>[50]</code>, <code>[10, 40, 30, 20]</code>):</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>, <span class="number">20</span>, <span class="number">60</span>, <span class="number">50</span>];
|
||
|
||
<span class="kw">for </span>group <span class="kw">in </span>v.rsplitn(<span class="number">2</span>, |num| <span class="kw-2">*</span>num % <span class="number">3 </span>== <span class="number">0</span>) {
|
||
<span class="macro">println!</span>(<span class="string">"{group:?}"</span>);
|
||
}</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.split_once" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2445-2447">source</a><h4 class="code-header">pub fn <a href="#method.split_once" class="fn">split_once</a><F>(&self, pred: F) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>)><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_split_once</code>)</span></div></span></summary><div class="docblock"><p>Splits the slice on the first element that matches the specified
|
||
predicate.</p>
|
||
<p>If any matching elements are present in the slice, returns the prefix
|
||
before the match and suffix after. The matching element itself is not
|
||
included. If no elements match, returns <code>None</code>.</p>
|
||
<h5 id="examples-33"><a class="doc-anchor" href="#examples-33">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_split_once)]
|
||
</span><span class="kw">let </span>s = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">4</span>];
|
||
<span class="macro">assert_eq!</span>(s.split_once(|<span class="kw-2">&</span>x| x == <span class="number">2</span>), <span class="prelude-val">Some</span>((
|
||
<span class="kw-2">&</span>[<span class="number">1</span>][..],
|
||
<span class="kw-2">&</span>[<span class="number">3</span>, <span class="number">2</span>, <span class="number">4</span>][..]
|
||
)));
|
||
<span class="macro">assert_eq!</span>(s.split_once(|<span class="kw-2">&</span>x| x == <span class="number">0</span>), <span class="prelude-val">None</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.rsplit_once" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2473-2475">source</a><h4 class="code-header">pub fn <a href="#method.rsplit_once" class="fn">rsplit_once</a><F>(&self, pred: F) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>)><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_split_once</code>)</span></div></span></summary><div class="docblock"><p>Splits the slice on the last element that matches the specified
|
||
predicate.</p>
|
||
<p>If any matching elements are present in the slice, returns the prefix
|
||
before the match and suffix after. The matching element itself is not
|
||
included. If no elements match, returns <code>None</code>.</p>
|
||
<h5 id="examples-34"><a class="doc-anchor" href="#examples-34">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_split_once)]
|
||
</span><span class="kw">let </span>s = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">4</span>];
|
||
<span class="macro">assert_eq!</span>(s.rsplit_once(|<span class="kw-2">&</span>x| x == <span class="number">2</span>), <span class="prelude-val">Some</span>((
|
||
<span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>][..],
|
||
<span class="kw-2">&</span>[<span class="number">4</span>][..]
|
||
)));
|
||
<span class="macro">assert_eq!</span>(s.rsplit_once(|<span class="kw-2">&</span>x| x == <span class="number">0</span>), <span class="prelude-val">None</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.contains" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2509-2511">source</a></span><h4 class="code-header">pub fn <a href="#method.contains" class="fn">contains</a>(&self, x: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if the slice contains an element with the given value.</p>
|
||
<p>This operation is <em>O</em>(<em>n</em>).</p>
|
||
<p>Note that if you have a sorted slice, <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.binary_search" title="method slice::binary_search"><code>binary_search</code></a> may be faster.</p>
|
||
<h5 id="examples-35"><a class="doc-anchor" href="#examples-35">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="macro">assert!</span>(v.contains(<span class="kw-2">&</span><span class="number">30</span>));
|
||
<span class="macro">assert!</span>(!v.contains(<span class="kw-2">&</span><span class="number">50</span>));</code></pre></div>
|
||
<p>If you do not have a <code>&T</code>, but some other value that you can compare
|
||
with one (for example, <code>String</code> implements <code>PartialEq<str></code>), you can
|
||
use <code>iter().any</code>:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [String::from(<span class="string">"hello"</span>), String::from(<span class="string">"world"</span>)]; <span class="comment">// slice of `String`
|
||
</span><span class="macro">assert!</span>(v.iter().any(|e| e == <span class="string">"hello"</span>)); <span class="comment">// search with `&str`
|
||
</span><span class="macro">assert!</span>(!v.iter().any(|e| e == <span class="string">"hi"</span>));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.starts_with" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2538-2540">source</a></span><h4 class="code-header">pub fn <a href="#method.starts_with" class="fn">starts_with</a>(&self, needle: &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if <code>needle</code> is a prefix of the slice.</p>
|
||
<h5 id="examples-36"><a class="doc-anchor" href="#examples-36">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&</span>[<span class="number">10</span>]));
|
||
<span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>]));
|
||
<span class="macro">assert!</span>(!v.starts_with(<span class="kw-2">&</span>[<span class="number">50</span>]));
|
||
<span class="macro">assert!</span>(!v.starts_with(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">50</span>]));</code></pre></div>
|
||
<p>Always returns <code>true</code> if <code>needle</code> is an empty slice:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&</span>[]));
|
||
<span class="kw">let </span>v: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[];
|
||
<span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&</span>[]));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.ends_with" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2568-2570">source</a></span><h4 class="code-header">pub fn <a href="#method.ends_with" class="fn">ends_with</a>(&self, needle: &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if <code>needle</code> is a suffix of the slice.</p>
|
||
<h5 id="examples-37"><a class="doc-anchor" href="#examples-37">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&</span>[<span class="number">30</span>]));
|
||
<span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>]));
|
||
<span class="macro">assert!</span>(!v.ends_with(<span class="kw-2">&</span>[<span class="number">50</span>]));
|
||
<span class="macro">assert!</span>(!v.ends_with(<span class="kw-2">&</span>[<span class="number">50</span>, <span class="number">30</span>]));</code></pre></div>
|
||
<p>Always returns <code>true</code> if <code>needle</code> is an empty slice:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&</span>[]));
|
||
<span class="kw">let </span>v: <span class="kw-2">&</span>[u8] = <span class="kw-2">&</span>[];
|
||
<span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&</span>[]));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.strip_prefix" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.51.0">1.51.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2598-2600">source</a></span><h4 class="code-header">pub fn <a href="#method.strip_prefix" class="fn">strip_prefix</a><P>(&self, prefix: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&P</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>><div class="where">where
|
||
P: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a><Item = T> + ?<a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Returns a subslice with the prefix removed.</p>
|
||
<p>If the slice starts with <code>prefix</code>, returns the subslice after the prefix, wrapped in <code>Some</code>.
|
||
If <code>prefix</code> is empty, simply returns the original slice.</p>
|
||
<p>If the slice does not start with <code>prefix</code>, returns <code>None</code>.</p>
|
||
<h5 id="examples-38"><a class="doc-anchor" href="#examples-38">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&</span>[<span class="number">10</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>][..]));
|
||
<span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">30</span>][..]));
|
||
<span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&</span>[<span class="number">50</span>]), <span class="prelude-val">None</span>);
|
||
<span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">50</span>]), <span class="prelude-val">None</span>);
|
||
|
||
<span class="kw">let </span>prefix : <span class="kw-2">&</span>str = <span class="string">"he"</span>;
|
||
<span class="macro">assert_eq!</span>(<span class="string">b"hello"</span>.strip_prefix(prefix.as_bytes()),
|
||
<span class="prelude-val">Some</span>(<span class="string">b"llo"</span>.as_ref()));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.strip_suffix" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.51.0">1.51.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2632-2634">source</a></span><h4 class="code-header">pub fn <a href="#method.strip_suffix" class="fn">strip_suffix</a><P>(&self, suffix: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&P</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>><div class="where">where
|
||
P: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a><Item = T> + ?<a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>,</div></h4></section></summary><div class="docblock"><p>Returns a subslice with the suffix removed.</p>
|
||
<p>If the slice ends with <code>suffix</code>, returns the subslice before the suffix, wrapped in <code>Some</code>.
|
||
If <code>suffix</code> is empty, simply returns the original slice.</p>
|
||
<p>If the slice does not end with <code>suffix</code>, returns <code>None</code>.</p>
|
||
<h5 id="examples-39"><a class="doc-anchor" href="#examples-39">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&</span>[<span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>][..]));
|
||
<span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&</span>[<span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>[<span class="number">10</span>][..]));
|
||
<span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&</span>[<span class="number">50</span>]), <span class="prelude-val">None</span>);
|
||
<span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&</span>[<span class="number">50</span>, <span class="number">30</span>]), <span class="prelude-val">None</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.binary_search" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2716-2718">source</a></span><h4 class="code-header">pub fn <a href="#method.binary_search" class="fn">binary_search</a>(&self, x: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Binary searches this slice for a given element.
|
||
If the slice is not sorted, the returned result is unspecified and
|
||
meaningless.</p>
|
||
<p>If the value is found then <a href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html#variant.Ok" title="variant core::result::Result::Ok"><code>Result::Ok</code></a> is returned, containing the
|
||
index of the matching element. If there are multiple matches, then any
|
||
one of the matches could be returned. The index is chosen
|
||
deterministically, but is subject to change in future versions of Rust.
|
||
If the value is not found then <a href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Result::Err</code></a> is returned, containing
|
||
the index where a matching element could be inserted while maintaining
|
||
sorted order.</p>
|
||
<p>See also <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.binary_search_by" title="method slice::binary_search_by"><code>binary_search_by</code></a>, <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.binary_search_by_key" title="method slice::binary_search_by_key"><code>binary_search_by_key</code></a>, and <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>partition_point</code></a>.</p>
|
||
<h5 id="examples-40"><a class="doc-anchor" href="#examples-40">§</a>Examples</h5>
|
||
<p>Looks up a series of four elements. The first is found, with a
|
||
uniquely determined position; the second and third are not
|
||
found; the fourth could match any position in <code>[1, 4]</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>s = [<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">55</span>];
|
||
|
||
<span class="macro">assert_eq!</span>(s.binary_search(<span class="kw-2">&</span><span class="number">13</span>), <span class="prelude-val">Ok</span>(<span class="number">9</span>));
|
||
<span class="macro">assert_eq!</span>(s.binary_search(<span class="kw-2">&</span><span class="number">4</span>), <span class="prelude-val">Err</span>(<span class="number">7</span>));
|
||
<span class="macro">assert_eq!</span>(s.binary_search(<span class="kw-2">&</span><span class="number">100</span>), <span class="prelude-val">Err</span>(<span class="number">13</span>));
|
||
<span class="kw">let </span>r = s.binary_search(<span class="kw-2">&</span><span class="number">1</span>);
|
||
<span class="macro">assert!</span>(<span class="kw">match </span>r { <span class="prelude-val">Ok</span>(<span class="number">1</span>..=<span class="number">4</span>) => <span class="bool-val">true</span>, <span class="kw">_ </span>=> <span class="bool-val">false</span>, });</code></pre></div>
|
||
<p>If you want to find that whole <em>range</em> of matching items, rather than
|
||
an arbitrary matching one, that can be done using <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>partition_point</code></a>:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>s = [<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">55</span>];
|
||
|
||
<span class="kw">let </span>low = s.partition_point(|x| x < <span class="kw-2">&</span><span class="number">1</span>);
|
||
<span class="macro">assert_eq!</span>(low, <span class="number">1</span>);
|
||
<span class="kw">let </span>high = s.partition_point(|x| x <= <span class="kw-2">&</span><span class="number">1</span>);
|
||
<span class="macro">assert_eq!</span>(high, <span class="number">5</span>);
|
||
<span class="kw">let </span>r = s.binary_search(<span class="kw-2">&</span><span class="number">1</span>);
|
||
<span class="macro">assert!</span>((low..high).contains(<span class="kw-2">&</span>r.unwrap()));
|
||
|
||
<span class="macro">assert!</span>(s[..low].iter().all(|<span class="kw-2">&</span>x| x < <span class="number">1</span>));
|
||
<span class="macro">assert!</span>(s[low..high].iter().all(|<span class="kw-2">&</span>x| x == <span class="number">1</span>));
|
||
<span class="macro">assert!</span>(s[high..].iter().all(|<span class="kw-2">&</span>x| x > <span class="number">1</span>));
|
||
|
||
<span class="comment">// For something not found, the "range" of equal items is empty
|
||
</span><span class="macro">assert_eq!</span>(s.partition_point(|x| x < <span class="kw-2">&</span><span class="number">11</span>), <span class="number">9</span>);
|
||
<span class="macro">assert_eq!</span>(s.partition_point(|x| x <= <span class="kw-2">&</span><span class="number">11</span>), <span class="number">9</span>);
|
||
<span class="macro">assert_eq!</span>(s.binary_search(<span class="kw-2">&</span><span class="number">11</span>), <span class="prelude-val">Err</span>(<span class="number">9</span>));</code></pre></div>
|
||
<p>If you want to insert an item to a sorted vector, while maintaining
|
||
sort order, consider using <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>partition_point</code></a>:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>s = <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">55</span>];
|
||
<span class="kw">let </span>num = <span class="number">42</span>;
|
||
<span class="kw">let </span>idx = s.partition_point(|<span class="kw-2">&</span>x| x < num);
|
||
<span class="comment">// The above is equivalent to `let idx = s.binary_search(&num).unwrap_or_else(|x| x);`
|
||
</span>s.insert(idx, num);
|
||
<span class="macro">assert_eq!</span>(s, [<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">42</span>, <span class="number">55</span>]);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.binary_search_by" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2767-2769">source</a></span><h4 class="code-header">pub fn <a href="#method.binary_search_by" class="fn">binary_search_by</a><'a, F>(&'a self, f: F) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&'a T</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,</div></h4></section></summary><div class="docblock"><p>Binary searches this slice with a comparator function.</p>
|
||
<p>The comparator function should return an order code that indicates
|
||
whether its argument is <code>Less</code>, <code>Equal</code> or <code>Greater</code> the desired
|
||
target.
|
||
If the slice is not sorted or if the comparator function does not
|
||
implement an order consistent with the sort order of the underlying
|
||
slice, the returned result is unspecified and meaningless.</p>
|
||
<p>If the value is found then <a href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html#variant.Ok" title="variant core::result::Result::Ok"><code>Result::Ok</code></a> is returned, containing the
|
||
index of the matching element. If there are multiple matches, then any
|
||
one of the matches could be returned. The index is chosen
|
||
deterministically, but is subject to change in future versions of Rust.
|
||
If the value is not found then <a href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Result::Err</code></a> is returned, containing
|
||
the index where a matching element could be inserted while maintaining
|
||
sorted order.</p>
|
||
<p>See also <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.binary_search" title="method slice::binary_search"><code>binary_search</code></a>, <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.binary_search_by_key" title="method slice::binary_search_by_key"><code>binary_search_by_key</code></a>, and <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>partition_point</code></a>.</p>
|
||
<h5 id="examples-41"><a class="doc-anchor" href="#examples-41">§</a>Examples</h5>
|
||
<p>Looks up a series of four elements. The first is found, with a
|
||
uniquely determined position; the second and third are not
|
||
found; the fourth could match any position in <code>[1, 4]</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>s = [<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">55</span>];
|
||
|
||
<span class="kw">let </span>seek = <span class="number">13</span>;
|
||
<span class="macro">assert_eq!</span>(s.binary_search_by(|probe| probe.cmp(<span class="kw-2">&</span>seek)), <span class="prelude-val">Ok</span>(<span class="number">9</span>));
|
||
<span class="kw">let </span>seek = <span class="number">4</span>;
|
||
<span class="macro">assert_eq!</span>(s.binary_search_by(|probe| probe.cmp(<span class="kw-2">&</span>seek)), <span class="prelude-val">Err</span>(<span class="number">7</span>));
|
||
<span class="kw">let </span>seek = <span class="number">100</span>;
|
||
<span class="macro">assert_eq!</span>(s.binary_search_by(|probe| probe.cmp(<span class="kw-2">&</span>seek)), <span class="prelude-val">Err</span>(<span class="number">13</span>));
|
||
<span class="kw">let </span>seek = <span class="number">1</span>;
|
||
<span class="kw">let </span>r = s.binary_search_by(|probe| probe.cmp(<span class="kw-2">&</span>seek));
|
||
<span class="macro">assert!</span>(<span class="kw">match </span>r { <span class="prelude-val">Ok</span>(<span class="number">1</span>..=<span class="number">4</span>) => <span class="bool-val">true</span>, <span class="kw">_ </span>=> <span class="bool-val">false</span>, });</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.binary_search_by_key" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.10.0">1.10.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#2855-2858">source</a></span><h4 class="code-header">pub fn <a href="#method.binary_search_by_key" class="fn">binary_search_by_key</a><'a, B, F>(
|
||
&'a self,
|
||
b: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&B</a>,
|
||
f: F
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&'a T</a>) -> B,
|
||
B: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,</div></h4></section></summary><div class="docblock"><p>Binary searches this slice with a key extraction function.</p>
|
||
<p>Assumes that the slice is sorted by the key, for instance with
|
||
<a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.sort_by_key" title="method slice::sort_by_key"><code>sort_by_key</code></a> using the same key extraction function.
|
||
If the slice is not sorted by the key, the returned result is
|
||
unspecified and meaningless.</p>
|
||
<p>If the value is found then <a href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html#variant.Ok" title="variant core::result::Result::Ok"><code>Result::Ok</code></a> is returned, containing the
|
||
index of the matching element. If there are multiple matches, then any
|
||
one of the matches could be returned. The index is chosen
|
||
deterministically, but is subject to change in future versions of Rust.
|
||
If the value is not found then <a href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Result::Err</code></a> is returned, containing
|
||
the index where a matching element could be inserted while maintaining
|
||
sorted order.</p>
|
||
<p>See also <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.binary_search" title="method slice::binary_search"><code>binary_search</code></a>, <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.binary_search_by" title="method slice::binary_search_by"><code>binary_search_by</code></a>, and <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.partition_point" title="method slice::partition_point"><code>partition_point</code></a>.</p>
|
||
<h5 id="examples-42"><a class="doc-anchor" href="#examples-42">§</a>Examples</h5>
|
||
<p>Looks up a series of four elements in a slice of pairs sorted by
|
||
their second elements. The first is found, with a uniquely
|
||
determined position; the second and third are not found; the
|
||
fourth could match any position in <code>[1, 4]</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>s = [(<span class="number">0</span>, <span class="number">0</span>), (<span class="number">2</span>, <span class="number">1</span>), (<span class="number">4</span>, <span class="number">1</span>), (<span class="number">5</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">2</span>, <span class="number">3</span>), (<span class="number">4</span>, <span class="number">5</span>), (<span class="number">5</span>, <span class="number">8</span>), (<span class="number">3</span>, <span class="number">13</span>),
|
||
(<span class="number">1</span>, <span class="number">21</span>), (<span class="number">2</span>, <span class="number">34</span>), (<span class="number">4</span>, <span class="number">55</span>)];
|
||
|
||
<span class="macro">assert_eq!</span>(s.binary_search_by_key(<span class="kw-2">&</span><span class="number">13</span>, |<span class="kw-2">&</span>(a, b)| b), <span class="prelude-val">Ok</span>(<span class="number">9</span>));
|
||
<span class="macro">assert_eq!</span>(s.binary_search_by_key(<span class="kw-2">&</span><span class="number">4</span>, |<span class="kw-2">&</span>(a, b)| b), <span class="prelude-val">Err</span>(<span class="number">7</span>));
|
||
<span class="macro">assert_eq!</span>(s.binary_search_by_key(<span class="kw-2">&</span><span class="number">100</span>, |<span class="kw-2">&</span>(a, b)| b), <span class="prelude-val">Err</span>(<span class="number">13</span>));
|
||
<span class="kw">let </span>r = s.binary_search_by_key(<span class="kw-2">&</span><span class="number">1</span>, |<span class="kw-2">&</span>(a, b)| b);
|
||
<span class="macro">assert!</span>(<span class="kw">match </span>r { <span class="prelude-val">Ok</span>(<span class="number">1</span>..=<span class="number">4</span>) => <span class="bool-val">true</span>, <span class="kw">_ </span>=> <span class="bool-val">false</span>, });</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.align_to" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.30.0">1.30.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#3791">source</a></span><h4 class="code-header">pub unsafe fn <a href="#method.align_to" class="fn">align_to</a><U>(&self) -> (&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[U]</a>, &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>)</h4></section></summary><div class="docblock"><p>Transmute the slice to a slice of another type, ensuring alignment of the types is
|
||
maintained.</p>
|
||
<p>This method splits the slice into three distinct slices: prefix, correctly aligned middle
|
||
slice of a new type, and the suffix slice. How exactly the slice is split up is not
|
||
specified; the middle part may be smaller than necessary. However, if this fails to return a
|
||
maximal middle part, that is because code is running in a context where performance does not
|
||
matter, such as a sanitizer attempting to find alignment bugs. Regular code running
|
||
in a default (debug or release) execution <em>will</em> return a maximal middle part.</p>
|
||
<p>This method has no purpose when either input element <code>T</code> or output element <code>U</code> are
|
||
zero-sized and will return the original slice without splitting anything.</p>
|
||
<h5 id="safety-3"><a class="doc-anchor" href="#safety-3">§</a>Safety</h5>
|
||
<p>This method is essentially a <code>transmute</code> with respect to the elements in the returned
|
||
middle slice, so all the usual caveats pertaining to <code>transmute::<T, U></code> also apply here.</p>
|
||
<h5 id="examples-43"><a class="doc-anchor" href="#examples-43">§</a>Examples</h5>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">unsafe </span>{
|
||
<span class="kw">let </span>bytes: [u8; <span class="number">7</span>] = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>];
|
||
<span class="kw">let </span>(prefix, shorts, suffix) = bytes.align_to::<u16>();
|
||
<span class="comment">// less_efficient_algorithm_for_bytes(prefix);
|
||
// more_efficient_algorithm_for_aligned_shorts(shorts);
|
||
// less_efficient_algorithm_for_bytes(suffix);
|
||
</span>}</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_simd" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#3959-3963">source</a><h4 class="code-header">pub fn <a href="#method.as_simd" class="fn">as_simd</a><const LANES: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>(&self) -> (&<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>, &[<a class="struct" href="https://doc.rust-lang.org/1.77.0/core/core_simd/vector/struct.Simd.html" title="struct core::core_simd::vector::Simd">Simd</a><T, LANES>], &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>)<div class="where">where
|
||
<a class="struct" href="https://doc.rust-lang.org/1.77.0/core/core_simd/vector/struct.Simd.html" title="struct core::core_simd::vector::Simd">Simd</a><T, LANES>: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.array.html">[T; LANES]</a>>,
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/core_simd/vector/trait.SimdElement.html" title="trait core::core_simd::vector::SimdElement">SimdElement</a>,
|
||
<a class="struct" href="https://doc.rust-lang.org/1.77.0/core/core_simd/lane_count/struct.LaneCount.html" title="struct core::core_simd::lane_count::LaneCount">LaneCount</a><LANES>: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/core_simd/lane_count/trait.SupportedLaneCount.html" title="trait core::core_simd::lane_count::SupportedLaneCount">SupportedLaneCount</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>portable_simd</code>)</span></div></span></summary><div class="docblock"><p>Split a slice into a prefix, a middle of aligned SIMD types, and a suffix.</p>
|
||
<p>This is a safe wrapper around <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.align_to" title="method slice::align_to"><code>slice::align_to</code></a>, so has the same weak
|
||
postconditions as that method. You’re only assured that
|
||
<code>self.len() == prefix.len() + middle.len() * LANES + suffix.len()</code>.</p>
|
||
<p>Notably, all of the following are possible:</p>
|
||
<ul>
|
||
<li><code>prefix.len() >= LANES</code>.</li>
|
||
<li><code>middle.is_empty()</code> despite <code>self.len() >= 3 * LANES</code>.</li>
|
||
<li><code>suffix.len() >= LANES</code>.</li>
|
||
</ul>
|
||
<p>That said, this is a safe method, so if you’re only writing safe code,
|
||
then this can at most cause incorrect logic, not unsoundness.</p>
|
||
<h5 id="panics-10"><a class="doc-anchor" href="#panics-10">§</a>Panics</h5>
|
||
<p>This will panic if the size of the SIMD type is different from
|
||
<code>LANES</code> times that of the scalar.</p>
|
||
<p>At the time of writing, the trait restrictions on <code>Simd<T, LANES></code> keeps
|
||
that from ever happening, as only power-of-two numbers of lanes are
|
||
supported. It’s possible that, in the future, those restrictions might
|
||
be lifted in a way that would make it possible to see panics from this
|
||
method for something like <code>LANES == 3</code>.</p>
|
||
<h5 id="examples-44"><a class="doc-anchor" href="#examples-44">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(portable_simd)]
|
||
</span><span class="kw">use </span>core::simd::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>short = <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
|
||
<span class="kw">let </span>(prefix, middle, suffix) = short.as_simd::<<span class="number">4</span>>();
|
||
<span class="macro">assert_eq!</span>(middle, []); <span class="comment">// Not enough elements for anything in the middle
|
||
|
||
// They might be split in any possible way between prefix and suffix
|
||
</span><span class="kw">let </span>it = prefix.iter().chain(suffix).copied();
|
||
<span class="macro">assert_eq!</span>(it.collect::<Vec<<span class="kw">_</span>>>(), <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);
|
||
|
||
<span class="kw">fn </span>basic_simd_sum(x: <span class="kw-2">&</span>[f32]) -> f32 {
|
||
<span class="kw">use </span>std::ops::Add;
|
||
<span class="kw">let </span>(prefix, middle, suffix) = x.as_simd();
|
||
<span class="kw">let </span>sums = f32x4::from_array([
|
||
prefix.iter().copied().sum(),
|
||
<span class="number">0.0</span>,
|
||
<span class="number">0.0</span>,
|
||
suffix.iter().copied().sum(),
|
||
]);
|
||
<span class="kw">let </span>sums = middle.iter().copied().fold(sums, f32x4::add);
|
||
sums.reduce_sum()
|
||
}
|
||
|
||
<span class="kw">let </span>numbers: Vec<f32> = (<span class="number">1</span>..<span class="number">101</span>).map(|x| x <span class="kw">as _</span>).collect();
|
||
<span class="macro">assert_eq!</span>(basic_simd_sum(<span class="kw-2">&</span>numbers[<span class="number">1</span>..<span class="number">99</span>]), <span class="number">4949.0</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_sorted" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#4044-4046">source</a><h4 class="code-header">pub fn <a href="#method.is_sorted" class="fn">is_sorted</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>is_sorted</code>)</span></div></span></summary><div class="docblock"><p>Checks if the elements of this slice are sorted.</p>
|
||
<p>That is, for each element <code>a</code> and its following element <code>b</code>, <code>a <= b</code> must hold. If the
|
||
slice yields exactly zero or one element, <code>true</code> is returned.</p>
|
||
<p>Note that if <code>Self::Item</code> is only <code>PartialOrd</code>, but not <code>Ord</code>, the above definition
|
||
implies that this function returns <code>false</code> if any two consecutive items are not
|
||
comparable.</p>
|
||
<h5 id="examples-45"><a class="doc-anchor" href="#examples-45">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(is_sorted)]
|
||
</span><span class="kw">let </span>empty: [i32; <span class="number">0</span>] = [];
|
||
|
||
<span class="macro">assert!</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">9</span>].is_sorted());
|
||
<span class="macro">assert!</span>(![<span class="number">1</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">4</span>].is_sorted());
|
||
<span class="macro">assert!</span>([<span class="number">0</span>].is_sorted());
|
||
<span class="macro">assert!</span>(empty.is_sorted());
|
||
<span class="macro">assert!</span>(![<span class="number">0.0</span>, <span class="number">1.0</span>, f32::NAN].is_sorted());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_sorted_by" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#4073-4075">source</a><h4 class="code-header">pub fn <a href="#method.is_sorted_by" class="fn">is_sorted_by</a><'a, F>(&'a self, compare: F) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&'a T</a>, <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&'a T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>is_sorted</code>)</span></div></span></summary><div class="docblock"><p>Checks if the elements of this slice are sorted using the given comparator function.</p>
|
||
<p>Instead of using <code>PartialOrd::partial_cmp</code>, this function uses the given <code>compare</code>
|
||
function to determine whether two elements are to be considered in sorted order.</p>
|
||
<h5 id="examples-46"><a class="doc-anchor" href="#examples-46">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(is_sorted)]
|
||
|
||
</span><span class="macro">assert!</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">9</span>].is_sorted_by(|a, b| a <= b));
|
||
<span class="macro">assert!</span>(![<span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">9</span>].is_sorted_by(|a, b| a < b));
|
||
|
||
<span class="macro">assert!</span>([<span class="number">0</span>].is_sorted_by(|a, b| <span class="bool-val">true</span>));
|
||
<span class="macro">assert!</span>([<span class="number">0</span>].is_sorted_by(|a, b| <span class="bool-val">false</span>));
|
||
|
||
<span class="kw">let </span>empty: [i32; <span class="number">0</span>] = [];
|
||
<span class="macro">assert!</span>(empty.is_sorted_by(|a, b| <span class="bool-val">false</span>));
|
||
<span class="macro">assert!</span>(empty.is_sorted_by(|a, b| <span class="bool-val">true</span>));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_sorted_by_key" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#4099-4102">source</a><h4 class="code-header">pub fn <a href="#method.is_sorted_by_key" class="fn">is_sorted_by_key</a><'a, F, K>(&'a self, f: F) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&'a T</a>) -> K,
|
||
K: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>is_sorted</code>)</span></div></span></summary><div class="docblock"><p>Checks if the elements of this slice are sorted using the given key extraction function.</p>
|
||
<p>Instead of comparing the slice’s elements directly, this function compares the keys of the
|
||
elements, as determined by <code>f</code>. Apart from that, it’s equivalent to <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.is_sorted" title="method slice::is_sorted"><code>is_sorted</code></a>; see its
|
||
documentation for more information.</p>
|
||
<h5 id="examples-47"><a class="doc-anchor" href="#examples-47">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(is_sorted)]
|
||
|
||
</span><span class="macro">assert!</span>([<span class="string">"c"</span>, <span class="string">"bb"</span>, <span class="string">"aaa"</span>].is_sorted_by_key(|s| s.len()));
|
||
<span class="macro">assert!</span>(![-<span class="number">2i32</span>, -<span class="number">1</span>, <span class="number">0</span>, <span class="number">3</span>].is_sorted_by_key(|n| n.abs()));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.partition_point" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.52.0">1.52.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#4158-4160">source</a></span><h4 class="code-header">pub fn <a href="#method.partition_point" class="fn">partition_point</a><P>(&self, pred: P) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a><div class="where">where
|
||
P: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class="docblock"><p>Returns the index of the partition point according to the given predicate
|
||
(the index of the first element of the second partition).</p>
|
||
<p>The slice is assumed to be partitioned according to the given predicate.
|
||
This means that all elements for which the predicate returns true are at the start of the slice
|
||
and all elements for which the predicate returns false are at the end.
|
||
For example, <code>[7, 15, 3, 5, 4, 12, 6]</code> is partitioned under the predicate <code>x % 2 != 0</code>
|
||
(all odd numbers are at the start, all even at the end).</p>
|
||
<p>If this slice is not partitioned, the returned result is unspecified and meaningless,
|
||
as this method performs a kind of binary search.</p>
|
||
<p>See also <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.binary_search" title="method slice::binary_search"><code>binary_search</code></a>, <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.binary_search_by" title="method slice::binary_search_by"><code>binary_search_by</code></a>, and <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.binary_search_by_key" title="method slice::binary_search_by_key"><code>binary_search_by_key</code></a>.</p>
|
||
<h5 id="examples-48"><a class="doc-anchor" href="#examples-48">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>];
|
||
<span class="kw">let </span>i = v.partition_point(|<span class="kw-2">&</span>x| x < <span class="number">5</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(i, <span class="number">4</span>);
|
||
<span class="macro">assert!</span>(v[..i].iter().all(|<span class="kw-2">&</span>x| x < <span class="number">5</span>));
|
||
<span class="macro">assert!</span>(v[i..].iter().all(|<span class="kw-2">&</span>x| !(x < <span class="number">5</span>)));</code></pre></div>
|
||
<p>If all elements of the slice match the predicate, including if the slice
|
||
is empty, then the length of the slice will be returned:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>a = [<span class="number">2</span>, <span class="number">4</span>, <span class="number">8</span>];
|
||
<span class="macro">assert_eq!</span>(a.partition_point(|x| x < <span class="kw-2">&</span><span class="number">100</span>), a.len());
|
||
<span class="kw">let </span>a: [i32; <span class="number">0</span>] = [];
|
||
<span class="macro">assert_eq!</span>(a.partition_point(|x| x < <span class="kw-2">&</span><span class="number">100</span>), <span class="number">0</span>);</code></pre></div>
|
||
<p>If you want to insert an item to a sorted vector, while maintaining
|
||
sort order:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>s = <span class="macro">vec!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">55</span>];
|
||
<span class="kw">let </span>num = <span class="number">42</span>;
|
||
<span class="kw">let </span>idx = s.partition_point(|<span class="kw-2">&</span>x| x < num);
|
||
s.insert(idx, num);
|
||
<span class="macro">assert_eq!</span>(s, [<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">42</span>, <span class="number">55</span>]);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_ascii" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.23.0">1.23.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/ascii.rs.html#17">source</a></span><h4 class="code-header">pub fn <a href="#method.is_ascii" class="fn">is_ascii</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Checks if all bytes in this slice are within the ASCII range.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_ascii" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/ascii.rs.html#26">source</a><h4 class="code-header">pub fn <a href="#method.as_ascii" class="fn">as_ascii</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&[<a class="enum" href="https://doc.rust-lang.org/1.77.0/core/ascii/ascii_char/enum.AsciiChar.html" title="enum core::ascii::ascii_char::AsciiChar">AsciiChar</a>]></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>ascii_char</code>)</span></div></span></summary><div class="docblock"><p>If this slice <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.is_ascii" title="method slice::is_ascii"><code>is_ascii</code></a>, returns it as a slice of
|
||
<a href="https://doc.rust-lang.org/1.77.0/core/ascii/ascii_char/enum.AsciiChar.html" title="enum core::ascii::ascii_char::AsciiChar">ASCII characters</a>, otherwise returns <code>None</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_ascii_unchecked" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/ascii.rs.html#44">source</a><h4 class="code-header">pub unsafe fn <a href="#method.as_ascii_unchecked" class="fn">as_ascii_unchecked</a>(&self) -> &[<a class="enum" href="https://doc.rust-lang.org/1.77.0/core/ascii/ascii_char/enum.AsciiChar.html" title="enum core::ascii::ascii_char::AsciiChar">AsciiChar</a>]</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>ascii_char</code>)</span></div></span></summary><div class="docblock"><p>Converts this slice of bytes into a slice of ASCII characters,
|
||
without checking whether they’re valid.</p>
|
||
<h5 id="safety-4"><a class="doc-anchor" href="#safety-4">§</a>Safety</h5>
|
||
<p>Every byte in the slice must be in <code>0..=127</code>, or else this is UB.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.eq_ignore_ascii_case" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.23.0">1.23.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/ascii.rs.html#58">source</a></span><h4 class="code-header">pub fn <a href="#method.eq_ignore_ascii_case" class="fn">eq_ignore_ascii_case</a>(&self, other: &[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Checks that two slices are an ASCII case-insensitive match.</p>
|
||
<p>Same as <code>to_ascii_lowercase(a) == to_ascii_lowercase(b)</code>,
|
||
but without allocating and copying temporaries.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.escape_ascii" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.60.0">1.60.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/slice/ascii.rs.html#110">source</a></span><h4 class="code-header">pub fn <a href="#method.escape_ascii" class="fn">escape_ascii</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/ascii/struct.EscapeAscii.html" title="struct core::slice::ascii::EscapeAscii">EscapeAscii</a><'_> <a href="#" class="tooltip" data-notable-ty="EscapeAscii<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns an iterator that produces an escaped version of this slice,
|
||
treating it as an ASCII string.</p>
|
||
<h5 id="examples-49"><a class="doc-anchor" href="#examples-49">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>
|
||
<span class="kw">let </span>s = <span class="string">b"0\t\r\n'\"\\\x9d"</span>;
|
||
<span class="kw">let </span>escaped = s.escape_ascii().to_string();
|
||
<span class="macro">assert_eq!</span>(escaped, <span class="string">"0\\t\\r\\n\\'\\\"\\\\\\x9d"</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.trim_ascii_start" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/ascii.rs.html#130">source</a><h4 class="code-header">pub fn <a href="#method.trim_ascii_start" class="fn">trim_ascii_start</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>byte_slice_trim_ascii</code>)</span></div></span></summary><div class="docblock"><p>Returns a byte slice with leading ASCII whitespace bytes removed.</p>
|
||
<p>‘Whitespace’ refers to the definition used by
|
||
<code>u8::is_ascii_whitespace</code>.</p>
|
||
<h5 id="examples-50"><a class="doc-anchor" href="#examples-50">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(byte_slice_trim_ascii)]
|
||
|
||
</span><span class="macro">assert_eq!</span>(<span class="string">b" \t hello world\n"</span>.trim_ascii_start(), <span class="string">b"hello world\n"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="string">b" "</span>.trim_ascii_start(), <span class="string">b""</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="string">b""</span>.trim_ascii_start(), <span class="string">b""</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.trim_ascii_end" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/ascii.rs.html#160">source</a><h4 class="code-header">pub fn <a href="#method.trim_ascii_end" class="fn">trim_ascii_end</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>byte_slice_trim_ascii</code>)</span></div></span></summary><div class="docblock"><p>Returns a byte slice with trailing ASCII whitespace bytes removed.</p>
|
||
<p>‘Whitespace’ refers to the definition used by
|
||
<code>u8::is_ascii_whitespace</code>.</p>
|
||
<h5 id="examples-51"><a class="doc-anchor" href="#examples-51">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(byte_slice_trim_ascii)]
|
||
|
||
</span><span class="macro">assert_eq!</span>(<span class="string">b"\r hello world\n "</span>.trim_ascii_end(), <span class="string">b"\r hello world"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="string">b" "</span>.trim_ascii_end(), <span class="string">b""</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="string">b""</span>.trim_ascii_end(), <span class="string">b""</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.trim_ascii" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/ascii.rs.html#191">source</a><h4 class="code-header">pub fn <a href="#method.trim_ascii" class="fn">trim_ascii</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>byte_slice_trim_ascii</code>)</span></div></span></summary><div class="docblock"><p>Returns a byte slice with leading and trailing ASCII whitespace bytes
|
||
removed.</p>
|
||
<p>‘Whitespace’ refers to the definition used by
|
||
<code>u8::is_ascii_whitespace</code>.</p>
|
||
<h5 id="examples-52"><a class="doc-anchor" href="#examples-52">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(byte_slice_trim_ascii)]
|
||
|
||
</span><span class="macro">assert_eq!</span>(<span class="string">b"\r hello world\n "</span>.trim_ascii(), <span class="string">b"hello world"</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="string">b" "</span>.trim_ascii(), <span class="string">b""</span>);
|
||
<span class="macro">assert_eq!</span>(<span class="string">b""</span>.trim_ascii(), <span class="string">b""</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.flatten" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/slice/mod.rs.html#4517">source</a><h4 class="code-header">pub fn <a href="#method.flatten" class="fn">flatten</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_flatten</code>)</span></div></span></summary><div class="docblock"><p>Takes a <code>&[[T; N]]</code>, and flattens it to a <code>&[T]</code>.</p>
|
||
<h5 id="panics-11"><a class="doc-anchor" href="#panics-11">§</a>Panics</h5>
|
||
<p>This panics if the length of the resulting slice would overflow a <code>usize</code>.</p>
|
||
<p>This is only possible when flattening a slice of arrays of zero-sized
|
||
types, and thus tends to be irrelevant in practice. If
|
||
<code>size_of::<T>() > 0</code>, this will never panic.</p>
|
||
<h5 id="examples-53"><a class="doc-anchor" href="#examples-53">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(slice_flatten)]
|
||
|
||
</span><span class="macro">assert_eq!</span>([[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], [<span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]].flatten(), <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
|
||
|
||
<span class="macro">assert_eq!</span>(
|
||
[[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], [<span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]].flatten(),
|
||
[[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>], [<span class="number">5</span>, <span class="number">6</span>]].flatten(),
|
||
);
|
||
|
||
<span class="kw">let </span>slice_of_empty_arrays: <span class="kw-2">&</span>[[i32; <span class="number">0</span>]] = <span class="kw-2">&</span>[[], [], [], [], []];
|
||
<span class="macro">assert!</span>(slice_of_empty_arrays.flatten().is_empty());
|
||
|
||
<span class="kw">let </span>empty_slice_of_arrays: <span class="kw-2">&</span>[[u32; <span class="number">10</span>]] = <span class="kw-2">&</span>[];
|
||
<span class="macro">assert!</span>(empty_slice_of_arrays.flatten().is_empty());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_str" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/ascii/ascii_char.rs.html#560">source</a><h4 class="code-header">pub fn <a href="#method.as_str" class="fn">as_str</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>ascii_char</code>)</span></div></span></summary><div class="docblock"><p>Views this slice of ASCII characters as a UTF-8 <code>str</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.as_bytes" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/ascii/ascii_char.rs.html#571">source</a><h4 class="code-header">pub fn <a href="#method.as_bytes" class="fn">as_bytes</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>ascii_char</code>)</span></div></span></summary><div class="docblock"><p>Views this slice of ASCII characters as a slice of <code>u8</code> bytes.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_ascii_uppercase" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.23.0">1.23.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/alloc/slice.rs.html#621">source</a></span><h4 class="code-header">pub fn <a href="#method.to_ascii_uppercase" class="fn">to_ascii_uppercase</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>> <a href="#" class="tooltip" data-notable-ty="Vec<u8>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns a vector containing a copy of this slice where each byte
|
||
is mapped to its ASCII upper case equivalent.</p>
|
||
<p>ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’,
|
||
but non-ASCII letters are unchanged.</p>
|
||
<p>To uppercase the value in-place, use <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.make_ascii_uppercase" title="method slice::make_ascii_uppercase"><code>make_ascii_uppercase</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_ascii_lowercase" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.23.0">1.23.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/alloc/slice.rs.html#642">source</a></span><h4 class="code-header">pub fn <a href="#method.to_ascii_lowercase" class="fn">to_ascii_lowercase</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>> <a href="#" class="tooltip" data-notable-ty="Vec<u8>">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns a vector containing a copy of this slice where each byte
|
||
is mapped to its ASCII lower case equivalent.</p>
|
||
<p>ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’,
|
||
but non-ASCII letters are unchanged.</p>
|
||
<p>To lowercase the value in-place, use <a href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html#method.make_ascii_lowercase" title="method slice::make_ascii_lowercase"><code>make_ascii_lowercase</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_vec" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/alloc/slice.rs.html#412-414">source</a></span><h4 class="code-header">pub fn <a href="#method.to_vec" class="fn">to_vec</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><T><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Copies <code>self</code> into a new <code>Vec</code>.</p>
|
||
<h5 id="examples-54"><a class="doc-anchor" href="#examples-54">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>s = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="kw">let </span>x = s.to_vec();
|
||
<span class="comment">// Here, `s` and `x` can be modified independently.</span></code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_vec_in" class="method"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/alloc/slice.rs.html#436-438">source</a><h4 class="code-header">pub fn <a href="#method.to_vec_in" class="fn">to_vec_in</a><A>(&self, alloc: A) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><T, A><div class="where">where
|
||
A: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>allocator_api</code>)</span></div></span></summary><div class="docblock"><p>Copies <code>self</code> into a new <code>Vec</code> with an allocator.</p>
|
||
<h5 id="examples-55"><a class="doc-anchor" href="#examples-55">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attr">#![feature(allocator_api)]
|
||
|
||
</span><span class="kw">use </span>std::alloc::System;
|
||
|
||
<span class="kw">let </span>s = [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
||
<span class="kw">let </span>x = s.to_vec_in(System);
|
||
<span class="comment">// Here, `s` and `x` can be modified independently.</span></code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.repeat" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.40.0">1.40.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/alloc/slice.rs.html#489-491">source</a></span><h4 class="code-header">pub fn <a href="#method.repeat" class="fn">repeat</a>(&self, n: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><T><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a>,</div></h4></section></summary><div class="docblock"><p>Creates a vector by copying a slice <code>n</code> times.</p>
|
||
<h5 id="panics-12"><a class="doc-anchor" href="#panics-12">§</a>Panics</h5>
|
||
<p>This function will panic if the capacity would overflow.</p>
|
||
<h5 id="examples-56"><a class="doc-anchor" href="#examples-56">§</a>Examples</h5>
|
||
<p>Basic usage:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>([<span class="number">1</span>, <span class="number">2</span>].repeat(<span class="number">3</span>), <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">2</span>]);</code></pre></div>
|
||
<p>A panic upon overflow:</p>
|
||
|
||
<div class="example-wrap should_panic"><a href="#" class="tooltip" title="This example panics">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="comment">// this will panic at runtime
|
||
</span><span class="string">b"0123456789abcdef"</span>.repeat(usize::MAX);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.concat" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/alloc/slice.rs.html#557-559">source</a></span><h4 class="code-header">pub fn <a href="#method.concat" class="fn">concat</a><Item>(&self) -> <<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a> as <a class="trait" href="https://doc.rust-lang.org/1.77.0/alloc/slice/trait.Concat.html" title="trait alloc::slice::Concat">Concat</a><Item>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.0/alloc/slice/trait.Concat.html#associatedtype.Output" title="type alloc::slice::Concat::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="<[T] as Concat<Item>>::Output">ⓘ</a><div class="where">where
|
||
<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>: <a class="trait" href="https://doc.rust-lang.org/1.77.0/alloc/slice/trait.Concat.html" title="trait alloc::slice::Concat">Concat</a><Item>,
|
||
Item: ?<a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Flattens a slice of <code>T</code> into a single value <code>Self::Output</code>.</p>
|
||
<h5 id="examples-57"><a class="doc-anchor" href="#examples-57">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>([<span class="string">"hello"</span>, <span class="string">"world"</span>].concat(), <span class="string">"helloworld"</span>);
|
||
<span class="macro">assert_eq!</span>([[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]].concat(), [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.join" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/alloc/slice.rs.html#576-578">source</a></span><h4 class="code-header">pub fn <a href="#method.join" class="fn">join</a><Separator>(
|
||
&self,
|
||
sep: Separator
|
||
) -> <<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a> as <a class="trait" href="https://doc.rust-lang.org/1.77.0/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a><Separator>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.0/alloc/slice/trait.Join.html#associatedtype.Output" title="type alloc::slice::Join::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="<[T] as Join<Separator>>::Output">ⓘ</a><div class="where">where
|
||
<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>: <a class="trait" href="https://doc.rust-lang.org/1.77.0/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a><Separator>,</div></h4></section></summary><div class="docblock"><p>Flattens a slice of <code>T</code> into a single value <code>Self::Output</code>, placing a
|
||
given separator between each.</p>
|
||
<h5 id="examples-58"><a class="doc-anchor" href="#examples-58">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>([<span class="string">"hello"</span>, <span class="string">"world"</span>].join(<span class="string">" "</span>), <span class="string">"hello world"</span>);
|
||
<span class="macro">assert_eq!</span>([[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]].join(<span class="kw-2">&</span><span class="number">0</span>), [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">4</span>]);
|
||
<span class="macro">assert_eq!</span>([[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]].join(<span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">0</span>][..]), [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">4</span>]);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/alloc/slice.rs.html#596-598">source</a></span><h4 class="code-header">pub fn <a href="#method.connect" class="fn">connect</a><Separator>(
|
||
&self,
|
||
sep: Separator
|
||
) -> <<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a> as <a class="trait" href="https://doc.rust-lang.org/1.77.0/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a><Separator>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.0/alloc/slice/trait.Join.html#associatedtype.Output" title="type alloc::slice::Join::Output">Output</a> <a href="#" class="tooltip" data-notable-ty="<[T] as Join<Separator>>::Output">ⓘ</a><div class="where">where
|
||
<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.slice.html">[T]</a>: <a class="trait" href="https://doc.rust-lang.org/1.77.0/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a><Separator>,</div></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 1.3.0: renamed to join</span></div></span></summary><div class="docblock"><p>Flattens a slice of <code>T</code> into a single value <code>Self::Output</code>, placing a
|
||
given separator between each.</p>
|
||
<h5 id="examples-59"><a class="doc-anchor" href="#examples-59">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>([<span class="string">"hello"</span>, <span class="string">"world"</span>].connect(<span class="string">" "</span>), <span class="string">"hello world"</span>);
|
||
<span class="macro">assert_eq!</span>([[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]].connect(<span class="kw-2">&</span><span class="number">0</span>), [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">4</span>]);</code></pre></div>
|
||
</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-AsBStr-for-%26BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#1998-2003">source</a><a href="#impl-AsBStr-for-%26BStr" class="anchor">§</a><h3 class="code-header">impl<'a> <a class="trait" href="trait.AsBStr.html" title="trait winnow::stream::AsBStr">AsBStr</a> for &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_bstr" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2000-2002">source</a><a href="#method.as_bstr" class="anchor">§</a><h4 class="code-header">fn <a href="trait.AsBStr.html#tymethod.as_bstr" class="fn">as_bstr</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section></summary><div class='docblock'>Casts the input type to a byte slice</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRef%3C%5Bu8%5D%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#405-410">source</a><a href="#impl-AsRef%3C%5Bu8%5D%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ref-2" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#407-409">source</a><a href="#method.as_ref-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/convert/trait.AsRef.html#tymethod.as_ref" class="fn">as_ref</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRef%3CBStr%3E-for-%5Bu8%5D" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#412-417">source</a><a href="#impl-AsRef%3CBStr%3E-for-%5Bu8%5D" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>> for [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ref" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#414-416">source</a><a href="#method.as_ref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/convert/trait.AsRef.html#tymethod.as_ref" class="fn">as_ref</a>(&self) -> &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRef%3CBStr%3E-for-str" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#419-424">source</a><a href="#impl-AsRef%3CBStr%3E-for-str" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>> for <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_ref-1" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#421-423">source</a><a href="#method.as_ref-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/convert/trait.AsRef.html#tymethod.as_ref" class="fn">as_ref</a>(&self) -> &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Borrow%3CBStr%3E-for-Vec%3Cu8%3E" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#437-442">source</a><a href="#impl-Borrow%3CBStr%3E-for-Vec%3Cu8%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>> for <a class="struct" href="https://doc.rust-lang.org/1.77.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>></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="../../src/winnow/stream/impls.rs.html#439-441">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Compare%3CT%3E-for-%26BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2222-2231">source</a><a href="#impl-Compare%3CT%3E-for-%26BStr" class="anchor">§</a><h3 class="code-header">impl<'a, T> <a class="trait" href="trait.Compare.html" title="trait winnow::stream::Compare">Compare</a><T> for &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a><div class="where">where
|
||
&'a [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]: <a class="trait" href="trait.Compare.html" title="trait winnow::stream::Compare">Compare</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.compare" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2227-2230">source</a><a href="#method.compare" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Compare.html#tymethod.compare" class="fn">compare</a>(&self, t: T) -> <a class="enum" href="enum.CompareResult.html" title="enum winnow::stream::CompareResult">CompareResult</a></h4></section></summary><div class='docblock'>Compares self to another value for equality</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#316-331">source</a><a href="#impl-Debug-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</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/winnow/stream/impls.rs.html#318-330">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.77.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.77.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-%26BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#444-448">source</a><a href="#impl-Default-for-%26BStr" class="anchor">§</a><h3 class="code-header">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#445-447">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.77.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Deref-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#333-340">source</a><a href="#impl-Deref-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Target" class="associatedtype trait-impl"><a href="#associatedtype.Target" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.0/core/ops/deref/trait.Deref.html#associatedtype.Target" class="associatedtype">Target</a> = [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]</h4></section></summary><div class='docblock'>The resulting type after dereferencing.</div></details><details class="toggle method-toggle" open><summary><section id="method.deref" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#337-339">source</a><a href="#method.deref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/ops/deref/trait.Deref.html#tymethod.deref" class="fn">deref</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section></summary><div class='docblock'>Dereferences the value.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Display-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#309-314">source</a><a href="#impl-Display-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-1" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#311-313">source</a><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/fmt/trait.Display.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.77.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.77.0/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FindSlice%3CS%3E-for-%26BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2494-2504">source</a><a href="#impl-FindSlice%3CS%3E-for-%26BStr" class="anchor">§</a><h3 class="code-header">impl<'i, S> <a class="trait" href="trait.FindSlice.html" title="trait winnow::stream::FindSlice">FindSlice</a><S> for &'i <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a><div class="where">where
|
||
&'i [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]: <a class="trait" href="trait.FindSlice.html" title="trait winnow::stream::FindSlice">FindSlice</a><S>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.find_slice" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2499-2503">source</a><a href="#method.find_slice" class="anchor">§</a><h4 class="code-header">fn <a href="trait.FindSlice.html#tymethod.find_slice" class="fn">find_slice</a>(&self, substr: S) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>></h4></section></summary><div class='docblock'>Returns the offset of the slice if it is found</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3C%26%5Bu8%5D%3E-for-%26BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#450-455">source</a><a href="#impl-From%3C%26%5Bu8%5D%3E-for-%26BStr" class="anchor">§</a><h3 class="code-header">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><&'a [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]> for &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-2" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#452-454">source</a><a href="#method.from-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(s: &'a [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]) -> &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3C%26BStr%3E-for-%26%5Bu8%5D" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#457-462">source</a><a href="#impl-From%3C%26BStr%3E-for-%26%5Bu8%5D" class="anchor">§</a><h3 class="code-header">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><&'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>> for &'a [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#459-461">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(s: &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>) -> &'a [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&'a [u8]">ⓘ</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3C%26str%3E-for-%26BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#464-469">source</a><a href="#impl-From%3C%26str%3E-for-%26BStr" class="anchor">§</a><h3 class="code-header">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><&'a <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>> for &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#466-468">source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(s: &'a <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -> &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Hash-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#75">source</a><a href="#impl-Hash-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.hash" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#75">source</a><a href="#method.hash" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/hash/trait.Hash.html#tymethod.hash" class="fn">hash</a><__H: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>>(&self, state: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&mut __H</a>)</h4></section></summary><div class='docblock'>Feeds this value into the given <a href="https://doc.rust-lang.org/1.77.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.77.0/core/hash/trait.Hash.html#tymethod.hash">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Index%3CRange%3Cusize%3E%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#360-367">source</a><a href="#impl-Index%3CRange%3Cusize%3E%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a><<a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl"><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#364-366">source</a><a href="#method.index" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index" class="fn">index</a>(&self, r: <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>) -> &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Index%3CRangeFrom%3Cusize%3E%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#378-385">source</a><a href="#impl-Index%3CRangeFrom%3Cusize%3E%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a><<a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.RangeFrom.html" title="struct core::ops::range::RangeFrom">RangeFrom</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-6" class="associatedtype trait-impl"><a href="#associatedtype.Output-6" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-6" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#382-384">source</a><a href="#method.index-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index" class="fn">index</a>(&self, r: <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.RangeFrom.html" title="struct core::ops::range::RangeFrom">RangeFrom</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>) -> &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Index%3CRangeFull%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#351-358">source</a><a href="#impl-Index%3CRangeFull%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a><<a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.RangeFull.html" title="struct core::ops::range::RangeFull">RangeFull</a>> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-1" class="associatedtype trait-impl"><a href="#associatedtype.Output-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-1" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#355-357">source</a><a href="#method.index-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index" class="fn">index</a>(&self, _: <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.RangeFull.html" title="struct core::ops::range::RangeFull">RangeFull</a>) -> &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Index%3CRangeInclusive%3Cusize%3E%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#369-376">source</a><a href="#impl-Index%3CRangeInclusive%3Cusize%3E%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a><<a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.RangeInclusive.html" title="struct core::ops::range::RangeInclusive">RangeInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-5" class="associatedtype trait-impl"><a href="#associatedtype.Output-5" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-5" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#373-375">source</a><a href="#method.index-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index" class="fn">index</a>(&self, r: <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.RangeInclusive.html" title="struct core::ops::range::RangeInclusive">RangeInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>) -> &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Index%3CRangeTo%3Cusize%3E%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#387-394">source</a><a href="#impl-Index%3CRangeTo%3Cusize%3E%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a><<a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.RangeTo.html" title="struct core::ops::range::RangeTo">RangeTo</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-4" class="associatedtype trait-impl"><a href="#associatedtype.Output-4" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-4" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#391-393">source</a><a href="#method.index-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index" class="fn">index</a>(&self, r: <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.RangeTo.html" title="struct core::ops::range::RangeTo">RangeTo</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>) -> &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Index%3CRangeToInclusive%3Cusize%3E%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#396-403">source</a><a href="#impl-Index%3CRangeToInclusive%3Cusize%3E%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a><<a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.RangeToInclusive.html" title="struct core::ops::range::RangeToInclusive">RangeToInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-2" class="associatedtype trait-impl"><a href="#associatedtype.Output-2" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-2" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#400-402">source</a><a href="#method.index-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index" class="fn">index</a>(&self, r: <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/ops/range/struct.RangeToInclusive.html" title="struct core::ops::range::RangeToInclusive">RangeToInclusive</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>>) -> &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Index%3Cusize%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#342-349">source</a><a href="#impl-Index%3Cusize%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-3" class="associatedtype trait-impl"><a href="#associatedtype.Output-3" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="toggle method-toggle" open><summary><section id="method.index-3" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#346-348">source</a><a href="#method.index-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index" class="fn">index</a>(&self, idx: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -> &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/1.77.0/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Offset%3C%3C%26BStr+as+Stream%3E::Checkpoint%3E-for-%26BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#1800-1805">source</a><a href="#impl-Offset%3C%3C%26BStr+as+Stream%3E::Checkpoint%3E-for-%26BStr" class="anchor">§</a><h3 class="code-header">impl<'a> <a class="trait" href="trait.Offset.html" title="trait winnow::stream::Offset">Offset</a><<&'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a> as <a class="trait" href="trait.Stream.html" title="trait winnow::stream::Stream">Stream</a>>::<a class="associatedtype" href="trait.Stream.html#associatedtype.Checkpoint" title="type winnow::stream::Stream::Checkpoint">Checkpoint</a>> for &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.offset_from" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#1802-1804">source</a><a href="#method.offset_from" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Offset.html#tymethod.offset_from" class="fn">offset_from</a>(&self, other: &<&'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a> as <a class="trait" href="trait.Stream.html" title="trait winnow::stream::Stream">Stream</a>>::<a class="associatedtype" href="trait.Stream.html#associatedtype.Checkpoint" title="type winnow::stream::Stream::Checkpoint">Checkpoint</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Offset between the first byte of <code>start</code> and the first byte of <code>self</code>a <a href="trait.Offset.html#tymethod.offset_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Offset-for-%26BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#1793-1798">source</a><a href="#impl-Offset-for-%26BStr" class="anchor">§</a><h3 class="code-header">impl<'a> <a class="trait" href="trait.Offset.html" title="trait winnow::stream::Offset">Offset</a> for &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.offset_from-1" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#1795-1797">source</a><a href="#method.offset_from-1" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Offset.html#tymethod.offset_from" class="fn">offset_from</a>(&self, start: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Self</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Offset between the first byte of <code>start</code> and the first byte of <code>self</code>a <a href="trait.Offset.html#tymethod.offset_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Ord-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#492-497">source</a><a href="#impl-Ord-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#494-496">source</a><a href="#method.cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.Ord.html#tymethod.cmp" class="fn">cmp</a>(&self, other: &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h4></section></summary><div class='docblock'>This method returns an <a href="https://doc.rust-lang.org/1.77.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering"><code>Ordering</code></a> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3C%26%5Bu8%5D%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#481">source</a><a href="#impl-PartialEq%3C%26%5Bu8%5D%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><&'a [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-1" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#481">source</a><a href="#method.eq-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &&'a [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
|
||
by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-1" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#242">source</a></span><a href="#method.ne-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
|
||
sufficient, and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3C%26str%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#483">source</a><a href="#impl-PartialEq%3C%26str%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><&'a <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-4" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#483">source</a><a href="#method.eq-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &&'a <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
|
||
by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-4" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#242">source</a></span><a href="#method.ne-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
|
||
sufficient, and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3C%5Bu8%5D%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#480">source</a><a href="#impl-PartialEq%3C%5Bu8%5D%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-7" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#480">source</a><a href="#method.eq-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
|
||
by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-7" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#242">source</a></span><a href="#method.ne-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
|
||
sufficient, and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CBStr%3E-for-%26%5Bu8%5D" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#481">source</a><a href="#impl-PartialEq%3CBStr%3E-for-%26%5Bu8%5D" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>> for &'a [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-2" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#481">source</a><a href="#method.eq-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
|
||
by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-2" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#242">source</a></span><a href="#method.ne-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
|
||
sufficient, and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CBStr%3E-for-%26str" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#483">source</a><a href="#impl-PartialEq%3CBStr%3E-for-%26str" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>> for &'a <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-6" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#483">source</a><a href="#method.eq-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
|
||
by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-6" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#242">source</a></span><a href="#method.ne-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
|
||
sufficient, and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CBStr%3E-for-%5Bu8%5D" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#480">source</a><a href="#impl-PartialEq%3CBStr%3E-for-%5Bu8%5D" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>> for [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-8" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#480">source</a><a href="#method.eq-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
|
||
by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-8" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#242">source</a></span><a href="#method.ne-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
|
||
sufficient, and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CBStr%3E-for-str" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#482">source</a><a href="#impl-PartialEq%3CBStr%3E-for-str" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>> for <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#482">source</a><a href="#method.eq" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
|
||
by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#242">source</a></span><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
|
||
sufficient, and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3Cstr%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#482">source</a><a href="#impl-PartialEq%3Cstr%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-3" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#482">source</a><a href="#method.eq-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
|
||
by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-3" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#242">source</a></span><a href="#method.ne-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
|
||
sufficient, and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#473-478">source</a><a href="#impl-PartialEq-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq-5" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#475-477">source</a><a href="#method.eq-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
|
||
by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne-5" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#242">source</a></span><a href="#method.ne-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
|
||
sufficient, and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3C%26%5Bu8%5D%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#500">source</a><a href="#impl-PartialOrd%3C%26%5Bu8%5D%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><&'a [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-5" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#500">source</a><a href="#method.partial_cmp-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &&'a [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/1.77.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-5" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1127">source</a></span><a href="#method.lt-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-5" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1144">source</a></span><a href="#method.le-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-5" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1160">source</a></span><a href="#method.gt-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-5" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1177">source</a></span><a href="#method.ge-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3C%26str%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#502">source</a><a href="#impl-PartialOrd%3C%26str%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><&'a <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-7" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#502">source</a><a href="#method.partial_cmp-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &&'a <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/1.77.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-7" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1127">source</a></span><a href="#method.lt-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-7" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1144">source</a></span><a href="#method.le-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-7" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1160">source</a></span><a href="#method.gt-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-7" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1177">source</a></span><a href="#method.ge-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3C%5Bu8%5D%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#499">source</a><a href="#impl-PartialOrd%3C%5Bu8%5D%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-6" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#499">source</a><a href="#method.partial_cmp-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &[<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/1.77.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-6" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1127">source</a></span><a href="#method.lt-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-6" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1144">source</a></span><a href="#method.le-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-6" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1160">source</a></span><a href="#method.gt-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-6" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1177">source</a></span><a href="#method.ge-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBStr%3E-for-%26%5Bu8%5D" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#500">source</a><a href="#impl-PartialOrd%3CBStr%3E-for-%26%5Bu8%5D" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>> for &'a [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#500">source</a><a href="#method.partial_cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/1.77.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1127">source</a></span><a href="#method.lt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1144">source</a></span><a href="#method.le" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1160">source</a></span><a href="#method.gt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1177">source</a></span><a href="#method.ge" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBStr%3E-for-%26str" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#502">source</a><a href="#impl-PartialOrd%3CBStr%3E-for-%26str" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>> for &'a <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-3" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#502">source</a><a href="#method.partial_cmp-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/1.77.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-3" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1127">source</a></span><a href="#method.lt-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-3" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1144">source</a></span><a href="#method.le-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-3" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1160">source</a></span><a href="#method.gt-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-3" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1177">source</a></span><a href="#method.ge-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBStr%3E-for-%5Bu8%5D" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#499">source</a><a href="#impl-PartialOrd%3CBStr%3E-for-%5Bu8%5D" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>> for [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-8" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#499">source</a><a href="#method.partial_cmp-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/1.77.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-8" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1127">source</a></span><a href="#method.lt-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-8" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1144">source</a></span><a href="#method.le-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-8" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1160">source</a></span><a href="#method.gt-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-8" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1177">source</a></span><a href="#method.ge-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CBStr%3E-for-str" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#501">source</a><a href="#impl-PartialOrd%3CBStr%3E-for-str" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>> for <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-4" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#501">source</a><a href="#method.partial_cmp-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/1.77.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-4" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1127">source</a></span><a href="#method.lt-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-4" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1144">source</a></span><a href="#method.le-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-4" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1160">source</a></span><a href="#method.gt-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-4" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1177">source</a></span><a href="#method.ge-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3Cstr%3E-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#501">source</a><a href="#impl-PartialOrd%3Cstr%3E-for-BStr" class="anchor">§</a><h3 class="code-header">impl<'a, 'b> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-2" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#501">source</a><a href="#method.partial_cmp-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/1.77.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-2" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1127">source</a></span><a href="#method.lt-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-2" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1144">source</a></span><a href="#method.le-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-2" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1160">source</a></span><a href="#method.gt-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-2" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1177">source</a></span><a href="#method.ge-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#485-490">source</a><a href="#impl-PartialOrd-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp-1" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#487-489">source</a><a href="#method.partial_cmp-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &<a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/1.77.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt-1" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1127">source</a></span><a href="#method.lt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le-1" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1144">source</a></span><a href="#method.le-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt-1" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1160">source</a></span><a href="#method.gt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge-1" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/core/cmp.rs.html#1177">source</a></span><a href="#method.ge-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-SliceLen-for-%26BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#478-483">source</a><a href="#impl-SliceLen-for-%26BStr" class="anchor">§</a><h3 class="code-header">impl<'a> <a class="trait" href="trait.SliceLen.html" title="trait winnow::stream::SliceLen">SliceLen</a> for &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.slice_len" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#480-482">source</a><a href="#method.slice_len" class="anchor">§</a><h4 class="code-header">fn <a href="trait.SliceLen.html#tymethod.slice_len" class="fn">slice_len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Calculates the input length, as indicated by its name,
|
||
and the name of the trait itself</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Stream-for-%26BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#843-906">source</a><a href="#impl-Stream-for-%26BStr" class="anchor">§</a><h3 class="code-header">impl<'i> <a class="trait" href="trait.Stream.html" title="trait winnow::stream::Stream">Stream</a> for &'i <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Token" class="associatedtype trait-impl"><a href="#associatedtype.Token" class="anchor">§</a><h4 class="code-header">type <a href="trait.Stream.html#associatedtype.Token" class="associatedtype">Token</a> = <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a></h4></section></summary><div class='docblock'>The smallest unit being parsed <a href="trait.Stream.html#associatedtype.Token">Read more</a></div></details><details class="toggle" open><summary><section id="associatedtype.Slice" class="associatedtype trait-impl"><a href="#associatedtype.Slice" class="anchor">§</a><h4 class="code-header">type <a href="trait.Stream.html#associatedtype.Slice" class="associatedtype">Slice</a> = &'i [<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>]</h4></section></summary><div class='docblock'>Sequence of <code>Token</code>s <a href="trait.Stream.html#associatedtype.Slice">Read more</a></div></details><details class="toggle" open><summary><section id="associatedtype.IterOffsets" class="associatedtype trait-impl"><a href="#associatedtype.IterOffsets" class="anchor">§</a><h4 class="code-header">type <a href="trait.Stream.html#associatedtype.IterOffsets" class="associatedtype">IterOffsets</a> = <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/iter/adapters/enumerate/struct.Enumerate.html" title="struct core::iter::adapters::enumerate::Enumerate">Enumerate</a><<a class="struct" href="https://doc.rust-lang.org/1.77.0/core/iter/adapters/cloned/struct.Cloned.html" title="struct core::iter::adapters::cloned::Cloned">Cloned</a><<a class="struct" href="https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.Iter.html" title="struct core::slice::iter::Iter">Iter</a><'i, <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>>>></h4></section></summary><div class='docblock'>Iterate with the offset from the current location</div></details><details class="toggle" open><summary><section id="associatedtype.Checkpoint" class="associatedtype trait-impl"><a href="#associatedtype.Checkpoint" class="anchor">§</a><h4 class="code-header">type <a href="trait.Stream.html#associatedtype.Checkpoint" class="associatedtype">Checkpoint</a> = <a class="struct" href="struct.Checkpoint.html" title="struct winnow::stream::Checkpoint">Checkpoint</a><&'i <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>, &'i <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a>></h4></section></summary><div class='docblock'>A parse location within the stream</div></details><details class="toggle method-toggle" open><summary><section id="method.iter_offsets" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#852-854">source</a><a href="#method.iter_offsets" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Stream.html#tymethod.iter_offsets" class="fn">iter_offsets</a>(&self) -> Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.IterOffsets" title="type winnow::stream::Stream::IterOffsets">IterOffsets</a></h4></section></summary><div class='docblock'>Iterate with the offset from the current location</div></details><details class="toggle method-toggle" open><summary><section id="method.eof_offset" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#856-858">source</a><a href="#method.eof_offset" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Stream.html#tymethod.eof_offset" class="fn">eof_offset</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Returns the offset to the end of the input</div></details><details class="toggle method-toggle" open><summary><section id="method.next_token" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#861-869">source</a><a href="#method.next_token" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Stream.html#tymethod.next_token" class="fn">next_token</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Token" title="type winnow::stream::Stream::Token">Token</a>></h4></section></summary><div class='docblock'>Split off the next token from the input</div></details><details class="toggle method-toggle" open><summary><section id="method.offset_for" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#872-877">source</a><a href="#method.offset_for" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Stream.html#tymethod.offset_for" class="fn">offset_for</a><P>(&self, predicate: P) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>><div class="where">where
|
||
P: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Token" title="type winnow::stream::Stream::Token">Token</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class='docblock'>Finds the offset of the next matching token</div></details><details class="toggle method-toggle" open><summary><section id="method.offset_at" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#879-885">source</a><a href="#method.offset_at" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Stream.html#tymethod.offset_at" class="fn">offset_at</a>(&self, tokens: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>, <a class="enum" href="../error/enum.Needed.html" title="enum winnow::error::Needed">Needed</a>></h4></section></summary><div class='docblock'>Get the offset for the number of <code>tokens</code> into the stream <a href="trait.Stream.html#tymethod.offset_at">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.next_slice" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#887-891">source</a><a href="#method.next_slice" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Stream.html#tymethod.next_slice" class="fn">next_slice</a>(&mut self, offset: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -> Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Slice" title="type winnow::stream::Stream::Slice">Slice</a></h4></section></summary><div class='docblock'>Split off a slice of tokens from the input <a href="trait.Stream.html#tymethod.next_slice">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.checkpoint" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#894-896">source</a><a href="#method.checkpoint" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Stream.html#tymethod.checkpoint" class="fn">checkpoint</a>(&self) -> Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Checkpoint" title="type winnow::stream::Stream::Checkpoint">Checkpoint</a></h4></section></summary><div class='docblock'>Save the current parse location within the stream</div></details><details class="toggle method-toggle" open><summary><section id="method.reset" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#898-900">source</a><a href="#method.reset" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Stream.html#tymethod.reset" class="fn">reset</a>(&mut self, checkpoint: &Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Checkpoint" title="type winnow::stream::Stream::Checkpoint">Checkpoint</a>)</h4></section></summary><div class='docblock'>Revert the stream to a prior <a href="trait.Stream.html#associatedtype.Checkpoint"><code>Self::Checkpoint</code></a> <a href="trait.Stream.html#tymethod.reset">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.raw" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#903-905">source</a><a href="#method.raw" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Stream.html#tymethod.raw" class="fn">raw</a>(&self) -> &dyn <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a></h4></section></summary><div class='docblock'>Return the inner-most stream</div></details><details class="toggle method-toggle" open><summary><section id="method.peek_token" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#564-571">source</a><a href="#method.peek_token" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Stream.html#method.peek_token" class="fn">peek_token</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.77.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(Self, Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Token" title="type winnow::stream::Stream::Token">Token</a>)><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class='docblock'>Split off the next token from the input</div></details><details class="toggle method-toggle" open><summary><section id="method.peek_slice" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#601-608">source</a><a href="#method.peek_slice" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Stream.html#method.peek_slice" class="fn">peek_slice</a>(&self, offset: <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.usize.html">usize</a>) -> (Self, Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Slice" title="type winnow::stream::Stream::Slice">Slice</a>)<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class='docblock'>Split off a slice of tokens from the input</div></details><details class="toggle method-toggle" open><summary><section id="method.finish" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#612-614">source</a><a href="#method.finish" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Stream.html#method.finish" class="fn">finish</a>(&mut self) -> Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Slice" title="type winnow::stream::Stream::Slice">Slice</a></h4></section></summary><div class='docblock'>Advance to the end of the stream</div></details><details class="toggle method-toggle" open><summary><section id="method.peek_finish" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#617-624">source</a><a href="#method.peek_finish" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Stream.html#method.peek_finish" class="fn">peek_finish</a>(&self) -> (Self, Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Slice" title="type winnow::stream::Stream::Slice">Slice</a>)<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class='docblock'>Advance to the end of the stream</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-StreamIsPartial-for-%26BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#1590-1603">source</a><a href="#impl-StreamIsPartial-for-%26BStr" class="anchor">§</a><h3 class="code-header">impl<'a> <a class="trait" href="trait.StreamIsPartial.html" title="trait winnow::stream::StreamIsPartial">StreamIsPartial</a> for &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.PartialState" class="associatedtype trait-impl"><a href="#associatedtype.PartialState" class="anchor">§</a><h4 class="code-header">type <a href="trait.StreamIsPartial.html#associatedtype.PartialState" class="associatedtype">PartialState</a> = <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.unit.html">()</a></h4></section></summary><div class='docblock'>Whether the stream is currently partial or complete</div></details><details class="toggle method-toggle" open><summary><section id="method.complete" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#1593-1595">source</a><a href="#method.complete" class="anchor">§</a><h4 class="code-header">fn <a href="trait.StreamIsPartial.html#tymethod.complete" class="fn">complete</a>(&mut self) -> Self::<a class="associatedtype" href="trait.StreamIsPartial.html#associatedtype.PartialState" title="type winnow::stream::StreamIsPartial::PartialState">PartialState</a></h4></section></summary><div class='docblock'>Mark the stream is complete</div></details><details class="toggle method-toggle" open><summary><section id="method.restore_partial" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#1597">source</a><a href="#method.restore_partial" class="anchor">§</a><h4 class="code-header">fn <a href="trait.StreamIsPartial.html#tymethod.restore_partial" class="fn">restore_partial</a>(&mut self, _state: Self::<a class="associatedtype" href="trait.StreamIsPartial.html#associatedtype.PartialState" title="type winnow::stream::StreamIsPartial::PartialState">PartialState</a>)</h4></section></summary><div class='docblock'>Restore the stream back to its previous state</div></details><details class="toggle method-toggle" open><summary><section id="method.is_partial_supported" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#1600-1602">source</a><a href="#method.is_partial_supported" class="anchor">§</a><h4 class="code-header">fn <a href="trait.StreamIsPartial.html#tymethod.is_partial_supported" class="fn">is_partial_supported</a>() -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Report whether the <a href="trait.Stream.html" title="trait winnow::stream::Stream"><code>Stream</code></a> is can ever be incomplete</div></details><details class="toggle method-toggle" open><summary><section id="method.is_partial" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#1542-1544">source</a><a href="#method.is_partial" class="anchor">§</a><h4 class="code-header">fn <a href="trait.StreamIsPartial.html#method.is_partial" class="fn">is_partial</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Report whether the <a href="trait.Stream.html" title="trait winnow::stream::Stream"><code>Stream</code></a> is currently incomplete</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-ToOwned-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#427-434">source</a><a href="#impl-ToOwned-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = <a class="struct" href="https://doc.rust-lang.org/1.77.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.u8.html">u8</a>></h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#431-433">source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&self) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" title="type alloc::borrow::ToOwned::Owned">Owned</a></h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.63.0">1.63.0</span> · <a class="src" href="https://doc.rust-lang.org/1.77.0/src/alloc/borrow.rs.html#77">source</a></span><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&self, target: &mut Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" title="type alloc::borrow::ToOwned::Owned">Owned</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/1.77.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-UpdateSlice-for-%26BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2601-2606">source</a><a href="#impl-UpdateSlice-for-%26BStr" class="anchor">§</a><h3 class="code-header">impl<'a> <a class="trait" href="trait.UpdateSlice.html" title="trait winnow::stream::UpdateSlice">UpdateSlice</a> for &'a <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.update_slice" class="method trait-impl"><a class="src rightside" href="../../src/winnow/stream/mod.rs.html#2603-2605">source</a><a href="#method.update_slice" class="anchor">§</a><h4 class="code-header">fn <a href="trait.UpdateSlice.html#tymethod.update_slice" class="fn">update_slice</a>(self, inner: Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Slice" title="type winnow::stream::Stream::Slice">Slice</a>) -> Self</h4></section></summary><div class='docblock'>Convert an <code>Output</code> type to be used as <code>Stream</code></div></details></div></details><section id="impl-Eq-for-BStr" class="impl"><a class="src rightside" href="../../src/winnow/stream/impls.rs.html#471">source</a><a href="#impl-Eq-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section></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-RefUnwindSafe-for-BStr" class="impl"><a href="#impl-RefUnwindSafe-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section><section id="impl-Send-for-BStr" class="impl"><a href="#impl-Send-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section><section id="impl-Sized-for-BStr" class="impl"><a href="#impl-Sized-for-BStr" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section><section id="impl-Sync-for-BStr" class="impl"><a href="#impl-Sync-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section><section id="impl-Unpin-for-BStr" class="impl"><a href="#impl-Unpin-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</a></h3></section><section id="impl-UnwindSafe-for-BStr" class="impl"><a href="#impl-UnwindSafe-for-BStr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.BStr.html" title="struct winnow::stream::BStr">BStr</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.77.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/any.rs.html#141">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.77.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/borrow.rs.html#210">source</a><a href="#method.borrow-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/borrow.rs.html#216">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/core/borrow.rs.html#217">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.77.0/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.77.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToString-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/alloc/string.rs.html#2600">source</a><a href="#impl-ToString-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.77.0/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.77.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.77.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.to_string" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.77.0/src/alloc/string.rs.html#2606">source</a><a href="#method.to_string" class="anchor">§</a><h4 class="code-header">default fn <a href="https://doc.rust-lang.org/1.77.0/alloc/string/trait.ToString.html#tymethod.to_string" class="fn">to_string</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.77.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class='docblock'>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/1.77.0/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></div></details></div></details></div><script type="text/json" id="notable-traits-data">{"&'a [u8]":"<h3>Notable traits for <code>&[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.u8.html\">u8</a>]</div>","&[u8]":"<h3>Notable traits for <code>&[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.u8.html\">u8</a>]</div>","<[T] as Concat<Item>>::Output":"<h3>Notable traits for <code>&mut [<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut [<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.u8.html\">u8</a>]</div><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.u8.html\">u8</a>]</div>","<[T] as Join<Separator>>::Output":"<h3>Notable traits for <code>&mut [<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for &mut [<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.u8.html\">u8</a>]</div><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.u8.html\">u8</a>]</div>","ArrayChunks<'_, T, N>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.ArrayChunks.html\" title=\"struct core::slice::iter::ArrayChunks\">ArrayChunks</a><'a, T, N></code></h3><pre><code><div class=\"where\">impl<'a, T, const N: <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.usize.html\">usize</a>> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.ArrayChunks.html\" title=\"struct core::slice::iter::ArrayChunks\">ArrayChunks</a><'a, T, N></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.array.html\">[T; N]</a>;</div>","ArrayWindows<'_, T, N>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.ArrayWindows.html\" title=\"struct core::slice::iter::ArrayWindows\">ArrayWindows</a><'a, T, N></code></h3><pre><code><div class=\"where\">impl<'a, T, const N: <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.usize.html\">usize</a>> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.ArrayWindows.html\" title=\"struct core::slice::iter::ArrayWindows\">ArrayWindows</a><'a, T, N></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.array.html\">[T; N]</a>;</div>","ChunkBy<'_, T, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.ChunkBy.html\" title=\"struct core::slice::iter::ChunkBy\">ChunkBy</a><'a, T, P></code></h3><pre><code><div class=\"where\">impl<'a, T, P> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.ChunkBy.html\" title=\"struct core::slice::iter::ChunkBy\">ChunkBy</a><'a, T, P><div class=\"where\">where\n T: 'a,\n P: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.reference.html\">&T</a>, <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.reference.html\">&T</a>) -> <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.slice.html\">[T]</a>;</div>","Chunks<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.Chunks.html\" title=\"struct core::slice::iter::Chunks\">Chunks</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.Chunks.html\" title=\"struct core::slice::iter::Chunks\">Chunks</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.slice.html\">[T]</a>;</div>","ChunksExact<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.ChunksExact.html\" title=\"struct core::slice::iter::ChunksExact\">ChunksExact</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.ChunksExact.html\" title=\"struct core::slice::iter::ChunksExact\">ChunksExact</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.slice.html\">[T]</a>;</div>","EscapeAscii<'_>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/ascii/struct.EscapeAscii.html\" title=\"struct core::slice::ascii::EscapeAscii\">EscapeAscii</a><'a></code></h3><pre><code><div class=\"where\">impl<'a> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/ascii/struct.EscapeAscii.html\" title=\"struct core::slice::ascii::EscapeAscii\">EscapeAscii</a><'a></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.u8.html\">u8</a>;</div>","Iter<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.Iter.html\" title=\"struct core::slice::iter::Iter\">Iter</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.Iter.html\" title=\"struct core::slice::iter::Iter\">Iter</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.reference.html\">&'a T</a>;</div>","RChunks<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.RChunks.html\" title=\"struct core::slice::iter::RChunks\">RChunks</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.RChunks.html\" title=\"struct core::slice::iter::RChunks\">RChunks</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.slice.html\">[T]</a>;</div>","RChunksExact<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.RChunksExact.html\" title=\"struct core::slice::iter::RChunksExact\">RChunksExact</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.RChunksExact.html\" title=\"struct core::slice::iter::RChunksExact\">RChunksExact</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.slice.html\">[T]</a>;</div>","RSplit<'_, T, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.RSplit.html\" title=\"struct core::slice::iter::RSplit\">RSplit</a><'a, T, P></code></h3><pre><code><div class=\"where\">impl<'a, T, P> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.RSplit.html\" title=\"struct core::slice::iter::RSplit\">RSplit</a><'a, T, P><div class=\"where\">where\n P: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.reference.html\">&T</a>) -> <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.slice.html\">[T]</a>;</div>","RSplitN<'_, T, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.RSplitN.html\" title=\"struct core::slice::iter::RSplitN\">RSplitN</a><'a, T, P></code></h3><pre><code><div class=\"where\">impl<'a, T, P> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.RSplitN.html\" title=\"struct core::slice::iter::RSplitN\">RSplitN</a><'a, T, P><div class=\"where\">where\n P: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.reference.html\">&T</a>) -> <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.slice.html\">[T]</a>;</div>","Range<*const T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/ops/range/struct.Range.html\" title=\"struct core::ops::range::Range\">Range</a><A></code></h3><pre><code><div class=\"where\">impl<A> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/ops/range/struct.Range.html\" title=\"struct core::ops::range::Range\">Range</a><A><div class=\"where\">where\n A: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/range/trait.Step.html\" title=\"trait core::iter::range::Step\">Step</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = A;</div>","Split<'_, T, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.Split.html\" title=\"struct core::slice::iter::Split\">Split</a><'a, T, P></code></h3><pre><code><div class=\"where\">impl<'a, T, P> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.Split.html\" title=\"struct core::slice::iter::Split\">Split</a><'a, T, P><div class=\"where\">where\n P: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.reference.html\">&T</a>) -> <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.slice.html\">[T]</a>;</div>","SplitInclusive<'_, T, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.SplitInclusive.html\" title=\"struct core::slice::iter::SplitInclusive\">SplitInclusive</a><'a, T, P></code></h3><pre><code><div class=\"where\">impl<'a, T, P> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.SplitInclusive.html\" title=\"struct core::slice::iter::SplitInclusive\">SplitInclusive</a><'a, T, P><div class=\"where\">where\n P: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.reference.html\">&T</a>) -> <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.slice.html\">[T]</a>;</div>","SplitN<'_, T, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.SplitN.html\" title=\"struct core::slice::iter::SplitN\">SplitN</a><'a, T, P></code></h3><pre><code><div class=\"where\">impl<'a, T, P> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.SplitN.html\" title=\"struct core::slice::iter::SplitN\">SplitN</a><'a, T, P><div class=\"where\">where\n P: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/ops/function/trait.FnMut.html\" title=\"trait core::ops::function::FnMut\">FnMut</a>(<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.reference.html\">&T</a>) -> <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.bool.html\">bool</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.slice.html\">[T]</a>;</div>","Vec<u8>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a><<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.u8.html\">u8</a>, A></code></h3><pre><code><div class=\"where\">impl<A> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a><<a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.u8.html\">u8</a>, A><div class=\"where\">where\n A: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/alloc/trait.Allocator.html\" title=\"trait core::alloc::Allocator\">Allocator</a>,</div></div>","Windows<'_, T>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.Windows.html\" title=\"struct core::slice::iter::Windows\">Windows</a><'a, T></code></h3><pre><code><div class=\"where\">impl<'a, T> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/1.77.0/core/slice/iter/struct.Windows.html\" title=\"struct core::slice::iter::Windows\">Windows</a><'a, T></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.77.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = &'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/1.77.0/std/primitive.slice.html\">[T]</a>;</div>"}</script></section></div></main></body></html> |