blob: b4c696b41f75c4be589411780648917af8d29365 [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="An OwnedBytes simply wraps an object that owns a slice of data and exposes this data as a slice."><meta name="keywords" content="rust, rustlang, rust-lang, OwnedBytes"><title>OwnedBytes in tantivy::directory - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../../normalize.css"><link rel="stylesheet" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../../ayu.css" disabled><link rel="stylesheet" href="../../dark.css" disabled><link rel="stylesheet" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../main.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.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">&#9776;</button><a class="sidebar-logo" href="../../tantivy/index.html"><div class="logo-container"><img src="http://fulmicoton.com/tantivy-logo/tantivy-logo.png" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../tantivy/index.html"><div class="logo-container">
<img src="http://fulmicoton.com/tantivy-logo/tantivy-logo.png" alt="logo"></div></a><h2 class="location"><a href="#">OwnedBytes</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.advance">advance</a></li><li><a href="#method.as_slice">as_slice</a></li><li><a href="#method.empty">empty</a></li><li><a href="#method.is_empty">is_empty</a></li><li><a href="#method.len">len</a></li><li><a href="#method.new">new</a></li><li><a href="#method.read_u64">read_u64</a></li><li><a href="#method.read_u8">read_u8</a></li><li><a href="#method.rsplit">rsplit</a></li><li><a href="#method.slice">slice</a></li><li><a href="#method.split">split</a></li><li><a href="#method.split_off">split_off</a></li></ul><h3><a href="#deref-methods-%5Bu8%5D">Methods from Deref&lt;Target=[u8]&gt;</a></h3><ul class="block"><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_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.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.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.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.group_by">group_by</a></li><li><a href="#method.is_ascii">is_ascii</a></li><li><a href="#method.is_empty-1">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.len-1">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-1">rsplit</a></li><li><a href="#method.rsplit_array_ref">rsplit_array_ref</a></li><li><a href="#method.rsplitn">rsplitn</a></li><li><a href="#method.split-1">split</a></li><li><a href="#method.split_array_ref">split_array_ref</a></li><li><a href="#method.split_at">split_at</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_inclusive">split_inclusive</a></li><li><a href="#method.split_last">split_last</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"><li><a href="#impl-AsRef%3C%5Bu8%5D%3E-for-OwnedBytes">AsRef&lt;[u8]&gt;</a></li><li><a href="#impl-Clone-for-OwnedBytes">Clone</a></li><li><a href="#impl-Debug-for-OwnedBytes">Debug</a></li><li><a href="#impl-Deref-for-OwnedBytes">Deref</a></li><li><a href="#impl-Eq-for-OwnedBytes">Eq</a></li><li><a href="#impl-FileHandle-for-OwnedBytes">FileHandle</a></li><li><a href="#impl-PartialEq%3C%26%27a%20T%3E-for-OwnedBytes">PartialEq&lt;&amp;&#39;a T&gt;</a></li><li><a href="#impl-PartialEq%3C%5Bu8%5D%3E-for-OwnedBytes">PartialEq&lt;[u8]&gt;</a></li><li><a href="#impl-PartialEq%3COwnedBytes%3E-for-OwnedBytes">PartialEq&lt;OwnedBytes&gt;</a></li><li><a href="#impl-PartialEq%3Cstr%3E-for-OwnedBytes">PartialEq&lt;str&gt;</a></li><li><a href="#impl-Read-for-OwnedBytes">Read</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-OwnedBytes">!RefUnwindSafe</a></li><li><a href="#impl-Send-for-OwnedBytes">Send</a></li><li><a href="#impl-Sync-for-OwnedBytes">Sync</a></li><li><a href="#impl-Unpin-for-OwnedBytes">Unpin</a></li><li><a href="#impl-UnwindSafe-for-OwnedBytes">!UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-OwnedBytes">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-OwnedBytes">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-OwnedBytes">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-Downcast-for-OwnedBytes">Downcast</a></li><li><a href="#impl-DowncastSync-for-OwnedBytes">DowncastSync</a></li><li><a href="#impl-From%3CT%3E-for-OwnedBytes">From&lt;T&gt;</a></li><li><a href="#impl-Fruit-for-OwnedBytes">Fruit</a></li><li><a href="#impl-HasLen-for-OwnedBytes">HasLen</a></li><li><a href="#impl-Into%3CU%3E-for-OwnedBytes">Into&lt;U&gt;</a></li><li><a href="#impl-Pointable-for-OwnedBytes">Pointable</a></li><li><a href="#impl-ReadBytesExt-for-OwnedBytes">ReadBytesExt</a></li><li><a href="#impl-ToOwned-for-OwnedBytes">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-OwnedBytes">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-OwnedBytes">TryInto&lt;U&gt;</a></li><li><a href="#impl-VZip%3CV%3E-for-OwnedBytes">VZip&lt;V&gt;</a></li></ul></section><h2><a href="index.html">In tantivy::directory</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Struct <a href="../index.html">tantivy</a>::<wbr><a href="index.html">directory</a>::<wbr><a class="struct" href="#">OwnedBytes</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/ownedbytes/lib.rs.html#13">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust struct"><code>pub struct OwnedBytes { /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An OwnedBytes simply wraps an object that owns a slice of data and exposes
this data as a slice.</p>
<p>The backing object is required to be <code>StableDeref</code>.</p>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><div id="implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#18">source</a><a href="#impl-OwnedBytes" class="anchor"></a><h3 class="code-header">impl <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.empty" class="method has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#20">source</a><h4 class="code-header">pub fn <a href="#method.empty" class="fnname">empty</a>() -&gt; <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h4></section></summary><div class="docblock"><p>Creates an empty <code>OwnedBytes</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.new" class="method has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#25-27">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>&lt;T&gt;(data_holder: T) -&gt; <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + <a class="trait" href="../../stable_deref_trait/trait.StableDeref.html" title="trait stable_deref_trait::StableDeref">StableDeref</a>&lt;Target = [u8]&gt; + Deref + Send + Sync,</span></h4></section></summary><div class="docblock"><p>Creates an <code>OwnedBytes</code> instance given a <code>StableDeref</code> object.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.slice" class="method has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#40">source</a><h4 class="code-header">pub fn <a href="#method.slice" class="fnname">slice</a>(&amp;self, range: Range&lt;usize&gt;) -&gt; <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h4></section></summary><div class="docblock"><p>creates a fileslice that is just a view over a slice of the data.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.as_slice" class="method has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#50">source</a><h4 class="code-header">pub fn <a href="#method.as_slice" class="fnname">as_slice</a>(&amp;self) -&gt; &amp;[u8]</h4></section></summary><div class="docblock"><p>Returns the underlying slice of data.
<code>Deref</code> and <code>AsRef</code> are also available.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.len" class="method has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#56">source</a><h4 class="code-header">pub fn <a href="#method.len" class="fnname">len</a>(&amp;self) -&gt; usize</h4></section></summary><div class="docblock"><p>Returns the len of the slice.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.split" class="method has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#70">source</a><h4 class="code-header">pub fn <a href="#method.split" class="fnname">split</a>(self, split_len: usize) -&gt; (<a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a>, <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a>)</h4></section></summary><div class="docblock"><p>Splits the OwnedBytes into two OwnedBytes <code>(left, right)</code>.</p>
<p>Left will hold <code>split_len</code> bytes.</p>
<p>This operation is cheap and does not require to copy any memory.
On the other hand, both <code>left</code> and <code>right</code> retain a handle over
the entire slice of memory. In other words, the memory will only
be released when both left and right are dropped.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.rsplit" class="method has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#93">source</a><h4 class="code-header">pub fn <a href="#method.rsplit" class="fnname">rsplit</a>(self, split_len: usize) -&gt; (<a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a>, <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a>)</h4></section></summary><div class="docblock"><p>Splits the OwnedBytes into two OwnedBytes <code>(left, right)</code>.</p>
<p>Right will hold <code>split_len</code> bytes.</p>
<p>This operation is cheap and does not require to copy any memory.
On the other hand, both <code>left</code> and <code>right</code> retain a handle over
the entire slice of memory. In other words, the memory will only
be released when both left and right are dropped.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.split_off" class="method has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#101">source</a><h4 class="code-header">pub fn <a href="#method.split_off" class="fnname">split_off</a>(&amp;mut self, split_len: usize) -&gt; <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h4></section></summary><div class="docblock"><p>Splits the right part of the <code>OwnedBytes</code> at the given offset.</p>
<p><code>self</code> is truncated to <code>split_len</code>, left with the remaining bytes.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_empty" class="method has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#113">source</a><h4 class="code-header">pub fn <a href="#method.is_empty" class="fnname">is_empty</a>(&amp;self) -&gt; bool</h4></section></summary><div class="docblock"><p>Returns true iff this <code>OwnedBytes</code> is empty.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.advance" class="method has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#119">source</a><h4 class="code-header">pub fn <a href="#method.advance" class="fnname">advance</a>(&amp;mut self, advance_len: usize)</h4></section></summary><div class="docblock"><p>Drops the left most <code>advance_len</code> bytes.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u8" class="method has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#125">source</a><h4 class="code-header">pub fn <a href="#method.read_u8" class="fnname">read_u8</a>(&amp;mut self) -&gt; u8</h4></section></summary><div class="docblock"><p>Reads an <code>u8</code> from the <code>OwnedBytes</code> and advance by one byte.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u64" class="method has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#135">source</a><h4 class="code-header">pub fn <a href="#method.read_u64" class="fnname">read_u64</a>(&amp;mut self) -&gt; u64</h4></section></summary><div class="docblock"><p>Reads an <code>u64</code> encoded as little-endian from the <code>OwnedBytes</code> and advance by 8 bytes.</p>
</div></details></div></details></div><h2 id="deref-methods-%5Bu8%5D" class="small-section-header"><span>Methods from Deref&lt;Target = [u8]&gt;</span><a href="#deref-methods-%5Bu8%5D" class="anchor"></a></h2><div id="deref-methods-%5Bu8%5D-1"><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.len-1" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.len-1" class="fnname">len</a>(&amp;self) -&gt; usize</h4></section></summary><div class="docblock"><p>Returns the number of elements in the slice.</p>
<h5 id="examples"><a href="#examples">Examples</a></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="rustdoc-toggle method-toggle" open><summary><section id="method.is_empty-1" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.is_empty-1" class="fnname">is_empty</a>(&amp;self) -&gt; bool</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 href="#examples-1">Examples</a></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="rustdoc-toggle method-toggle" open><summary><section id="method.first" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.first" class="fnname">first</a>(&amp;self) -&gt; Option&lt;&amp;T&gt;</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 href="#examples-2">Examples</a></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">&amp;</span><span class="number">10</span>), v.first());
<span class="kw">let </span>w: <span class="kw-2">&amp;</span>[i32] = <span class="kw-2">&amp;</span>[];
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, w.first());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.split_first" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.5.0">1.5.0</span><h4 class="code-header">pub fn <a href="#method.split_first" class="fnname">split_first</a>(&amp;self) -&gt; Option&lt;(&amp;T, &amp;[T])&gt;</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 href="#examples-3">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&amp;</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">&amp;</span><span class="number">0</span>);
<span class="macro">assert_eq!</span>(elements, <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>]);
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.split_last" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.5.0">1.5.0</span><h4 class="code-header">pub fn <a href="#method.split_last" class="fnname">split_last</a>(&amp;self) -&gt; Option&lt;(&amp;T, &amp;[T])&gt;</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 href="#examples-4">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&amp;</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">&amp;</span><span class="number">2</span>);
<span class="macro">assert_eq!</span>(elements, <span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>]);
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.last" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.last" class="fnname">last</a>(&amp;self) -&gt; Option&lt;&amp;T&gt;</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 href="#examples-5">Examples</a></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">&amp;</span><span class="number">30</span>), v.last());
<span class="kw">let </span>w: <span class="kw-2">&amp;</span>[i32] = <span class="kw-2">&amp;</span>[];
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, w.last());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.get" class="fnname">get</a>&lt;I&gt;(&amp;self, index: I) -&gt; Option&lt;&amp;&lt;I as SliceIndex&lt;[T]&gt;&gt;::Output&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: SliceIndex&lt;[T]&gt;,</span></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-6"><a href="#examples-6">Examples</a></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">&amp;</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">&amp;</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="rustdoc-toggle method-toggle" open><summary><section id="method.get_unchecked" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub unsafe fn <a href="#method.get_unchecked" class="fnname">get_unchecked</a>&lt;I&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;index: I<br>) -&gt; &amp;&lt;I as SliceIndex&lt;[T]&gt;&gt;::Output<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: SliceIndex&lt;[T]&gt;,</span></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="slice::get"><code>get</code></a>.</p>
<h5 id="safety"><a href="#safety">Safety</a></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>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&amp;</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">&amp;</span><span class="number">2</span>);
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.as_ptr" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.as_ptr" class="fnname">as_ptr</a>(&amp;self) -&gt; *const T</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="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-8"><a href="#examples-8">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&amp;</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">&amp;*</span>x_ptr.add(i));
}
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.as_ptr_range" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.48.0">1.48.0</span><h4 class="code-header">pub fn <a href="#method.as_ptr_range" class="fnname">as_ptr_range</a>(&amp;self) -&gt; Range&lt;*const T&gt;</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="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">&amp;</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">&amp;</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">&amp;</span>x));
<span class="macro">assert!</span>(!a.as_ptr_range().contains(<span class="kw-2">&amp;</span>y));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.iter" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.iter" class="fnname">iter</a>(&amp;self) -&gt; Iter&lt;'_, T&gt;</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-9"><a href="#examples-9">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>x = <span class="kw-2">&amp;</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">&amp;</span><span class="number">1</span>));
<span class="macro">assert_eq!</span>(iterator.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">2</span>));
<span class="macro">assert_eq!</span>(iterator.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</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="rustdoc-toggle method-toggle" open><summary><section id="method.windows" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.windows" class="fnname">windows</a>(&amp;self, size: usize) -&gt; Windows&lt;'_, T&gt;</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 href="#panics">Panics</a></h5>
<p>Panics if <code>size</code> is 0.</p>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">&#39;r&#39;</span>, <span class="string">&#39;u&#39;</span>, <span class="string">&#39;s&#39;</span>, <span class="string">&#39;t&#39;</span>];
<span class="kw">let </span><span class="kw-2">mut </span>iter = slice.windows(<span class="number">2</span>);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="string">&#39;r&#39;</span>, <span class="string">&#39;u&#39;</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="string">&#39;u&#39;</span>, <span class="string">&#39;s&#39;</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="string">&#39;s&#39;</span>, <span class="string">&#39;t&#39;</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">&#39;f&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;o&#39;</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>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.chunks" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.chunks" class="fnname">chunks</a>(&amp;self, chunk_size: usize) -&gt; Chunks&lt;'_, T&gt;</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="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="slice::rchunks"><code>rchunks</code></a> for the same iterator but starting at the end of the
slice.</p>
<h5 id="panics-1"><a href="#panics-1">Panics</a></h5>
<p>Panics if <code>chunk_size</code> is 0.</p>
<h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</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">&amp;</span>[<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="string">&#39;m&#39;</span>]);
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.chunks_exact" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.31.0">1.31.0</span><h4 class="code-header">pub fn <a href="#method.chunks_exact" class="fnname">chunks_exact</a>(&amp;self, chunk_size: usize) -&gt; ChunksExact&lt;'_, T&gt;</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="slice::chunks"><code>chunks</code></a>.</p>
<p>See <a href="slice::chunks"><code>chunks</code></a> for a variant of this iterator that also returns the remainder as a smaller
chunk, and <a href="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 href="#panics-2">Panics</a></h5>
<p>Panics if <code>chunk_size</code> is 0.</p>
<h5 id="examples-12"><a href="#examples-12">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</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">&amp;</span>[<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>]);
<span class="macro">assert!</span>(iter.next().is_none());
<span class="macro">assert_eq!</span>(iter.remainder(), <span class="kw-2">&amp;</span>[<span class="string">&#39;m&#39;</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.as_chunks_unchecked" class="method has-srclink"><h4 class="code-header">pub unsafe fn <a href="#method.as_chunks_unchecked" class="fnname">as_chunks_unchecked</a>&lt;const N:&nbsp;usize&gt;(&amp;self) -&gt; &amp;[[T; N]]</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 href="#safety-1">Safety</a></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-13"><a href="#examples-13">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![feature(slice_as_chunks)]
</span><span class="kw">let </span>slice: <span class="kw-2">&amp;</span>[char] = <span class="kw-2">&amp;</span>[<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>, <span class="string">&#39;!&#39;</span>];
<span class="kw">let </span>chunks: <span class="kw-2">&amp;</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">&amp;</span>[[<span class="string">&#39;l&#39;</span>], [<span class="string">&#39;o&#39;</span>], [<span class="string">&#39;r&#39;</span>], [<span class="string">&#39;e&#39;</span>], [<span class="string">&#39;m&#39;</span>], [<span class="string">&#39;!&#39;</span>]]);
<span class="kw">let </span>chunks: <span class="kw-2">&amp;</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">&amp;</span>[[<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>], [<span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>, <span class="string">&#39;!&#39;</span>]]);
<span class="comment">// These would be unsound:
// let chunks: &amp;[[_; 5]] = slice.as_chunks_unchecked() // The slice length is not a multiple of 5
// let chunks: &amp;[[_; 0]] = slice.as_chunks_unchecked() // Zero-length chunks are never allowed</span></code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.as_chunks" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.as_chunks" class="fnname">as_chunks</a>&lt;const N:&nbsp;usize&gt;(&amp;self) -&gt; (&amp;[[T; N]], &amp;[T])</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 href="#panics-3">Panics</a></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-14"><a href="#examples-14">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![feature(slice_as_chunks)]
</span><span class="kw">let </span>slice = [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>];
<span class="kw">let </span>(chunks, remainder) = slice.as_chunks();
<span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&amp;</span>[[<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>], [<span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>]]);
<span class="macro">assert_eq!</span>(remainder, <span class="kw-2">&amp;</span>[<span class="string">&#39;m&#39;</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.as_rchunks" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.as_rchunks" class="fnname">as_rchunks</a>&lt;const N:&nbsp;usize&gt;(&amp;self) -&gt; (&amp;[T], &amp;[[T; N]])</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 href="#panics-4">Panics</a></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-15"><a href="#examples-15">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![feature(slice_as_chunks)]
</span><span class="kw">let </span>slice = [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>];
<span class="kw">let </span>(remainder, chunks) = slice.as_rchunks();
<span class="macro">assert_eq!</span>(remainder, <span class="kw-2">&amp;</span>[<span class="string">&#39;l&#39;</span>]);
<span class="macro">assert_eq!</span>(chunks, <span class="kw-2">&amp;</span>[[<span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>], [<span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>]]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.array_chunks" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.array_chunks" class="fnname">array_chunks</a>&lt;const N:&nbsp;usize&gt;(&amp;self) -&gt; ArrayChunks&lt;'_, T, N&gt;</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="slice::chunks_exact"><code>chunks_exact</code></a>.</p>
<h5 id="panics-5"><a href="#panics-5">Panics</a></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-16"><a href="#examples-16">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![feature(array_chunks)]
</span><span class="kw">let </span>slice = [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</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">&amp;</span>[<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>]);
<span class="macro">assert!</span>(iter.next().is_none());
<span class="macro">assert_eq!</span>(iter.remainder(), <span class="kw-2">&amp;</span>[<span class="string">&#39;m&#39;</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.array_windows" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.array_windows" class="fnname">array_windows</a>&lt;const N:&nbsp;usize&gt;(&amp;self) -&gt; ArrayWindows&lt;'_, T, N&gt;</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="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 href="#panics-6">Panics</a></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-17"><a href="#examples-17">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![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">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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="rustdoc-toggle method-toggle" open><summary><section id="method.rchunks" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.31.0">1.31.0</span><h4 class="code-header">pub fn <a href="#method.rchunks" class="fnname">rchunks</a>(&amp;self, chunk_size: usize) -&gt; RChunks&lt;'_, T&gt;</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="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="slice::chunks"><code>chunks</code></a> for the same iterator but starting at the beginning
of the slice.</p>
<h5 id="panics-7"><a href="#panics-7">Panics</a></h5>
<p>Panics if <code>chunk_size</code> is 0.</p>
<h5 id="examples-18"><a href="#examples-18">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</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">&amp;</span>[<span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="string">&#39;l&#39;</span>]);
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.rchunks_exact" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.31.0">1.31.0</span><h4 class="code-header">pub fn <a href="#method.rchunks_exact" class="fnname">rchunks_exact</a>(&amp;self, chunk_size: usize) -&gt; RChunksExact&lt;'_, T&gt;</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="slice::rchunks"><code>rchunks</code></a>.</p>
<p>See <a href="slice::rchunks"><code>rchunks</code></a> for a variant of this iterator that also returns the remainder as a smaller
chunk, and <a href="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 href="#panics-8">Panics</a></h5>
<p>Panics if <code>chunk_size</code> is 0.</p>
<h5 id="examples-19"><a href="#examples-19">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>slice = [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</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">&amp;</span>[<span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>]);
<span class="macro">assert!</span>(iter.next().is_none());
<span class="macro">assert_eq!</span>(iter.remainder(), <span class="kw-2">&amp;</span>[<span class="string">&#39;l&#39;</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.group_by" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.group_by" class="fnname">group_by</a>&lt;F&gt;(&amp;self, pred: F) -&gt; GroupBy&lt;'_, T, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: FnMut(&amp;T, &amp;T) -&gt; bool,</span></h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_group_by</code>)</span></div></span></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 on two elements following themselves,
it means the predicate is called on <code>slice[0]</code> and <code>slice[1]</code>
then on <code>slice[1]</code> and <code>slice[2]</code> and so on.</p>
<h5 id="examples-20"><a href="#examples-20">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![feature(slice_group_by)]
</span><span class="kw">let </span>slice = <span class="kw-2">&amp;</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.group_by(|a, b| a == b);
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</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">&amp;</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">&amp;</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="attribute">#![feature(slice_group_by)]
</span><span class="kw">let </span>slice = <span class="kw-2">&amp;</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.group_by(|a, b| a &lt;= b);
<span class="macro">assert_eq!</span>(iter.next(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</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">&amp;</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">&amp;</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="rustdoc-toggle method-toggle" open><summary><section id="method.split_at" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.split_at" class="fnname">split_at</a>(&amp;self, mid: usize) -&gt; (&amp;[T], &amp;[T])</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 href="#panics-9">Panics</a></h5>
<p>Panics if <code>mid &gt; len</code>.</p>
<h5 id="examples-21"><a href="#examples-21">Examples</a></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="rustdoc-toggle method-toggle" open><summary><section id="method.split_at_unchecked" class="method has-srclink"><h4 class="code-header">pub unsafe fn <a href="#method.split_at_unchecked" class="fnname">split_at_unchecked</a>(&amp;self, mid: usize) -&gt; (&amp;[T], &amp;[T])</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="slice::split_at"><code>split_at</code></a>.</p>
<h5 id="safety-2"><a href="#safety-2">Safety</a></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 &lt;= mid &lt;= self.len()</code>.</p>
<h5 id="examples-22"><a href="#examples-22">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![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="rustdoc-toggle method-toggle" open><summary><section id="method.split_array_ref" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.split_array_ref" class="fnname">split_array_ref</a>&lt;const N:&nbsp;usize&gt;(&amp;self) -&gt; (&amp;[T; N], &amp;[T])</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>split_array</code>)</span></div></span></summary><div class="docblock"><p>Divides one slice into an array and a remainder slice at an index.</p>
<p>The array will contain all indices from <code>[0, N)</code> (excluding
the index <code>N</code> itself) and the slice will contain all
indices from <code>[N, len)</code> (excluding the index <code>len</code> itself).</p>
<h5 id="panics-10"><a href="#panics-10">Panics</a></h5>
<p>Panics if <code>N &gt; len</code>.</p>
<h5 id="examples-23"><a href="#examples-23">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![feature(split_array)]
</span><span class="kw">let </span>v = <span class="kw-2">&amp;</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="kw">let </span>(left, right) = v.split_array_ref::&lt;<span class="number">0</span>&gt;();
<span class="macro">assert_eq!</span>(left, <span class="kw-2">&amp;</span>[]);
<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_array_ref::&lt;<span class="number">2</span>&gt;();
<span class="macro">assert_eq!</span>(left, <span class="kw-2">&amp;</span>[<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_array_ref::&lt;<span class="number">6</span>&gt;();
<span class="macro">assert_eq!</span>(left, <span class="kw-2">&amp;</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>(right, []);
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.rsplit_array_ref" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.rsplit_array_ref" class="fnname">rsplit_array_ref</a>&lt;const N:&nbsp;usize&gt;(&amp;self) -&gt; (&amp;[T], &amp;[T; N])</h4></section><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>split_array</code>)</span></div></span></summary><div class="docblock"><p>Divides one slice into an array and a remainder slice at an index from
the end.</p>
<p>The slice will contain all indices from <code>[0, len - N)</code> (excluding
the index <code>len - N</code> itself) and the array will contain all
indices from <code>[len - N, len)</code> (excluding the index <code>len</code> itself).</p>
<h5 id="panics-11"><a href="#panics-11">Panics</a></h5>
<p>Panics if <code>N &gt; len</code>.</p>
<h5 id="examples-24"><a href="#examples-24">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![feature(split_array)]
</span><span class="kw">let </span>v = <span class="kw-2">&amp;</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="kw">let </span>(left, right) = v.rsplit_array_ref::&lt;<span class="number">0</span>&gt;();
<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="kw-2">&amp;</span>[]);
}
{
<span class="kw">let </span>(left, right) = v.rsplit_array_ref::&lt;<span class="number">2</span>&gt;();
<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="macro">assert_eq!</span>(right, <span class="kw-2">&amp;</span>[<span class="number">5</span>, <span class="number">6</span>]);
}
{
<span class="kw">let </span>(left, right) = v.rsplit_array_ref::&lt;<span class="number">6</span>&gt;();
<span class="macro">assert_eq!</span>(left, []);
<span class="macro">assert_eq!</span>(right, <span class="kw-2">&amp;</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>]);
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.split-1" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.split-1" class="fnname">split</a>&lt;F&gt;(&amp;self, pred: F) -&gt; Split&lt;'_, T, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: FnMut(&amp;T) -&gt; bool,</span></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-25"><a href="#examples-25">Examples</a></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">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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">&amp;</span>[<span class="number">10</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="number">20</span>]);
<span class="macro">assert!</span>(iter.next().is_none());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.split_inclusive" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.51.0">1.51.0</span><h4 class="code-header">pub fn <a href="#method.split_inclusive" class="fnname">split_inclusive</a>&lt;F&gt;(&amp;self, pred: F) -&gt; SplitInclusive&lt;'_, T, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: FnMut(&amp;T) -&gt; bool,</span></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-26"><a href="#examples-26">Examples</a></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">&amp;</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">&amp;</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">&amp;</span>[<span class="number">3</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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="rustdoc-toggle method-toggle" open><summary><section id="method.rsplit-1" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.27.0">1.27.0</span><h4 class="code-header">pub fn <a href="#method.rsplit-1" class="fnname">rsplit</a>&lt;F&gt;(&amp;self, pred: F) -&gt; RSplit&lt;'_, T, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: FnMut(&amp;T) -&gt; bool,</span></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-27"><a href="#examples-27">Examples</a></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">&amp;</span>[<span class="number">44</span>, <span class="number">55</span>]);
<span class="macro">assert_eq!</span>(iter.next().unwrap(), <span class="kw-2">&amp;</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">&amp;</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">&amp;</span>[]);
<span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="number">3</span>, <span class="number">5</span>]);
<span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">1</span>]);
<span class="macro">assert_eq!</span>(it.next().unwrap(), <span class="kw-2">&amp;</span>[]);
<span class="macro">assert_eq!</span>(it.next(), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.splitn" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.splitn" class="fnname">splitn</a>&lt;F&gt;(&amp;self, n: usize, pred: F) -&gt; SplitN&lt;'_, T, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: FnMut(&amp;T) -&gt; bool,</span></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-28"><a href="#examples-28">Examples</a></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">&quot;{group:?}&quot;</span>);
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.rsplitn" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.rsplitn" class="fnname">rsplitn</a>&lt;F&gt;(&amp;self, n: usize, pred: F) -&gt; RSplitN&lt;'_, T, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: FnMut(&amp;T) -&gt; bool,</span></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-29"><a href="#examples-29">Examples</a></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">&quot;{group:?}&quot;</span>);
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.contains" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.contains" class="fnname">contains</a>(&amp;self, x: &amp;T) -&gt; bool<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: PartialEq&lt;T&gt;,</span></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="slice::binary_search"><code>binary_search</code></a> may be faster.</p>
<h5 id="examples-30"><a href="#examples-30">Examples</a></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">&amp;</span><span class="number">30</span>));
<span class="macro">assert!</span>(!v.contains(<span class="kw-2">&amp;</span><span class="number">50</span>));</code></pre></div>
<p>If you do not have a <code>&amp;T</code>, but some other value that you can compare
with one (for example, <code>String</code> implements <code>PartialEq&lt;str&gt;</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">&quot;hello&quot;</span>), String::from(<span class="string">&quot;world&quot;</span>)]; <span class="comment">// slice of `String`
</span><span class="macro">assert!</span>(v.iter().any(|e| e == <span class="string">&quot;hello&quot;</span>)); <span class="comment">// search with `&amp;str`
</span><span class="macro">assert!</span>(!v.iter().any(|e| e == <span class="string">&quot;hi&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.starts_with" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.starts_with" class="fnname">starts_with</a>(&amp;self, needle: &amp;[T]) -&gt; bool<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: PartialEq&lt;T&gt;,</span></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-31"><a href="#examples-31">Examples</a></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">&amp;</span>[<span class="number">10</span>]));
<span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]));
<span class="macro">assert!</span>(!v.starts_with(<span class="kw-2">&amp;</span>[<span class="number">50</span>]));
<span class="macro">assert!</span>(!v.starts_with(<span class="kw-2">&amp;</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">&amp;</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">&amp;</span>[]));
<span class="kw">let </span>v: <span class="kw-2">&amp;</span>[u8] = <span class="kw-2">&amp;</span>[];
<span class="macro">assert!</span>(v.starts_with(<span class="kw-2">&amp;</span>[]));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ends_with" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.ends_with" class="fnname">ends_with</a>(&amp;self, needle: &amp;[T]) -&gt; bool<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: PartialEq&lt;T&gt;,</span></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-32"><a href="#examples-32">Examples</a></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">&amp;</span>[<span class="number">30</span>]));
<span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>]));
<span class="macro">assert!</span>(!v.ends_with(<span class="kw-2">&amp;</span>[<span class="number">50</span>]));
<span class="macro">assert!</span>(!v.ends_with(<span class="kw-2">&amp;</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">&amp;</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">&amp;</span>[]));
<span class="kw">let </span>v: <span class="kw-2">&amp;</span>[u8] = <span class="kw-2">&amp;</span>[];
<span class="macro">assert!</span>(v.ends_with(<span class="kw-2">&amp;</span>[]));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.strip_prefix" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.51.0">1.51.0</span><h4 class="code-header">pub fn <a href="#method.strip_prefix" class="fnname">strip_prefix</a>&lt;P&gt;(&amp;self, prefix: &amp;P) -&gt; Option&lt;&amp;[T]&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;P: SlicePattern&lt;Item = T&gt; + ?Sized,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: PartialEq&lt;T&gt;,</span></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-33"><a href="#examples-33">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&amp;</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">&amp;</span>[<span class="number">10</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>][..]));
<span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">30</span>][..]));
<span class="macro">assert_eq!</span>(v.strip_prefix(<span class="kw-2">&amp;</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">&amp;</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">&amp;</span>str = <span class="string">&quot;he&quot;</span>;
<span class="macro">assert_eq!</span>(<span class="string">b&quot;hello&quot;</span>.strip_prefix(prefix.as_bytes()),
<span class="prelude-val">Some</span>(<span class="string">b&quot;llo&quot;</span>.as_ref()));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.strip_suffix" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.51.0">1.51.0</span><h4 class="code-header">pub fn <a href="#method.strip_suffix" class="fnname">strip_suffix</a>&lt;P&gt;(&amp;self, suffix: &amp;P) -&gt; Option&lt;&amp;[T]&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;P: SlicePattern&lt;Item = T&gt; + ?Sized,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: PartialEq&lt;T&gt;,</span></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-34"><a href="#examples-34">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>v = <span class="kw-2">&amp;</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">&amp;</span>[<span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>][..]));
<span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>][..]));
<span class="macro">assert_eq!</span>(v.strip_suffix(<span class="kw-2">&amp;</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">&amp;</span>[<span class="number">50</span>, <span class="number">30</span>]), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.binary_search" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.binary_search" class="fnname">binary_search</a>(&amp;self, x: &amp;T) -&gt; Result&lt;usize, usize&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Ord,</span></h4></section></summary><div class="docblock"><p>Binary searches this slice for a given element.
This behaves similarly to <a href="slice::contains"><code>contains</code></a> if this slice is sorted.</p>
<p>If the value is found then [<code>Result::Ok</code>] 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 [<code>Result::Err</code>] is returned, containing
the index where a matching element could be inserted while maintaining
sorted order.</p>
<p>See also <a href="slice::binary_search_by"><code>binary_search_by</code></a>, <a href="slice::binary_search_by_key"><code>binary_search_by_key</code></a>, and <a href="slice::partition_point"><code>partition_point</code></a>.</p>
<h5 id="examples-35"><a href="#examples-35">Examples</a></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">&amp;</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">&amp;</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">&amp;</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">&amp;</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>) =&gt; <span class="bool-val">true</span>, <span class="kw">_ </span>=&gt; <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="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 &lt; <span class="kw-2">&amp;</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 &lt;= <span class="kw-2">&amp;</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">&amp;</span><span class="number">1</span>);
<span class="macro">assert!</span>((low..high).contains(<span class="kw-2">&amp;</span>r.unwrap()));
<span class="macro">assert!</span>(s[..low].iter().all(|<span class="kw-2">&amp;</span>x| x &lt; <span class="number">1</span>));
<span class="macro">assert!</span>(s[low..high].iter().all(|<span class="kw-2">&amp;</span>x| x == <span class="number">1</span>));
<span class="macro">assert!</span>(s[high..].iter().all(|<span class="kw-2">&amp;</span>x| x &gt; <span class="number">1</span>));
<span class="comment">// For something not found, the &quot;range&quot; of equal items is empty
</span><span class="macro">assert_eq!</span>(s.partition_point(|x| x &lt; <span class="kw-2">&amp;</span><span class="number">11</span>), <span class="number">9</span>);
<span class="macro">assert_eq!</span>(s.partition_point(|x| x &lt;= <span class="kw-2">&amp;</span><span class="number">11</span>), <span class="number">9</span>);
<span class="macro">assert_eq!</span>(s.binary_search(<span class="kw-2">&amp;</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="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">&amp;</span>x| x &lt; num);
<span class="comment">// The above is equivalent to `let idx = s.binary_search(&amp;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="rustdoc-toggle method-toggle" open><summary><section id="method.binary_search_by" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.binary_search_by" class="fnname">binary_search_by</a>&lt;'a, F&gt;(&amp;'a self, f: F) -&gt; Result&lt;usize, usize&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: FnMut(&amp;'a T) -&gt; Ordering,</span></h4></section></summary><div class="docblock"><p>Binary searches this slice with a comparator function.
This behaves similarly to <a href="slice::contains"><code>contains</code></a> if this slice is sorted.</p>
<p>The comparator function should implement an order consistent
with the sort order of the underlying slice, returning an
order code that indicates whether its argument is <code>Less</code>,
<code>Equal</code> or <code>Greater</code> the desired target.</p>
<p>If the value is found then [<code>Result::Ok</code>] 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 [<code>Result::Err</code>] is returned, containing
the index where a matching element could be inserted while maintaining
sorted order.</p>
<p>See also <a href="slice::binary_search"><code>binary_search</code></a>, <a href="slice::binary_search_by_key"><code>binary_search_by_key</code></a>, and <a href="slice::partition_point"><code>partition_point</code></a>.</p>
<h5 id="examples-36"><a href="#examples-36">Examples</a></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">&amp;</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">&amp;</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">&amp;</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">&amp;</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>) =&gt; <span class="bool-val">true</span>, <span class="kw">_ </span>=&gt; <span class="bool-val">false</span>, });</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.binary_search_by_key" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.10.0">1.10.0</span><h4 class="code-header">pub fn <a href="#method.binary_search_by_key" class="fnname">binary_search_by_key</a>&lt;'a, B, F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;'a self,<br>&nbsp;&nbsp;&nbsp;&nbsp;b: &amp;B,<br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; Result&lt;usize, usize&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: FnMut(&amp;'a T) -&gt; B,<br>&nbsp;&nbsp;&nbsp;&nbsp;B: Ord,</span></h4></section></summary><div class="docblock"><p>Binary searches this slice with a key extraction function.
This behaves similarly to <a href="slice::contains"><code>contains</code></a> if this slice is sorted.</p>
<p>Assumes that the slice is sorted by the key, for instance with
<a href="slice::sort_by_key"><code>sort_by_key</code></a> using the same key extraction function.</p>
<p>If the value is found then [<code>Result::Ok</code>] 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 [<code>Result::Err</code>] is returned, containing
the index where a matching element could be inserted while maintaining
sorted order.</p>
<p>See also <a href="slice::binary_search"><code>binary_search</code></a>, <a href="slice::binary_search_by"><code>binary_search_by</code></a>, and <a href="slice::partition_point"><code>partition_point</code></a>.</p>
<h5 id="examples-37"><a href="#examples-37">Examples</a></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">&amp;</span><span class="number">13</span>, |<span class="kw-2">&amp;</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">&amp;</span><span class="number">4</span>, |<span class="kw-2">&amp;</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">&amp;</span><span class="number">100</span>, |<span class="kw-2">&amp;</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">&amp;</span><span class="number">1</span>, |<span class="kw-2">&amp;</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>) =&gt; <span class="bool-val">true</span>, <span class="kw">_ </span>=&gt; <span class="bool-val">false</span>, });</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.align_to" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.30.0">1.30.0</span><h4 class="code-header">pub unsafe fn <a href="#method.align_to" class="fnname">align_to</a>&lt;U&gt;(&amp;self) -&gt; (&amp;[T], &amp;[U], &amp;[T])</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. The method may make the middle slice the greatest
length possible for a given type and input slice, but only your algorithm’s performance
should depend on that, not its correctness. It is permissible for all of the input data to
be returned as the prefix or suffix slice.</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 href="#safety-3">Safety</a></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::&lt;T, U&gt;</code> also apply here.</p>
<h5 id="examples-38"><a href="#examples-38">Examples</a></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::&lt;u16&gt;();
<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="rustdoc-toggle method-toggle" open><summary><section id="method.as_simd" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.as_simd" class="fnname">as_simd</a>&lt;const LANES:&nbsp;usize&gt;(&amp;self) -&gt; (&amp;[T], &amp;[Simd&lt;T, LANES&gt;], &amp;[T])<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Simd&lt;T, LANES&gt;: AsRef&lt;[T; LANES]&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: SimdElement,<br>&nbsp;&nbsp;&nbsp;&nbsp;LaneCount&lt;LANES&gt;: SupportedLaneCount,</span></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 [<code>slice::align_to</code>], 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() &gt;= LANES</code>.</li>
<li><code>middle.is_empty()</code> despite <code>self.len() &gt;= 3 * LANES</code>.</li>
<li><code>suffix.len() &gt;= 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-12"><a href="#panics-12">Panics</a></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&lt;T, LANES&gt;</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-39"><a href="#examples-39">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![feature(portable_simd)]
</span><span class="kw">use </span>core::simd::SimdFloat;
<span class="kw">let </span>short = <span class="kw-2">&amp;</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::&lt;<span class="number">4</span>&gt;();
<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::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;(), <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">&amp;</span>[f32]) -&gt; f32 {
<span class="kw">use </span>std::ops::Add;
<span class="kw">use </span>std::simd::f32x4;
<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&lt;f32&gt; = (<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">&amp;</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="rustdoc-toggle method-toggle" open><summary><section id="method.is_sorted" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.is_sorted" class="fnname">is_sorted</a>(&amp;self) -&gt; bool<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: PartialOrd&lt;T&gt;,</span></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 &lt;= 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-40"><a href="#examples-40">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![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="rustdoc-toggle method-toggle" open><summary><section id="method.is_sorted_by" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.is_sorted_by" class="fnname">is_sorted_by</a>&lt;F&gt;(&amp;self, compare: F) -&gt; bool<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: FnMut(&amp;T, &amp;T) -&gt; Option&lt;Ordering&gt;,</span></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 the ordering of two elements. Apart from that, it’s equivalent to
<a href="slice::is_sorted"><code>is_sorted</code></a>; see its documentation for more information.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_sorted_by_key" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.is_sorted_by_key" class="fnname">is_sorted_by_key</a>&lt;F, K&gt;(&amp;self, f: F) -&gt; bool<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: FnMut(&amp;T) -&gt; K,<br>&nbsp;&nbsp;&nbsp;&nbsp;K: PartialOrd&lt;K&gt;,</span></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="slice::is_sorted"><code>is_sorted</code></a>; see its
documentation for more information.</p>
<h5 id="examples-41"><a href="#examples-41">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![feature(is_sorted)]
</span><span class="macro">assert!</span>([<span class="string">&quot;c&quot;</span>, <span class="string">&quot;bb&quot;</span>, <span class="string">&quot;aaa&quot;</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="rustdoc-toggle method-toggle" open><summary><section id="method.partition_point" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.52.0">1.52.0</span><h4 class="code-header">pub fn <a href="#method.partition_point" class="fnname">partition_point</a>&lt;P&gt;(&amp;self, pred: P) -&gt; usize<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;P: FnMut(&amp;T) -&gt; bool,</span></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, [7, 15, 3, 5, 4, 12, 6] is a partitioned under the predicate x % 2 != 0
(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="slice::binary_search"><code>binary_search</code></a>, <a href="slice::binary_search_by"><code>binary_search_by</code></a>, and <a href="slice::binary_search_by_key"><code>binary_search_by_key</code></a>.</p>
<h5 id="examples-42"><a href="#examples-42">Examples</a></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">&amp;</span>x| x &lt; <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">&amp;</span>x| x &lt; <span class="number">5</span>));
<span class="macro">assert!</span>(v[i..].iter().all(|<span class="kw-2">&amp;</span>x| !(x &lt; <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 &lt; <span class="kw-2">&amp;</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 &lt; <span class="kw-2">&amp;</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">&amp;</span>x| x &lt; 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></div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.flatten" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.flatten" class="fnname">flatten</a>(&amp;self) -&gt; &amp;[T]</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>&amp;[[T; N]]</code>, and flattens it to a <code>&amp;[T]</code>.</p>
<h5 id="panics-13"><a href="#panics-13">Panics</a></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::&lt;T&gt;() &gt; 0</code>, this will never panic.</p>
<h5 id="examples-43"><a href="#examples-43">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![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">&amp;</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">&amp;</span>[[i32; <span class="number">0</span>]] = <span class="kw-2">&amp;</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">&amp;</span>[[u32; <span class="number">10</span>]] = <span class="kw-2">&amp;</span>[];
<span class="macro">assert!</span>(empty_slice_of_arrays.flatten().is_empty());</code></pre></div>
</div></details></div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_ascii" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.23.0">1.23.0</span><h4 class="code-header">pub fn <a href="#method.is_ascii" class="fnname">is_ascii</a>(&amp;self) -&gt; bool</h4></section></summary><div class="docblock"><p>Checks if all bytes in this slice are within the ASCII range.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.eq_ignore_ascii_case" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.23.0">1.23.0</span><h4 class="code-header">pub fn <a href="#method.eq_ignore_ascii_case" class="fnname">eq_ignore_ascii_case</a>(&amp;self, other: &amp;[u8]) -&gt; bool</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="rustdoc-toggle method-toggle" open><summary><section id="method.escape_ascii" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.60.0">1.60.0</span><h4 class="code-header">pub fn <a href="#method.escape_ascii" class="fnname">escape_ascii</a>(&amp;self) -&gt; EscapeAscii&lt;'_&gt;</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-44"><a href="#examples-44">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>
<span class="kw">let </span>s = <span class="string">b&quot;0\t\r\n&#39;\&quot;\\\x9d&quot;</span>;
<span class="kw">let </span>escaped = s.escape_ascii().to_string();
<span class="macro">assert_eq!</span>(escaped, <span class="string">&quot;0\\t\\r\\n\\&#39;\\\&quot;\\\\\\x9d&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.trim_ascii_start" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.trim_ascii_start" class="fnname">trim_ascii_start</a>(&amp;self) -&gt; &amp;[u8]</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-45"><a href="#examples-45">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![feature(byte_slice_trim_ascii)]
</span><span class="macro">assert_eq!</span>(<span class="string">b&quot; \t hello world\n&quot;</span>.trim_ascii_start(), <span class="string">b&quot;hello world\n&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="string">b&quot; &quot;</span>.trim_ascii_start(), <span class="string">b&quot;&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="string">b&quot;&quot;</span>.trim_ascii_start(), <span class="string">b&quot;&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.trim_ascii_end" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.trim_ascii_end" class="fnname">trim_ascii_end</a>(&amp;self) -&gt; &amp;[u8]</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-46"><a href="#examples-46">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![feature(byte_slice_trim_ascii)]
</span><span class="macro">assert_eq!</span>(<span class="string">b&quot;\r hello world\n &quot;</span>.trim_ascii_end(), <span class="string">b&quot;\r hello world&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="string">b&quot; &quot;</span>.trim_ascii_end(), <span class="string">b&quot;&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="string">b&quot;&quot;</span>.trim_ascii_end(), <span class="string">b&quot;&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.trim_ascii" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.trim_ascii" class="fnname">trim_ascii</a>(&amp;self) -&gt; &amp;[u8]</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-47"><a href="#examples-47">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![feature(byte_slice_trim_ascii)]
</span><span class="macro">assert_eq!</span>(<span class="string">b&quot;\r hello world\n &quot;</span>.trim_ascii(), <span class="string">b&quot;hello world&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="string">b&quot; &quot;</span>.trim_ascii(), <span class="string">b&quot;&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="string">b&quot;&quot;</span>.trim_ascii(), <span class="string">b&quot;&quot;</span>);</code></pre></div>
</div></details></div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_ascii_uppercase" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.23.0">1.23.0</span><h4 class="code-header">pub fn <a href="#method.to_ascii_uppercase" class="fnname">to_ascii_uppercase</a>(&amp;self) -&gt; Vec&lt;u8, Global&gt;</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="slice::make_ascii_uppercase"><code>make_ascii_uppercase</code></a>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_ascii_lowercase" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.23.0">1.23.0</span><h4 class="code-header">pub fn <a href="#method.to_ascii_lowercase" class="fnname">to_ascii_lowercase</a>(&amp;self) -&gt; Vec&lt;u8, Global&gt;</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="slice::make_ascii_lowercase"><code>make_ascii_lowercase</code></a>.</p>
</div></details></div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_vec" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.to_vec" class="fnname">to_vec</a>(&amp;self) -&gt; Vec&lt;T, Global&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Clone,</span></h4></section></summary><div class="docblock"><p>Copies <code>self</code> into a new <code>Vec</code>.</p>
<h5 id="examples-48"><a href="#examples-48">Examples</a></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="rustdoc-toggle method-toggle" open><summary><section id="method.to_vec_in" class="method has-srclink"><h4 class="code-header">pub fn <a href="#method.to_vec_in" class="fnname">to_vec_in</a>&lt;A&gt;(&amp;self, alloc: A) -&gt; Vec&lt;T, A&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: Allocator,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Clone,</span></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-49"><a href="#examples-49">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="attribute">#![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="rustdoc-toggle method-toggle" open><summary><section id="method.repeat" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.40.0">1.40.0</span><h4 class="code-header">pub fn <a href="#method.repeat" class="fnname">repeat</a>(&amp;self, n: usize) -&gt; Vec&lt;T, Global&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Copy,</span></h4></section></summary><div class="docblock"><p>Creates a vector by repeating a slice <code>n</code> times.</p>
<h5 id="panics-14"><a href="#panics-14">Panics</a></h5>
<p>This function will panic if the capacity would overflow.</p>
<h5 id="examples-50"><a href="#examples-50">Examples</a></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"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="comment">// this will panic at runtime
</span><span class="string">b&quot;0123456789abcdef&quot;</span>.repeat(usize::MAX);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.concat" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.concat" class="fnname">concat</a>&lt;Item&gt;(&amp;self) -&gt; &lt;[T] as Concat&lt;Item&gt;&gt;::Output<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;[T]: Concat&lt;Item&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;Item: ?Sized,</span></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-51"><a href="#examples-51">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>([<span class="string">&quot;hello&quot;</span>, <span class="string">&quot;world&quot;</span>].concat(), <span class="string">&quot;helloworld&quot;</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="rustdoc-toggle method-toggle" open><summary><section id="method.join" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.3.0">1.3.0</span><h4 class="code-header">pub fn <a href="#method.join" class="fnname">join</a>&lt;Separator&gt;(&amp;self, sep: Separator) -&gt; &lt;[T] as Join&lt;Separator&gt;&gt;::Output<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;[T]: Join&lt;Separator&gt;,</span></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-52"><a href="#examples-52">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>([<span class="string">&quot;hello&quot;</span>, <span class="string">&quot;world&quot;</span>].join(<span class="string">&quot; &quot;</span>), <span class="string">&quot;hello world&quot;</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">&amp;</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">&amp;</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="rustdoc-toggle method-toggle" open><summary><section id="method.connect" class="method has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><h4 class="code-header">pub fn <a href="#method.connect" class="fnname">connect</a>&lt;Separator&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;sep: Separator<br>) -&gt; &lt;[T] as Join&lt;Separator&gt;&gt;::Output<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;[T]: Join&lt;Separator&gt;,</span></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-53"><a href="#examples-53">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>([<span class="string">&quot;hello&quot;</span>, <span class="string">&quot;world&quot;</span>].connect(<span class="string">&quot; &quot;</span>), <span class="string">&quot;hello world&quot;</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">&amp;</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></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-AsRef%3C%5Bu8%5D%3E-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#235">source</a><a href="#impl-AsRef%3C%5Bu8%5D%3E-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl AsRef&lt;[u8]&gt; for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.as_ref" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#237">source</a><a href="#method.as_ref" class="anchor"></a><h4 class="code-header">fn <a class="fnname">as_ref</a>(&amp;self) -&gt; &amp;[u8]</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="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Clone-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#12">source</a><a href="#impl-Clone-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl Clone for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#12">source</a><a href="#method.clone" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.clone_from" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">clone_from</a>(&amp;mut self, source: &amp;Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Debug-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#144">source</a><a href="#impl-Debug-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl Debug for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#145">source</a><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a class="fnname">fmt</a>(&amp;self, f: &amp;mut Formatter&lt;'_&gt;) -&gt; Result&lt;(), Error&gt;</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Deref-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#185">source</a><a href="#impl-Deref-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl Deref for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Target" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Target" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Target</a> = [u8]</h4></section></summary><div class='docblock'>The resulting type after dereferencing.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.deref" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#189">source</a><a href="#method.deref" class="anchor"></a><h4 class="code-header">fn <a class="fnname">deref</a>(&amp;self) -&gt; &amp;&lt;<a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a> as Deref&gt;::Target</h4></section></summary><div class='docblock'>Dereferences the value.</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-FileHandle-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/tantivy/directory/file_slice.rs.html#220-230">source</a><a href="#impl-FileHandle-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.FileHandle.html" title="trait tantivy::directory::FileHandle">FileHandle</a> for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_bytes" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/tantivy/directory/file_slice.rs.html#221-223">source</a><a href="#method.read_bytes" class="anchor"></a><h4 class="code-header">fn <a href="trait.FileHandle.html#tymethod.read_bytes" class="fnname">read_bytes</a>(&amp;self, range: Range&lt;usize&gt;) -&gt; Result&lt;<a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a>&gt;</h4></section></summary><div class='docblock'>Reads a slice of bytes. <a href="trait.FileHandle.html#tymethod.read_bytes">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialEq%3C%26%27a%20T%3E-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#177">source</a><a href="#impl-PartialEq%3C%26%27a%20T%3E-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;'a, T&gt; PartialEq&lt;&amp;'a T&gt; for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;<a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a>: PartialEq&lt;T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#180">source</a><a href="#method.eq" class="anchor"></a><h4 class="code-header">fn <a class="fnname">eq</a>(&amp;self, other: &amp;&amp;'a T) -&gt; bool</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>. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.ne" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">ne</a>(&amp;self, other: &amp;Rhs) -&gt; bool</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. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialEq%3C%5Bu8%5D%3E-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#165">source</a><a href="#impl-PartialEq%3C%5Bu8%5D%3E-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl PartialEq&lt;[u8]&gt; for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.eq-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#166">source</a><a href="#method.eq-1" class="anchor"></a><h4 class="code-header">fn <a class="fnname">eq</a>(&amp;self, other: &amp;[u8]) -&gt; bool</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>. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ne-1" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.ne-1" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">ne</a>(&amp;self, other: &amp;Rhs) -&gt; bool</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. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialEq%3COwnedBytes%3E-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#157">source</a><a href="#impl-PartialEq%3COwnedBytes%3E-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl PartialEq&lt;<a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a>&gt; for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.eq-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#158">source</a><a href="#method.eq-3" class="anchor"></a><h4 class="code-header">fn <a class="fnname">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a>) -&gt; bool</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>. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ne-3" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.ne-3" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">ne</a>(&amp;self, other: &amp;Rhs) -&gt; bool</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. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialEq%3Cstr%3E-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#171">source</a><a href="#impl-PartialEq%3Cstr%3E-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl PartialEq&lt;str&gt; for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.eq-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#172">source</a><a href="#method.eq-2" class="anchor"></a><h4 class="code-header">fn <a class="fnname">eq</a>(&amp;self, other: &amp;str) -&gt; bool</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>. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ne-2" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.ne-2" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">ne</a>(&amp;self, other: &amp;Rhs) -&gt; bool</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. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Read-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#194">source</a><a href="#impl-Read-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl Read for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#196">source</a><a href="#method.read" class="anchor"></a><h4 class="code-header">fn <a class="fnname">read</a>(&amp;mut self, buf: &amp;mut [u8]) -&gt; Result&lt;usize, Error&gt;</h4></section></summary><div class='docblock'>Pull some bytes from this source into the specified buffer, returning
how many bytes were read. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_to_end" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#213">source</a><a href="#method.read_to_end" class="anchor"></a><h4 class="code-header">fn <a class="fnname">read_to_end</a>(&amp;mut self, buf: &amp;mut Vec&lt;u8, Global&gt;) -&gt; Result&lt;usize, Error&gt;</h4></section></summary><div class='docblock'>Read all bytes until EOF in this source, placing them into <code>buf</code>. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_exact" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#223">source</a><a href="#method.read_exact" class="anchor"></a><h4 class="code-header">fn <a class="fnname">read_exact</a>(&amp;mut self, buf: &amp;mut [u8]) -&gt; Result&lt;(), Error&gt;</h4></section></summary><div class='docblock'>Read the exact number of bytes required to fill <code>buf</code>. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_vectored" class="method trait-impl has-srclink"><a href="#method.read_vectored" class="anchor"></a><h4 class="code-header">fn <a class="fnname">read_vectored</a>(&amp;mut self, bufs: &amp;mut [IoSliceMut&lt;'_&gt;]) -&gt; Result&lt;usize, Error&gt;</h4></section></summary><div class='docblock'>Like <code>read</code>, except that it reads into a slice of buffers. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_read_vectored" class="method trait-impl has-srclink"><a href="#method.is_read_vectored" class="anchor"></a><h4 class="code-header">fn <a class="fnname">is_read_vectored</a>(&amp;self) -&gt; bool</h4></section></summary><div class='docblock'>Determines if this <code>Read</code>er has an efficient <code>read_vectored</code>
implementation. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_to_string" class="method trait-impl has-srclink"><a href="#method.read_to_string" class="anchor"></a><h4 class="code-header">fn <a class="fnname">read_to_string</a>(&amp;mut self, buf: &amp;mut String) -&gt; Result&lt;usize, Error&gt;</h4></section></summary><div class='docblock'>Read all bytes until EOF in this source, appending them to <code>buf</code>. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_buf" class="method trait-impl has-srclink"><a href="#method.read_buf" class="anchor"></a><h4 class="code-header">fn <a class="fnname">read_buf</a>(&amp;mut self, buf: BorrowedCursor&lt;'_&gt;) -&gt; Result&lt;(), Error&gt;</h4></section></summary><div class='docblock'>Pull some bytes from this source into the specified buffer. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_buf_exact" class="method trait-impl has-srclink"><a href="#method.read_buf_exact" class="anchor"></a><h4 class="code-header">fn <a class="fnname">read_buf_exact</a>(&amp;mut self, cursor: BorrowedCursor&lt;'_&gt;) -&gt; Result&lt;(), Error&gt;</h4></section></summary><div class='docblock'>Read the exact number of bytes required to fill <code>cursor</code>. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.by_ref" class="method trait-impl has-srclink"><a href="#method.by_ref" class="anchor"></a><h4 class="code-header">fn <a class="fnname">by_ref</a>(&amp;mut self) -&gt; &amp;mut Self</h4></section></summary><div class='docblock'>Creates a “by reference” adaptor for this instance of <code>Read</code>. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.bytes" class="method trait-impl has-srclink"><a href="#method.bytes" class="anchor"></a><h4 class="code-header">fn <a class="fnname">bytes</a>(self) -&gt; Bytes&lt;Self&gt;</h4></section></summary><div class='docblock'>Transforms this <code>Read</code> instance to an [<code>Iterator</code>] over its bytes. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.chain" class="method trait-impl has-srclink"><a href="#method.chain" class="anchor"></a><h4 class="code-header">fn <a class="fnname">chain</a>&lt;R&gt;(self, next: R) -&gt; Chain&lt;Self, R&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: Read,</span></h4></section></summary><div class='docblock'>Creates an adapter which will chain this stream with another. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.take" class="method trait-impl has-srclink"><a href="#method.take" class="anchor"></a><h4 class="code-header">fn <a class="fnname">take</a>(self, limit: u64) -&gt; Take&lt;Self&gt;</h4></section></summary><div class='docblock'>Creates an adapter which will read at most <code>limit</code> bytes from it. <a>Read more</a></div></details></div></details><section id="impl-Eq-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/ownedbytes/lib.rs.html#163">source</a><a href="#impl-Eq-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl Eq for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-OwnedBytes" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl !RefUnwindSafe for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section><section id="impl-Send-for-OwnedBytes" class="impl has-srclink"><a href="#impl-Send-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl Send for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section><section id="impl-Sync-for-OwnedBytes" class="impl has-srclink"><a href="#impl-Sync-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl Sync for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section><section id="impl-Unpin-for-OwnedBytes" class="impl has-srclink"><a href="#impl-Unpin-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl Unpin for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section><section id="impl-UnwindSafe-for-OwnedBytes" class="impl has-srclink"><a href="#impl-UnwindSafe-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl !UnwindSafe for <a class="struct" href="struct.OwnedBytes.html" title="struct tantivy::directory::OwnedBytes">OwnedBytes</a></h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Any-for-OwnedBytes" class="impl has-srclink"><a href="#impl-Any-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Any for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl has-srclink"><a href="#method.type_id" class="anchor"></a><h4 class="code-header">fn <a class="fnname">type_id</a>(&amp;self) -&gt; TypeId</h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-OwnedBytes" class="impl has-srclink"><a href="#impl-Borrow%3CT%3E-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Borrow&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow</a>(&amp;self) -&gt; &amp;T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-OwnedBytes" class="impl has-srclink"><a href="#impl-BorrowMut%3CT%3E-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; BorrowMut&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow_mut</a>(&amp;mut self) -&gt; &amp;mut T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Downcast-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/downcast_rs/lib.rs.html#190">source</a><a href="#impl-Downcast-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../../downcast_rs/trait.Downcast.html" title="trait downcast_rs::Downcast">Downcast</a> for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Any,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into_any" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/downcast_rs/lib.rs.html#191">source</a><a href="#method.into_any" class="anchor"></a><h4 class="code-header">fn <a href="../../downcast_rs/trait.Downcast.html#tymethod.into_any" class="fnname">into_any</a>(self: Box&lt;T, Global&gt;) -&gt; Box&lt;dyn Any + 'static, Global&gt;</h4></section></summary><div class='docblock'>Convert <code>Box&lt;dyn Trait&gt;</code> (where <code>Trait: Downcast</code>) to <code>Box&lt;dyn Any&gt;</code>. <code>Box&lt;dyn Any&gt;</code> can
then be further <code>downcast</code> into <code>Box&lt;ConcreteType&gt;</code> where <code>ConcreteType</code> implements <code>Trait</code>. <a href="../../downcast_rs/trait.Downcast.html#tymethod.into_any">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into_any_rc" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/downcast_rs/lib.rs.html#192">source</a><a href="#method.into_any_rc" class="anchor"></a><h4 class="code-header">fn <a href="../../downcast_rs/trait.Downcast.html#tymethod.into_any_rc" class="fnname">into_any_rc</a>(self: Rc&lt;T&gt;) -&gt; Rc&lt;dyn Any + 'static&gt;</h4></section></summary><div class='docblock'>Convert <code>Rc&lt;Trait&gt;</code> (where <code>Trait: Downcast</code>) to <code>Rc&lt;Any&gt;</code>. <code>Rc&lt;Any&gt;</code> can then be
further <code>downcast</code> into <code>Rc&lt;ConcreteType&gt;</code> where <code>ConcreteType</code> implements <code>Trait</code>. <a href="../../downcast_rs/trait.Downcast.html#tymethod.into_any_rc">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.as_any" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/downcast_rs/lib.rs.html#193">source</a><a href="#method.as_any" class="anchor"></a><h4 class="code-header">fn <a href="../../downcast_rs/trait.Downcast.html#tymethod.as_any" class="fnname">as_any</a>(&amp;self) -&gt; &amp;(dyn Any + 'static)</h4></section></summary><div class='docblock'>Convert <code>&amp;Trait</code> (where <code>Trait: Downcast</code>) to <code>&amp;Any</code>. This is needed since Rust cannot
generate <code>&amp;Any</code>’s vtable from <code>&amp;Trait</code>’s. <a href="../../downcast_rs/trait.Downcast.html#tymethod.as_any">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.as_any_mut" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/downcast_rs/lib.rs.html#194">source</a><a href="#method.as_any_mut" class="anchor"></a><h4 class="code-header">fn <a href="../../downcast_rs/trait.Downcast.html#tymethod.as_any_mut" class="fnname">as_any_mut</a>(&amp;mut self) -&gt; &amp;mut (dyn Any + 'static)</h4></section></summary><div class='docblock'>Convert <code>&amp;mut Trait</code> (where <code>Trait: Downcast</code>) to <code>&amp;Any</code>. This is needed since Rust cannot
generate <code>&amp;mut Any</code>’s vtable from <code>&amp;mut Trait</code>’s. <a href="../../downcast_rs/trait.Downcast.html#tymethod.as_any_mut">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-DowncastSync-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/downcast_rs/lib.rs.html#204">source</a><a href="#impl-DowncastSync-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../../downcast_rs/trait.DowncastSync.html" title="trait downcast_rs::DowncastSync">DowncastSync</a> for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Any + Send + Sync,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into_any_arc" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/downcast_rs/lib.rs.html#205">source</a><a href="#method.into_any_arc" class="anchor"></a><h4 class="code-header">fn <a href="../../downcast_rs/trait.DowncastSync.html#tymethod.into_any_arc" class="fnname">into_any_arc</a>(self: Arc&lt;T&gt;) -&gt; Arc&lt;dyn Any + Sync + Send + 'static&gt;</h4></section></summary><div class='docblock'>Convert <code>Arc&lt;Trait&gt;</code> (where <code>Trait: Downcast</code>) to <code>Arc&lt;Any&gt;</code>. <code>Arc&lt;Any&gt;</code> can then be
further <code>downcast</code> into <code>Arc&lt;ConcreteType&gt;</code> where <code>ConcreteType</code> implements <code>Trait</code>. <a href="../../downcast_rs/trait.DowncastSync.html#tymethod.into_any_arc">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-OwnedBytes" class="impl has-srclink"><a href="#impl-From%3CT%3E-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; From&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-HasLen-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/tantivy_common/lib.rs.html#31">source</a><a href="#impl-HasLen-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../trait.HasLen.html" title="trait tantivy::HasLen">HasLen</a> for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Deref&lt;Target = [u8]&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.len-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/tantivy_common/lib.rs.html#32">source</a><a href="#method.len-2" class="anchor"></a><h4 class="code-header">fn <a href="../trait.HasLen.html#tymethod.len" class="fnname">len</a>(&amp;self) -&gt; usize</h4></section></summary><div class='docblock'>Return length</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_empty-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/tantivy_common/lib.rs.html#26">source</a><a href="#method.is_empty-2" class="anchor"></a><h4 class="code-header">fn <a href="../trait.HasLen.html#method.is_empty" class="fnname">is_empty</a>(&amp;self) -&gt; bool</h4></section></summary><div class='docblock'>Returns true iff empty.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-OwnedBytes" class="impl has-srclink"><a href="#impl-Into%3CU%3E-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; Into&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: From&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code>[From]&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Pointable-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_epoch/atomic.rs.html#194">source</a><a href="#impl-Pointable-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../../crossbeam_epoch/atomic/trait.Pointable.html" title="trait crossbeam_epoch::atomic::Pointable">Pointable</a> for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedconstant.ALIGN" class="associatedconstant trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_epoch/atomic.rs.html#195">source</a><a href="#associatedconstant.ALIGN" class="anchor"></a><h4 class="code-header">const <a href="../../crossbeam_epoch/atomic/trait.Pointable.html#associatedconstant.ALIGN" class="constant">ALIGN</a>: usize = mem::align_of::&lt;T&gt;()</h4></section></summary><div class='docblock'>The alignment of pointer.</div></details><details class="rustdoc-toggle" open><summary><section id="associatedtype.Init" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Init" class="anchor"></a><h4 class="code-header">type <a href="../../crossbeam_epoch/atomic/trait.Pointable.html#associatedtype.Init" class="associatedtype">Init</a> = T</h4></section></summary><div class='docblock'>The type for initializers.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.init" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_epoch/atomic.rs.html#199">source</a><a href="#method.init" class="anchor"></a><h4 class="code-header">unsafe fn <a href="../../crossbeam_epoch/atomic/trait.Pointable.html#tymethod.init" class="fnname">init</a>(init: &lt;T as <a class="trait" href="../../crossbeam_epoch/atomic/trait.Pointable.html" title="trait crossbeam_epoch::atomic::Pointable">Pointable</a>&gt;::<a class="associatedtype" href="../../crossbeam_epoch/atomic/trait.Pointable.html#associatedtype.Init" title="type crossbeam_epoch::atomic::Pointable::Init">Init</a>) -&gt; usize</h4></section></summary><div class='docblock'>Initializes a with the given initializer. <a href="../../crossbeam_epoch/atomic/trait.Pointable.html#tymethod.init">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.deref-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_epoch/atomic.rs.html#203">source</a><a href="#method.deref-1" class="anchor"></a><h4 class="code-header">unsafe fn <a href="../../crossbeam_epoch/atomic/trait.Pointable.html#tymethod.deref" class="fnname">deref</a>&lt;'a&gt;(ptr: usize) -&gt; &amp;'a T</h4></section></summary><div class='docblock'>Dereferences the given pointer. <a href="../../crossbeam_epoch/atomic/trait.Pointable.html#tymethod.deref">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.deref_mut" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_epoch/atomic.rs.html#207">source</a><a href="#method.deref_mut" class="anchor"></a><h4 class="code-header">unsafe fn <a href="../../crossbeam_epoch/atomic/trait.Pointable.html#tymethod.deref_mut" class="fnname">deref_mut</a>&lt;'a&gt;(ptr: usize) -&gt; &amp;'a mut T</h4></section></summary><div class='docblock'>Mutably dereferences the given pointer. <a href="../../crossbeam_epoch/atomic/trait.Pointable.html#tymethod.deref_mut">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.drop" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/crossbeam_epoch/atomic.rs.html#211">source</a><a href="#method.drop" class="anchor"></a><h4 class="code-header">unsafe fn <a href="../../crossbeam_epoch/atomic/trait.Pointable.html#tymethod.drop" class="fnname">drop</a>(ptr: usize)</h4></section></summary><div class='docblock'>Drops the object pointed to by the given pointer. <a href="../../crossbeam_epoch/atomic/trait.Pointable.html#tymethod.drop">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ReadBytesExt-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#1049">source</a><a href="#impl-ReadBytesExt-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;R&gt; <a class="trait" href="../../byteorder/io/trait.ReadBytesExt.html" title="trait byteorder::io::ReadBytesExt">ReadBytesExt</a> for R<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: Read + ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u8-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#55">source</a><a href="#method.read_u8-1" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u8" class="fnname">read_u8</a>(&amp;mut self) -&gt; Result&lt;u8, Error&gt;</h4></section></summary><div class='docblock'>Reads an unsigned 8 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u8">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i8" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#85">source</a><a href="#method.read_i8" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i8" class="fnname">read_i8</a>(&amp;mut self) -&gt; Result&lt;i8, Error&gt;</h4></section></summary><div class='docblock'>Reads a signed 8 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i8">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u16" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#112">source</a><a href="#method.read_u16" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u16" class="fnname">read_u16</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;u16, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads an unsigned 16 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u16">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i16" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#139">source</a><a href="#method.read_i16" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i16" class="fnname">read_i16</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;i16, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a signed 16 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i16">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u24" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#165">source</a><a href="#method.read_u24" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u24" class="fnname">read_u24</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;u32, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads an unsigned 24 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u24">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i24" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#191">source</a><a href="#method.read_i24" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i24" class="fnname">read_i24</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;i32, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a signed 24 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i24">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u32" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#217">source</a><a href="#method.read_u32" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u32" class="fnname">read_u32</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;u32, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads an unsigned 32 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u32">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i32" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#243">source</a><a href="#method.read_i32" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i32" class="fnname">read_i32</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;i32, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a signed 32 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i32">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u48" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#269">source</a><a href="#method.read_u48" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u48" class="fnname">read_u48</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;u64, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads an unsigned 48 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u48">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i48" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#295">source</a><a href="#method.read_i48" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i48" class="fnname">read_i48</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;i64, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a signed 48 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i48">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u64-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#321">source</a><a href="#method.read_u64-1" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u64" class="fnname">read_u64</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;u64, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads an unsigned 64 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u64">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i64" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#347">source</a><a href="#method.read_i64" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i64" class="fnname">read_i64</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;i64, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a signed 64 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i64">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u128" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#376">source</a><a href="#method.read_u128" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u128" class="fnname">read_u128</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;u128, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads an unsigned 128 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u128">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i128" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#402">source</a><a href="#method.read_i128" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i128" class="fnname">read_i128</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;i128, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a signed 128 bit integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i128">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_uint" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#427">source</a><a href="#method.read_uint" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_uint" class="fnname">read_uint</a>&lt;T&gt;(&amp;mut self, nbytes: usize) -&gt; Result&lt;u64, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads an unsigned n-bytes integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_uint">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_int" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#452">source</a><a href="#method.read_int" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_int" class="fnname">read_int</a>&lt;T&gt;(&amp;mut self, nbytes: usize) -&gt; Result&lt;i64, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a signed n-bytes integer from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_int">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_uint128" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#460">source</a><a href="#method.read_uint128" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_uint128" class="fnname">read_uint128</a>&lt;T&gt;(&amp;mut self, nbytes: usize) -&gt; Result&lt;u128, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads an unsigned n-bytes integer from the underlying reader.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_int128" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#468">source</a><a href="#method.read_int128" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_int128" class="fnname">read_int128</a>&lt;T&gt;(&amp;mut self, nbytes: usize) -&gt; Result&lt;i128, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a signed n-bytes integer from the underlying reader.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_f32" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#499">source</a><a href="#method.read_f32" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_f32" class="fnname">read_f32</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;f32, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a IEEE754 single-precision (4 bytes) floating point number from
the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_f32">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_f64" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#530">source</a><a href="#method.read_f64" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_f64" class="fnname">read_f64</a>&lt;T&gt;(&amp;mut self) -&gt; Result&lt;f64, Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a IEEE754 double-precision (8 bytes) floating point number from
the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_f64">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u16_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#562">source</a><a href="#method.read_u16_into" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u16_into" class="fnname">read_u16_into</a>&lt;T&gt;(&amp;mut self, dst: &amp;mut [u16]) -&gt; Result&lt;(), Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a sequence of unsigned 16 bit integers from the underlying
reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u16_into">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u32_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#597">source</a><a href="#method.read_u32_into" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u32_into" class="fnname">read_u32_into</a>&lt;T&gt;(&amp;mut self, dst: &amp;mut [u32]) -&gt; Result&lt;(), Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a sequence of unsigned 32 bit integers from the underlying
reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u32_into">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u64_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#635">source</a><a href="#method.read_u64_into" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u64_into" class="fnname">read_u64_into</a>&lt;T&gt;(&amp;mut self, dst: &amp;mut [u64]) -&gt; Result&lt;(), Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a sequence of unsigned 64 bit integers from the underlying
reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u64_into">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_u128_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#673-676">source</a><a href="#method.read_u128_into" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u128_into" class="fnname">read_u128_into</a>&lt;T&gt;(&amp;mut self, dst: &amp;mut [u128]) -&gt; Result&lt;(), Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a sequence of unsigned 128 bit integers from the underlying
reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_u128_into">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i8_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#716">source</a><a href="#method.read_i8_into" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i8_into" class="fnname">read_i8_into</a>(&amp;mut self, dst: &amp;mut [i8]) -&gt; Result&lt;(), Error&gt;</h4></section></summary><div class='docblock'>Reads a sequence of signed 8 bit integers from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i8_into">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i16_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#747">source</a><a href="#method.read_i16_into" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i16_into" class="fnname">read_i16_into</a>&lt;T&gt;(&amp;mut self, dst: &amp;mut [i16]) -&gt; Result&lt;(), Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a sequence of signed 16 bit integers from the underlying
reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i16_into">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i32_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#782">source</a><a href="#method.read_i32_into" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i32_into" class="fnname">read_i32_into</a>&lt;T&gt;(&amp;mut self, dst: &amp;mut [i32]) -&gt; Result&lt;(), Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a sequence of signed 32 bit integers from the underlying
reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i32_into">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i64_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#820">source</a><a href="#method.read_i64_into" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i64_into" class="fnname">read_i64_into</a>&lt;T&gt;(&amp;mut self, dst: &amp;mut [i64]) -&gt; Result&lt;(), Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a sequence of signed 64 bit integers from the underlying
reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i64_into">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_i128_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#858-861">source</a><a href="#method.read_i128_into" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i128_into" class="fnname">read_i128_into</a>&lt;T&gt;(&amp;mut self, dst: &amp;mut [i128]) -&gt; Result&lt;(), Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a sequence of signed 128 bit integers from the underlying
reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_i128_into">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_f32_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#902">source</a><a href="#method.read_f32_into" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_f32_into" class="fnname">read_f32_into</a>&lt;T&gt;(&amp;mut self, dst: &amp;mut [f32]) -&gt; Result&lt;(), Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a sequence of IEEE754 single-precision (4 bytes) floating
point numbers from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_f32_into">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_f32_into_unchecked" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#948-951">source</a><a href="#method.read_f32_into_unchecked" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_f32_into_unchecked" class="fnname">read_f32_into_unchecked</a>&lt;T&gt;(&amp;mut self, dst: &amp;mut [f32]) -&gt; Result&lt;(), Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 1.2.0: please use <code>read_f32_into</code> instead</span></div></span><div class='docblock'><strong>DEPRECATED</strong>. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_f32_into_unchecked">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_f64_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#987">source</a><a href="#method.read_f64_into" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_f64_into" class="fnname">read_f64_into</a>&lt;T&gt;(&amp;mut self, dst: &amp;mut [f64]) -&gt; Result&lt;(), Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><div class='docblock'>Reads a sequence of IEEE754 double-precision (8 bytes) floating
point numbers from the underlying reader. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_f64_into">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.read_f64_into_unchecked" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/byteorder/io.rs.html#1039-1042">source</a><a href="#method.read_f64_into_unchecked" class="anchor"></a><h4 class="code-header">fn <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_f64_into_unchecked" class="fnname">read_f64_into_unchecked</a>&lt;T&gt;(&amp;mut self, dst: &amp;mut [f64]) -&gt; Result&lt;(), Error&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../byteorder/trait.ByteOrder.html" title="trait byteorder::ByteOrder">ByteOrder</a>,</span></h4></section></summary><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 1.2.0: please use <code>read_f64_into</code> instead</span></div></span><div class='docblock'><strong>DEPRECATED</strong>. <a href="../../byteorder/io/trait.ReadBytesExt.html#method.read_f64_into_unchecked">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToOwned-for-OwnedBytes" class="impl has-srclink"><a href="#impl-ToOwned-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; ToOwned for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Clone,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Owned" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl has-srclink"><a href="#method.to_owned" class="anchor"></a><h4 class="code-header">fn <a class="fnname">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl has-srclink"><a href="#method.clone_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone_into</a>(&amp;self, target: &amp;mut T)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-OwnedBytes" class="impl has-srclink"><a href="#impl-TryFrom%3CU%3E-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryFrom&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: Into&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = Infallible</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(value: U) -&gt; Result&lt;T, &lt;T as TryFrom&lt;U&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-OwnedBytes" class="impl has-srclink"><a href="#impl-TryInto%3CU%3E-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryInto&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: TryFrom&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = &lt;U as TryFrom&lt;T&gt;&gt;::Error</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_into</a>(self) -&gt; Result&lt;U, &lt;U as TryFrom&lt;T&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-VZip%3CV%3E-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/ppv_lite86/types.rs.html#221">source</a><a href="#impl-VZip%3CV%3E-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;V, T&gt; <a class="trait" href="../../ppv_lite86/types/trait.VZip.html" title="trait ppv_lite86::types::VZip">VZip</a>&lt;V&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;V: <a class="trait" href="../../ppv_lite86/types/trait.MultiLane.html" title="trait ppv_lite86::types::MultiLane">MultiLane</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><section id="method.vzip" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/ppv_lite86/types.rs.html#226">source</a><a href="#method.vzip" class="anchor"></a><h4 class="code-header">fn <a href="../../ppv_lite86/types/trait.VZip.html#tymethod.vzip" class="fnname">vzip</a>(self) -&gt; V</h4></section></div></details><section id="impl-Fruit-for-OwnedBytes" class="impl has-srclink"><a class="srclink rightside" href="../../src/tantivy/collector/mod.rs.html#122">source</a><a href="#impl-Fruit-for-OwnedBytes" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../collector/trait.Fruit.html" title="trait tantivy::collector::Fruit">Fruit</a> for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Send + <a class="trait" href="../../downcast_rs/trait.Downcast.html" title="trait downcast_rs::Downcast">Downcast</a>,</span></h3></section></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tantivy" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>