<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="Struct representing a generic array - `GenericArray<T, N>` works like [T; N]"><metaname="keywords"content="rust, rustlang, rust-lang, GenericArray"><title>GenericArray in generic_array - Rust</title><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><linkrel="stylesheet"href="../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../static.files/rustdoc-6827029ac823cab7.css"id="mainThemeStyle"><linkrel="stylesheet"id="themeStyle"href="../static.files/light-ebce58d0a40c3431.css"><linkrel="stylesheet"disabledhref="../static.files/dark-f23faae4a2daf9a6.css"><linkrel="stylesheet"disabledhref="../static.files/ayu-8af5e100b21cd173.css"><scriptid="default-settings"></script><scriptsrc="../static.files/storage-d43fa987303ecbbb.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../static.files/main-c55e1eb52e1886b4.js"></script><noscript><linkrel="stylesheet"href="../static.files/noscript-13285aec31fa243e.css"></noscript><linkrel="alternate icon"type="image/png"href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><linkrel="alternate icon"type="image/png"href="../static.files/favicon-32x32-422f7d1d52889060.png"><linkrel="icon"type="image/svg+xml"href="../static.files/favicon-2c020d218678b618.svg"></head><bodyclass="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle">☰</button><aclass="sidebar-logo"href="../generic_array/index.html"><divclass="logo-container"><imgclass="rust-logo"src="../static.files/rust-logo-151179464ae7ed46.svg"alt="logo"></div></a><h2></h2></nav><navclass="sidebar"><aclass="sidebar-logo"href="../generic_array/index.html"><divclass="logo-container"><imgclass="rust-logo"src="../static.files/rust-logo-151179464ae7ed46.svg"alt="logo"></div></a><h2class="location"><ahref="#">GenericArray</a></h2><divclass="sidebar-elems"><section><h3><ahref="#implementations">Methods</a></h3><ulclass="block"><li><ahref="#method.as_mut_slice">as_mut_slice</a></li><li><ahref="#method.as_slice">as_slice</a></li><li><ahref="#method.clone_from_slice">clone_from_slice</a></li><li><ahref="#method.from_exact_iter">from_exact_iter</a></li><li><ahref="#method.from_mut_slice">from_mut_slice</a></li><li><ahref="#method.from_slice">from_slice</a></li></ul><h3><ahref="#deref-methods-%5BT%5D">Methods from Deref<Target=[T]></a></h3><ulclass="block"><li><ahref="#method.align_to">align_to</a></li><li><ahref="#method.align_to_mut">align_to_mut</a></li><li><ahref="#method.array_chunks">array_chunks</a></li><li><ahref="#method.array_chunks_mut">array_chunks_mut</a></li><li><ahref="#method.array_windows">array_windows</a></li><li><ahref="#method.as_chunks">as_chunks</a></li><li><ahref="#method.as_chunks_mut">as_chunks_mut</a></li><li><ahref="#method.as_chunks_unchecked">as_chunks_unchecked</a></li><li><ahref="#method.as_chunks_unchecked_mut">as_chunks_unchecked_mut</a></li><li><ahref="#method.as_mut_ptr">as_mut_ptr</a></li><li><ahref="#method.as_mut_ptr_rang
</div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><sectionid="impl-GenericArray%3CT%2C%20N%3E-2"class="impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/lib.rs.html#597-636">source</a><ahref="#impl-GenericArray%3CT%2C%20N%3E-2"class="anchor">§</a><h3class="code-header">impl<T, N><aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, N><spanclass="where fmt-newline">where<br> N: <aclass="trait"href="trait.ArrayLength.html"title="trait generic_array::ArrayLength">ArrayLength</a><T>,</span></h3></section></summary><divclass="impl-items"><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.from_exact_iter"class="method has-srclink"><aclass="srclink rightside"href="../src/generic_array/lib.rs.html#604-635">source</a><h4class="code-header">pub fn <ahref="#method.from_exact_iter"class="fn">from_exact_iter</a><I>(iter: I) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><Self><spanclass="where fmt-newline">where<br> I: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/iter/traits/collect/trait.IntoIterator.html"title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = T>,</span></h4></section></summary><divclass="docblock"><p>Creates a new <code>GenericArray</code> instance from an iterator with a specific size.</p>
</div></details></div></details></div><h2id="deref-methods-%5BT%5D"class="small-section-header"><span>Methods from <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/deref/trait.Deref.html"title="trait core::ops::deref::Deref">Deref</a><Target = <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>></span><ahref="#deref-methods-%5BT%5D"class="anchor">§</a></h2><divid="deref-methods-%5BT%5D-1"><divclass="impl-items"><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.sort_floats"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#4306">source</a><h4class="code-header">pub fn <ahref="#method.sort_floats"class="fn">sort_floats</a>(&mut self)</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>sort_floats</code>)</span></div></span></summary><divclass="docblock"><p>Sorts the slice of floats.</p>
<p>This sort is in-place (i.e. does not allocate), <em>O</em>(<em>n</em> * log(<em>n</em>)) worst-case, and uses
the ordering defined by <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.f64.html#method.total_cmp"title="f64::total_cmp"><code>f64::total_cmp</code></a>.</p>
<p>This uses the same sorting algorithm as <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.sort_unstable_by"><code>sort_unstable_by</code></a>.</p>
</div></details></div><divclass="impl-items"><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.is_ascii"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.23.0">1.23.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/ascii.rs.html#15">source</a></span><h4class="code-header">pub fn <ahref="#method.is_ascii"class="fn">is_ascii</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Checks if all bytes in this slice are within the ASCII range.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.eq_ignore_ascii_case"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.23.0">1.23.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/ascii.rs.html#26">source</a></span><h4class="code-header">pub fn <ahref="#method.eq_ignore_ascii_case"class="fn">eq_ignore_ascii_case</a>(&self, other: &[<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.u8.html">u8</a>]) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass="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><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.make_ascii_uppercase"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.23.0">1.23.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/ascii.rs.html#41">source</a></span><h4class="code-header">pub fn <ahref="#method.make_ascii_uppercase"class="fn">make_ascii_uppercase</a>(&mut self)</h4></section></summary><divclass="docblock"><p>Converts this slice to its ASCII upper case equivalent in-place.</p>
<p>ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’,
but non-ASCII letters are unchanged.</p>
<p>To return a new uppercased value without modifying the existing one, use
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.make_ascii_lowercase"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.23.0">1.23.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/ascii.rs.html#58">source</a></span><h4class="code-header">pub fn <ahref="#method.make_ascii_lowercase"class="fn">make_ascii_lowercase</a>(&mut self)</h4></section></summary><divclass="docblock"><p>Converts this slice to its ASCII lower case equivalent in-place.</p>
<p>ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’,
but non-ASCII letters are unchanged.</p>
<p>To return a new lowercased value without modifying the existing one, use
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.escape_ascii"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.60.0">1.60.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/ascii.rs.html#78">source</a></span><h4class="code-header">pub fn <ahref="#method.escape_ascii"class="fn">escape_ascii</a>(&self) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/ascii/struct.EscapeAscii.html"title="struct core::slice::ascii::EscapeAscii">EscapeAscii</a><'_></h4></section></summary><divclass="docblock"><p>Returns an iterator that produces an escaped version of this slice,
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.trim_ascii_start"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/ascii.rs.html#97">source</a><h4class="code-header">pub fn <ahref="#method.trim_ascii_start"class="fn">trim_ascii_start</a>(&self) ->&[<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.u8.html">u8</a>]</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>byte_slice_trim_ascii</code>)</span></div></span></summary><divclass="docblock"><p>Returns a byte slice with leading ASCII whitespace bytes removed.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.trim_ascii"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/ascii.rs.html#156">source</a><h4class="code-header">pub fn <ahref="#method.trim_ascii"class="fn">trim_ascii</a>(&self) ->&[<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.u8.html">u8</a>]</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>byte_slice_trim_ascii</code>)</span></div></span></summary><divclass="docblock"><p>Returns a byte slice with leading and trailing ASCII whitespace bytes
</div></details></div><divclass="impl-items"><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.len"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#130">source</a></span><h4class="code-header">pub fn <ahref="#method.len"class="fn">len</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a></h4></section></summary><divclass="docblock"><p>Returns the number of elements in the slice.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.is_empty"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#146">source</a></span><h4class="code-header">pub fn <ahref="#method.is_empty"class="fn">is_empty</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if the slice has a length of 0.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.first"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#165">source</a></span><h4class="code-header">pub fn <ahref="#method.first"class="fn">first</a>(&self) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T></h4></section></summary><divclass="docblock"><p>Returns the first element of the slice, or <code>None</code> if it is empty.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.first_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#185">source</a></span><h4class="code-header">pub fn <ahref="#method.first_mut"class="fn">first_mut</a>(&mut self) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&mut </a>T></h4></section></summary><divclass="docblock"><p>Returns a mutable pointer to the first element of the slice, or <code>None</code> if it is empty.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split_first"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.5.0">1.5.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#205">source</a></span><h4class="code-header">pub fn <ahref="#method.split_first"class="fn">split_first</a>(&self) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T, &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)></h4></section></summary><divclass="docblock"><p>Returns the first and all the rest of the elements of the slice, or <code>None</code> if it is empty.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split_first_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.5.0">1.5.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#227">source</a></span><h4class="code-header">pub fn <ahref="#method.split_first_mut"class="fn">split_first_mut</a>(&mut self) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&mut </a>T, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)></h4></section></summary><divclass="docblock"><p>Returns the first and all the rest of the elements of the slice, or <code>None</code> if it is empty.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split_last"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.5.0">1.5.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#247">source</a></span><h4class="code-header">pub fn <ahref="#method.split_last"class="fn">split_last</a>(&self) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T, &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)></h4></section></summary><divclass="docblock"><p>Returns the last and all the rest of the elements of the slice, or <code>None</code> if it is empty.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split_last_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.5.0">1.5.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#269">source</a></span><h4class="code-header">pub fn <ahref="#method.split_last_mut"class="fn">split_last_mut</a>(&mut self) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&mut </a>T, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)></h4></section></summary><divclass="docblock"><p>Returns the last and all the rest of the elements of the slice, or <code>None</code> if it is empty.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.last"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#288">source</a></span><h4class="code-header">pub fn <ahref="#method.last"class="fn">last</a>(&self) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T></h4></section></summary><divclass="docblock"><p>Returns the last element of the slice, or <code>None</code> if it is empty.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.last_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#308">source</a></span><h4class="code-header">pub fn <ahref="#method.last_mut"class="fn">last_mut</a>(&mut self) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&mut </a>T></h4></section></summary><divclass="docblock"><p>Returns a mutable pointer to the last item in the slice.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.get"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#333-335">source</a></span><h4class="code-header">pub fn <ahref="#method.get"class="fn">get</a><I>(&self, index: I) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><&<I as <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/slice/index/trait.SliceIndex.html"title="trait core::slice::index::SliceIndex">SliceIndex</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.67.0/core/slice/index/trait.SliceIndex.html#associatedtype.Output"title="type core::slice::index::SliceIndex::Output">Output</a>><spanclass="where fmt-newline">where<br> I: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/slice/index/trait.SliceIndex.html"title="trait core::slice::index::SliceIndex">SliceIndex</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>>,</span></h4></section></summary><divclass="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,
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.get_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#359-361">source</a></span><h4class="code-header">pub fn <ahref="#method.get_mut"class="fn">get_mut</a><I>(<br> &mut self,<br> index: I<br>) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><&mut <I as <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/slice/index/trait.SliceIndex.html"title="trait core::slice::index::SliceIndex">SliceIndex</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.67.0/core/slice/index/trait.SliceIndex.html#associatedtype.Output"title="type core::slice::index::SliceIndex::Output">Output</a>><spanclass="where fmt-newline">where<br> I: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/slice/index/trait.SliceIndex.html"title="trait core::slice::index::SliceIndex">SliceIndex</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>>,</span></h4></section></summary><divclass="docblock"><p>Returns a mutable reference to an element or subslice depending on the
type of index (see <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.get"><code>get</code></a>) or <code>None</code> if the index is out of bounds.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.get_unchecked"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#392-394">source</a></span><h4class="code-header">pub unsafe fn <ahref="#method.get_unchecked"class="fn">get_unchecked</a><I>(<br> &self,<br> index: I<br>) ->&<I as <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/slice/index/trait.SliceIndex.html"title="trait core::slice::index::SliceIndex">SliceIndex</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.67.0/core/slice/index/trait.SliceIndex.html#associatedtype.Output"title="type core::slice::index::SliceIndex::Output">Output</a><spanclass="where fmt-newline">where<br> I: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/slice/index/trait.SliceIndex.html"title="trait core::slice::index::SliceIndex">SliceIndex</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>>,</span></h4></section></summary><divclass="docblock"><p>Returns a reference to an element or subslice, without doing bounds
checking.</p>
<p>For a safe alternative see <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.get"><code>get</code></a>.</p>
<h5id="safety"><ahref="#safety">Safety</a></h5>
<p>Calling this method with an out-of-bounds index is <em><ahref="https://doc.rust-lang.org/reference/behavior-considered-undefined.html">undefined behavior</a></em>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.get_unchecked_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#430-432">source</a></span><h4class="code-header">pub unsafe fn <ahref="#method.get_unchecked_mut"class="fn">get_unchecked_mut</a><I>(<br> &mut self,<br> index: I<br>) ->&mut <I as <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/slice/index/trait.SliceIndex.html"title="trait core::slice::index::SliceIndex">SliceIndex</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.67.0/core/slice/index/trait.SliceIndex.html#associatedtype.Output"title="type core::slice::index::SliceIndex::Output">Output</a><spanclass="where fmt-newline">where<br> I: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/slice/index/trait.SliceIndex.html"title="trait core::slice::index::SliceIndex">SliceIndex</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>>,</span></h4></section></summary><divclass="docblock"><p>Returns a mutable reference to an element or subslice, without doing
bounds checking.</p>
<p>For a safe alternative see <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.get_mut"><code>get_mut</code></a>.</p>
<p>Calling this method with an out-of-bounds index is <em><ahref="https://doc.rust-lang.org/reference/behavior-considered-undefined.html">undefined behavior</a></em>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_ptr"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#470">source</a></span><h4class="code-header">pub fn <ahref="#method.as_ptr"class="fn">as_ptr</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.pointer.html">*const T</a></h4></section></summary><divclass="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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_mut_ptr"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#500">source</a></span><h4class="code-header">pub fn <ahref="#method.as_mut_ptr"class="fn">as_mut_ptr</a>(&mut self) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.pointer.html">*mut T</a></h4></section></summary><divclass="docblock"><p>Returns an unsafe mutable 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>Modifying the container referenced by this slice may cause its buffer
to be reallocated, which would also make any pointers to it invalid.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_ptr_range"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.48.0">1.48.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#536">source</a></span><h4class="code-header">pub fn <ahref="#method.as_ptr_range"class="fn">as_ptr_range</a>(&self) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/ops/range/struct.Range.html"title="struct core::ops::range::Range">Range</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.pointer.html">*const T</a>></h4></section></summary><divclass="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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.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
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_mut_ptr_range"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.48.0">1.48.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#580">source</a></span><h4class="code-header">pub fn <ahref="#method.as_mut_ptr_range"class="fn">as_mut_ptr_range</a>(&mut self) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/ops/range/struct.Range.html"title="struct core::ops::range::Range">Range</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.pointer.html">*mut T</a>></h4></section></summary><divclass="docblock"><p>Returns the two unsafe mutable 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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.as_mut_ptr"><code>as_mut_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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.swap"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#609">source</a></span><h4class="code-header">pub fn <ahref="#method.swap"class="fn">swap</a>(&mut self, a: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>, b: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>)</h4></section></summary><divclass="docblock"><p>Swaps two elements in the slice.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.swap_unchecked"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#652">source</a><h4class="code-header">pub unsafe fn <ahref="#method.swap_unchecked"class="fn">swap_unchecked</a>(&mut self, a: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>, b: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>)</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_swap_unchecked</code>)</span></div></span></summary><divclass="docblock"><p>Swaps two elements in the slice, without doing bounds checking.</p>
<p>For a safe alternative see <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.swap"><code>swap</code></a>.</p>
<p>Calling this method with an out-of-bounds index is <em><ahref="https://doc.rust-lang.org/reference/behavior-considered-undefined.html">undefined behavior</a></em>.
The caller has to ensure that <code>a < self.len()</code> and <code>b < self.len()</code>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.reverse"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#677">source</a></span><h4class="code-header">pub fn <ahref="#method.reverse"class="fn">reverse</a>(&mut self)</h4></section></summary><divclass="docblock"><p>Reverses the order of elements in the slice, in place.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.iter"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#735">source</a></span><h4class="code-header">pub fn <ahref="#method.iter"class="fn">iter</a>(&self) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.Iter.html"title="struct core::slice::iter::Iter">Iter</a><'_, T></h4></section></summary><divclass="docblock"><p>Returns an iterator over the slice.</p>
<p>The iterator yields all items from start to end.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.iter_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#754">source</a></span><h4class="code-header">pub fn <ahref="#method.iter_mut"class="fn">iter_mut</a>(&mut self) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.IterMut.html"title="struct core::slice::iter::IterMut">IterMut</a><'_, T></h4></section></summary><divclass="docblock"><p>Returns an iterator that allows modifying each value.</p>
<p>The iterator yields all items from start to end.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.windows"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#786">source</a></span><h4class="code-header">pub fn <ahref="#method.windows"class="fn">windows</a>(&self, size: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.Windows.html"title="struct core::slice::iter::Windows">Windows</a><'_, T></h4></section></summary><divclass="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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.chunks"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#820">source</a></span><h4class="code-header">pub fn <ahref="#method.chunks"class="fn">chunks</a>(&self, chunk_size: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.Chunks.html"title="struct core::slice::iter::Chunks">Chunks</a><'_, T></h4></section></summary><divclass="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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.rchunks"><code>rchunks</code></a> for the same iterator but starting at the end of the
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.chunks_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#858">source</a></span><h4class="code-header">pub fn <ahref="#method.chunks_mut"class="fn">chunks_mut</a>(&mut self, chunk_size: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.ChunksMut.html"title="struct core::slice::iter::ChunksMut">ChunksMut</a><'_, T></h4></section></summary><divclass="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 mutable 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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.chunks_exact_mut"><code>chunks_exact_mut</code></a> for a variant of this iterator that returns chunks of always
exactly <code>chunk_size</code> elements, and <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.rchunks_mut"><code>rchunks_mut</code></a> for the same iterator but starting at
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.chunks_exact"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.31.0">1.31.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#895">source</a></span><h4class="code-header">pub fn <ahref="#method.chunks_exact"class="fn">chunks_exact</a>(&self, chunk_size: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.ChunksExact.html"title="struct core::slice::iter::ChunksExact">ChunksExact</a><'_, T></h4></section></summary><divclass="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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.chunks"><code>chunks</code></a>.</p>
<p>See <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.chunks"><code>chunks</code></a> for a variant of this iterator that also returns the remainder as a smaller
chunk, and <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.rchunks_exact"><code>rchunks_exact</code></a> for the same iterator but starting at the end of the slice.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.chunks_exact_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.31.0">1.31.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#937">source</a></span><h4class="code-header">pub fn <ahref="#method.chunks_exact_mut"class="fn">chunks_exact_mut</a>(&mut self, chunk_size: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.ChunksExactMut.html"title="struct core::slice::iter::ChunksExactMut">ChunksExactMut</a><'_, T></h4></section></summary><divclass="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 mutable 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>into_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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.chunks_mut"><code>chunks_mut</code></a>.</p>
<p>See <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.chunks_mut"><code>chunks_mut</code></a> for a variant of this iterator that also returns the remainder as a
smaller chunk, and <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.rchunks_exact_mut"><code>rchunks_exact_mut</code></a> for the same iterator but starting at the end of
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_chunks_unchecked"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#972">source</a><h4class="code-header">pub unsafe fn <ahref="#method.as_chunks_unchecked"class="fn">as_chunks_unchecked</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(&self) ->&[<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; N]</a>]</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_as_chunks</code>)</span></div></span></summary><divclass="docblock"><p>Splits the slice into a slice of <code>N</code>-element arrays,
// let chunks: &[[_; 5]] = slice.as_chunks_unchecked() // The slice length is not a multiple of 5
// let chunks: &[[_; 0]] = slice.as_chunks_unchecked() // Zero-length chunks are never allowed</span></code></pre></div>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_chunks"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1008">source</a><h4class="code-header">pub fn <ahref="#method.as_chunks"class="fn">as_chunks</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(&self) -> (&[<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; N]</a>], &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_as_chunks</code>)</span></div></span></summary><divclass="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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_rchunks"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1039">source</a><h4class="code-header">pub fn <ahref="#method.as_rchunks"class="fn">as_rchunks</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(&self) -> (&<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &[<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; N]</a>])</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_as_chunks</code>)</span></div></span></summary><divclass="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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.array_chunks"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1078">source</a><h4class="code-header">pub fn <ahref="#method.array_chunks"class="fn">array_chunks</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(&self) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.ArrayChunks.html"title="struct core::slice::iter::ArrayChunks">ArrayChunks</a><'_, T, N></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>array_chunks</code>)</span></div></span></summary><divclass="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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.chunks_exact"><code>chunks_exact</code></a>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_chunks_unchecked_mut"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1115">source</a><h4class="code-header">pub unsafe fn <ahref="#method.as_chunks_unchecked_mut"class="fn">as_chunks_unchecked_mut</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(<br> &mut self<br>) ->&mut [<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; N]</a>]</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_as_chunks</code>)</span></div></span></summary><divclass="docblock"><p>Splits the slice into a slice of <code>N</code>-element arrays,
// let chunks: &[[_; 5]] = slice.as_chunks_unchecked_mut() // The slice length is not a multiple of 5
// let chunks: &[[_; 0]] = slice.as_chunks_unchecked_mut() // Zero-length chunks are never allowed</span></code></pre></div>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_chunks_mut"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1157">source</a><h4class="code-header">pub fn <ahref="#method.as_chunks_mut"class="fn">as_chunks_mut</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(&mut self) -> (&mut [<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; N]</a>], &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_as_chunks</code>)</span></div></span></summary><divclass="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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_rchunks_mut"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1194">source</a><h4class="code-header">pub fn <ahref="#method.as_rchunks_mut"class="fn">as_rchunks_mut</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(&mut self) -> (&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &mut [<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; N]</a>])</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_as_chunks</code>)</span></div></span></summary><divclass="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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.array_chunks_mut"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1235">source</a><h4class="code-header">pub fn <ahref="#method.array_chunks_mut"class="fn">array_chunks_mut</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(&mut self) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.ArrayChunksMut.html"title="struct core::slice::iter::ArrayChunksMut">ArrayChunksMut</a><'_, T, N></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>array_chunks</code>)</span></div></span></summary><divclass="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 mutable 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>into_remainder</code> function of the iterator.</p>
<p>This method is the const generic equivalent of <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.chunks_exact_mut"><code>chunks_exact_mut</code></a>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.array_windows"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1267">source</a><h4class="code-header">pub fn <ahref="#method.array_windows"class="fn">array_windows</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(&self) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.ArrayWindows.html"title="struct core::slice::iter::ArrayWindows">ArrayWindows</a><'_, T, N></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>array_windows</code>)</span></div></span></summary><divclass="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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.rchunks"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.31.0">1.31.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1301">source</a></span><h4class="code-header">pub fn <ahref="#method.rchunks"class="fn">rchunks</a>(&self, chunk_size: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.RChunks.html"title="struct core::slice::iter::RChunks">RChunks</a><'_, T></h4></section></summary><divclass="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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.chunks"><code>chunks</code></a> for the same iterator but starting at the beginning
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.rchunks_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.31.0">1.31.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1339">source</a></span><h4class="code-header">pub fn <ahref="#method.rchunks_mut"class="fn">rchunks_mut</a>(&mut self, chunk_size: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.RChunksMut.html"title="struct core::slice::iter::RChunksMut">RChunksMut</a><'_, T></h4></section></summary><divclass="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 mutable 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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.rchunks_exact_mut"><code>rchunks_exact_mut</code></a> for a variant of this iterator that returns chunks of always
exactly <code>chunk_size</code> elements, and <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.chunks_mut"><code>chunks_mut</code></a> for the same iterator but starting at the
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.rchunks_exact"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.31.0">1.31.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1378">source</a></span><h4class="code-header">pub fn <ahref="#method.rchunks_exact"class="fn">rchunks_exact</a>(&self, chunk_size: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.RChunksExact.html"title="struct core::slice::iter::RChunksExact">RChunksExact</a><'_, T></h4></section></summary><divclass="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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.rchunks"><code>rchunks</code></a>.</p>
<p>See <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.rchunks"><code>rchunks</code></a> for a variant of this iterator that also returns the remainder as a smaller
chunk, and <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.chunks_exact"><code>chunks_exact</code></a> for the same iterator but starting at the beginning of the
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.rchunks_exact_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.31.0">1.31.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1421">source</a></span><h4class="code-header">pub fn <ahref="#method.rchunks_exact_mut"class="fn">rchunks_exact_mut</a>(&mut self, chunk_size: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.RChunksExactMut.html"title="struct core::slice::iter::RChunksExactMut">RChunksExactMut</a><'_, T></h4></section></summary><divclass="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 mutable 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>into_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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.chunks_mut"><code>chunks_mut</code></a>.</p>
<p>See <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.rchunks_mut"><code>rchunks_mut</code></a> for a variant of this iterator that also returns the remainder as a
smaller chunk, and <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.chunks_exact_mut"><code>chunks_exact_mut</code></a> for the same iterator but starting at the beginning
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split_at"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1554">source</a></span><h4class="code-header">pub fn <ahref="#method.split_at"class="fn">split_at</a>(&self, mid: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>) -> (&<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)</h4></section></summary><divclass="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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split_at_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1587">source</a></span><h4class="code-header">pub fn <ahref="#method.split_at_mut"class="fn">split_at_mut</a>(&mut self, mid: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>) -> (&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)</h4></section></summary><divclass="docblock"><p>Divides one mutable 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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split_at_unchecked"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1640">source</a><h4class="code-header">pub unsafe fn <ahref="#method.split_at_unchecked"class="fn">split_at_unchecked</a>(&self, mid: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>) -> (&<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_split_at_unchecked</code>)</span></div></span></summary><divclass="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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.split_at"><code>split_at</code></a>.</p>
<p>Calling this method with an out-of-bounds index is <em><ahref="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
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split_at_mut_unchecked"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1689">source</a><h4class="code-header">pub unsafe fn <ahref="#method.split_at_mut_unchecked"class="fn">split_at_mut_unchecked</a>(<br> &mut self,<br> mid: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a><br>) -> (&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_split_at_unchecked</code>)</span></div></span></summary><divclass="docblock"><p>Divides one mutable 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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.split_at_mut"><code>split_at_mut</code></a>.</p>
<p>Calling this method with an out-of-bounds index is <em><ahref="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
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split_array_ref"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1745">source</a><h4class="code-header">pub fn <ahref="#method.split_array_ref"class="fn">split_array_ref</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(&self) -> (&<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; N]</a>, &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>split_array</code>)</span></div></span></summary><divclass="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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split_array_mut"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1778">source</a><h4class="code-header">pub fn <ahref="#method.split_array_mut"class="fn">split_array_mut</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(&mut self) -> (&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; N]</a>, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>split_array</code>)</span></div></span></summary><divclass="docblock"><p>Divides one mutable 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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.rsplit_array_ref"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1823">source</a><h4class="code-header">pub fn <ahref="#method.rsplit_array_ref"class="fn">rsplit_array_ref</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(&self) -> (&<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; N]</a>)</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>split_array</code>)</span></div></span></summary><divclass="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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.rsplit_array_mut"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1857">source</a><h4class="code-header">pub fn <ahref="#method.rsplit_array_mut"class="fn">rsplit_array_mut</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(&mut self) -> (&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; N]</a>)</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>split_array</code>)</span></div></span></summary><divclass="docblock"><p>Divides one mutable 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>N</code> itself) and the array will contain all
indices from <code>[len - N, len)</code> (excluding the index <code>len</code> itself).</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1906-1908">source</a></span><h4class="code-header">pub fn <ahref="#method.split"class="fn">split</a><F>(&self, pred: F) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.Split.html"title="struct core::slice::iter::Split">Split</a><'_, T, F><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a>,</span></h4></section></summary><divclass="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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1928-1930">source</a></span><h4class="code-header">pub fn <ahref="#method.split_mut"class="fn">split_mut</a><F>(&mut self, pred: F) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.SplitMut.html"title="struct core::slice::iter::SplitMut">SplitMut</a><'_, T, F><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a>,</span></h4></section></summary><divclass="docblock"><p>Returns an iterator over mutable subslices separated by elements that
match <code>pred</code>. The matched element is not contained in the subslices.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split_inclusive"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.51.0">1.51.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1964-1966">source</a></span><h4class="code-header">pub fn <ahref="#method.split_inclusive"class="fn">split_inclusive</a><F>(&self, pred: F) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.SplitInclusive.html"title="struct core::slice::iter::SplitInclusive">SplitInclusive</a><'_, T, F><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a>,</span></h4></section></summary><divclass="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
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split_inclusive_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.51.0">1.51.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#1988-1990">source</a></span><h4class="code-header">pub fn <ahref="#method.split_inclusive_mut"class="fn">split_inclusive_mut</a><F>(&mut self, pred: F) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.SplitInclusiveMut.html"title="struct core::slice::iter::SplitInclusiveMut">SplitInclusiveMut</a><'_, T, F><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a>,</span></h4></section></summary><divclass="docblock"><p>Returns an iterator over mutable subslices separated by elements that
match <code>pred</code>. The matched element is contained in the previous
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.rsplit"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.27.0">1.27.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2024-2026">source</a></span><h4class="code-header">pub fn <ahref="#method.rsplit"class="fn">rsplit</a><F>(&self, pred: F) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.RSplit.html"title="struct core::slice::iter::RSplit">RSplit</a><'_, T, F><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a>,</span></h4></section></summary><divclass="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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.rsplit_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.27.0">1.27.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2050-2052">source</a></span><h4class="code-header">pub fn <ahref="#method.rsplit_mut"class="fn">rsplit_mut</a><F>(&mut self, pred: F) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.RSplitMut.html"title="struct core::slice::iter::RSplitMut">RSplitMut</a><'_, T, F><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a>,</span></h4></section></summary><divclass="docblock"><p>Returns an iterator over mutable 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>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.splitn"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2078-2080">source</a></span><h4class="code-header">pub fn <ahref="#method.splitn"class="fn">splitn</a><F>(&self, n: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>, pred: F) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.SplitN.html"title="struct core::slice::iter::SplitN">SplitN</a><'_, T, F><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a>,</span></h4></section></summary><divclass="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
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.splitn_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2104-2106">source</a></span><h4class="code-header">pub fn <ahref="#method.splitn_mut"class="fn">splitn_mut</a><F>(&mut self, n: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>, pred: F) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.SplitNMut.html"title="struct core::slice::iter::SplitNMut">SplitNMut</a><'_, T, F><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a>,</span></h4></section></summary><divclass="docblock"><p>Returns an iterator over mutable 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
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.rsplitn"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2133-2135">source</a></span><h4class="code-header">pub fn <ahref="#method.rsplitn"class="fn">rsplitn</a><F>(&self, n: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>, pred: F) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.RSplitN.html"title="struct core::slice::iter::RSplitN">RSplitN</a><'_, T, F><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a>,</span></h4></section></summary><divclass="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
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.rsplitn_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2160-2162">source</a></span><h4class="code-header">pub fn <ahref="#method.rsplitn_mut"class="fn">rsplitn_mut</a><F>(&mut self, n: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>, pred: F) -><aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/iter/struct.RSplitNMut.html"title="struct core::slice::iter::RSplitNMut">RSplitNMut</a><'_, T, F><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a>,</span></h4></section></summary><divclass="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
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.contains"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2195-2197">source</a></span><h4class="code-header">pub fn <ahref="#method.contains"class="fn">contains</a>(&self, x: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a><spanclass="where fmt-newline">where<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialEq.html"title="trait core::cmp::PartialEq">PartialEq</a><T>,</span></h4></section></summary><divclass="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, <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.binary_search"><code>binary_search</code></a> may be faster.</p>
<p>If you do not have a <code>&T</code>, but some other value that you can compare
with one (for example, <code>String</code> implements <code>PartialEq<str></code>), you can
use <code>iter().any</code>:</p>
<divclass="example-wrap"><preclass="rust rust-example-rendered"><code><spanclass="kw">let </span>v = [String::from(<spanclass="string">"hello"</span>), String::from(<spanclass="string">"world"</span>)]; <spanclass="comment">// slice of `String`
</span><spanclass="macro">assert!</span>(v.iter().any(|e| e == <spanclass="string">"hello"</span>)); <spanclass="comment">// search with `&str`
</span><spanclass="macro">assert!</span>(!v.iter().any(|e| e == <spanclass="string">"hi"</span>));</code></pre></div>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.starts_with"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2224-2226">source</a></span><h4class="code-header">pub fn <ahref="#method.starts_with"class="fn">starts_with</a>(&self, needle: &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a><spanclass="where fmt-newline">where<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialEq.html"title="trait core::cmp::PartialEq">PartialEq</a><T>,</span></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if <code>needle</code> is a prefix of the slice.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.ends_with"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2254-2256">source</a></span><h4class="code-header">pub fn <ahref="#method.ends_with"class="fn">ends_with</a>(&self, needle: &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a><spanclass="where fmt-newline">where<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialEq.html"title="trait core::cmp::PartialEq">PartialEq</a><T>,</span></h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if <code>needle</code> is a suffix of the slice.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.binary_search"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2402-2404">source</a></span><h4class="code-header">pub fn <ahref="#method.binary_search"class="fn">binary_search</a>(&self, x: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>, <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>><spanclass="where fmt-newline">where<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.Ord.html"title="trait core::cmp::Ord">Ord</a>,</span></h4></section></summary><divclass="docblock"><p>Binary searches this slice for a given element.
This behaves similarly to <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.contains"><code>contains</code></a> if this slice is sorted.</p>
<p>If the value is found then <ahref="https://doc.rust-lang.org/1.67.0/core/result/enum.Result.html#variant.Ok"title="Result::Ok"><code>Result::Ok</code></a> is returned, containing the
index of the matching element. If there are multiple matches, then any
one of the matches could be returned. The index is chosen
deterministically, but is subject to change in future versions of Rust.
If the value is not found then <ahref="https://doc.rust-lang.org/1.67.0/core/result/enum.Result.html#variant.Err"title="Result::Err"><code>Result::Err</code></a> is returned, containing
the index where a matching element could be inserted while maintaining
sorted order.</p>
<p>See also <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.binary_search_by"><code>binary_search_by</code></a>, <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.binary_search_by_key"><code>binary_search_by_key</code></a>, and <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.partition_point"><code>partition_point</code></a>.</p>
<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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.partition_point"><code>partition_point</code></a>:</p>
<spanclass="macro">assert!</span>(s[..low].iter().all(|<spanclass="kw-2">&</span>x| x <<spanclass="number">1</span>));
<spanclass="macro">assert!</span>(s[low..high].iter().all(|<spanclass="kw-2">&</span>x| x == <spanclass="number">1</span>));
<spanclass="macro">assert!</span>(s[high..].iter().all(|<spanclass="kw-2">&</span>x| x ><spanclass="number">1</span>));
<spanclass="comment">// For something not found, the "range" of equal items is empty
</span><spanclass="macro">assert_eq!</span>(s.partition_point(|x| x <<spanclass="kw-2">&</span><spanclass="number">11</span>), <spanclass="number">9</span>);
<spanclass="macro">assert_eq!</span>(s.partition_point(|x| x <= <spanclass="kw-2">&</span><spanclass="number">11</span>), <spanclass="number">9</span>);
<p>If you want to insert an item to a sorted vector, while maintaining
sort order, consider using <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.partition_point"><code>partition_point</code></a>:</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.binary_search_by"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2453-2455">source</a></span><h4class="code-header">pub fn <ahref="#method.binary_search_by"class="fn">binary_search_by</a><'a, F>(&'a self, f: F) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>, <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&'a </a>T) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/cmp/enum.Ordering.html"title="enum core::cmp::Ordering">Ordering</a>,</span></h4></section></summary><divclass="docblock"><p>Binary searches this slice with a comparator function.
This behaves similarly to <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.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 <ahref="https://doc.rust-lang.org/1.67.0/core/result/enum.Result.html#variant.Ok"title="Result::Ok"><code>Result::Ok</code></a> is returned, containing the
index of the matching element. If there are multiple matches, then any
one of the matches could be returned. The index is chosen
deterministically, but is subject to change in future versions of Rust.
If the value is not found then <ahref="https://doc.rust-lang.org/1.67.0/core/result/enum.Result.html#variant.Err"title="Result::Err"><code>Result::Err</code></a> is returned, containing
the index where a matching element could be inserted while maintaining
sorted order.</p>
<p>See also <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.binary_search"><code>binary_search</code></a>, <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.binary_search_by_key"><code>binary_search_by_key</code></a>, and <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.partition_point"><code>partition_point</code></a>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.binary_search_by_key"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.10.0">1.10.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2542-2545">source</a></span><h4class="code-header">pub fn <ahref="#method.binary_search_by_key"class="fn">binary_search_by_key</a><'a, B, F>(<br> &'a self,<br> b: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>B,<br> f: F<br>) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>, <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&'a </a>T) -> B,<br> B: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.Ord.html"title="trait core::cmp::Ord">Ord</a>,</span></h4></section></summary><divclass="docblock"><p>Binary searches this slice with a key extraction function.
This behaves similarly to <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.contains"><code>contains</code></a> if this slice is sorted.</p>
<p>Assumes that the slice is sorted by the key, for instance with
<ahref="slice::sort_by_key"><code>sort_by_key</code></a> using the same key extraction function.</p>
<p>If the value is found then <ahref="https://doc.rust-lang.org/1.67.0/core/result/enum.Result.html#variant.Ok"title="Result::Ok"><code>Result::Ok</code></a> is returned, containing the
index of the matching element. If there are multiple matches, then any
one of the matches could be returned. The index is chosen
deterministically, but is subject to change in future versions of Rust.
If the value is not found then <ahref="https://doc.rust-lang.org/1.67.0/core/result/enum.Result.html#variant.Err"title="Result::Err"><code>Result::Err</code></a> is returned, containing
the index where a matching element could be inserted while maintaining
sorted order.</p>
<p>See also <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.binary_search"><code>binary_search</code></a>, <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.binary_search_by"><code>binary_search_by</code></a>, and <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.partition_point"><code>partition_point</code></a>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.sort_unstable"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.20.0">1.20.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2578-2580">source</a></span><h4class="code-header">pub fn <ahref="#method.sort_unstable"class="fn">sort_unstable</a>(&mut self)<spanclass="where fmt-newline">where<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.Ord.html"title="trait core::cmp::Ord">Ord</a>,</span></h4></section></summary><divclass="docblock"><p>Sorts the slice, but might not preserve the order of equal elements.</p>
<p>This sort is unstable (i.e., may reorder equal elements), in-place
(i.e., does not allocate), and <em>O</em>(<em>n</em> * log(<em>n</em>)) worst-case.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.sort_unstable_by"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.20.0">1.20.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2633-2635">source</a></span><h4class="code-header">pub fn <ahref="#method.sort_unstable_by"class="fn">sort_unstable_by</a><F>(&mut self, compare: F)<spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T, <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/cmp/enum.Ordering.html"title="enum core::cmp::Ordering">Ordering</a>,</span></h4></section></summary><divclass="docblock"><p>Sorts the slice with a comparator function, but might not preserve the order of equal
elements.</p>
<p>This sort is unstable (i.e., may reorder equal elements), in-place
(i.e., does not allocate), and <em>O</em>(<em>n</em> * log(<em>n</em>)) worst-case.</p>
<p>The comparator function must define a total ordering for the elements in the slice. If
the ordering is not total, the order of the elements is unspecified. An order is a
total order if it is (for all <code>a</code>, <code>b</code> and <code>c</code>):</p>
<ul>
<li>total and antisymmetric: exactly one of <code>a < b</code>, <code>a == b</code> or <code>a > b</code> is true, and</li>
<li>transitive, <code>a < b</code> and <code>b < c</code> implies <code>a < c</code>. The same must hold for both <code>==</code> and <code>></code>.</li>
</ul>
<p>For example, while <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.f64.html"title="f64"><code>f64</code></a> doesn’t implement <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.Ord.html"title="Ord"><code>Ord</code></a> because <code>NaN != NaN</code>, we can use
<code>partial_cmp</code> as our sort function when we know the slice doesn’t contain a <code>NaN</code>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.sort_unstable_by_key"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.20.0">1.20.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2671-2674">source</a></span><h4class="code-header">pub fn <ahref="#method.sort_unstable_by_key"class="fn">sort_unstable_by_key</a><K, F>(&mut self, f: F)<spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -> K,<br> K: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.Ord.html"title="trait core::cmp::Ord">Ord</a>,</span></h4></section></summary><divclass="docblock"><p>Sorts the slice with a key extraction function, but might not preserve the order of equal
elements.</p>
<p>This sort is unstable (i.e., may reorder equal elements), in-place
(i.e., does not allocate), and <em>O</em>(m * <em>n</em> * log(<em>n</em>)) worst-case, where the key function is
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.select_nth_unstable"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.49.0">1.49.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2718-2720">source</a></span><h4class="code-header">pub fn <ahref="#method.select_nth_unstable"class="fn">select_nth_unstable</a>(<br> &mut self,<br> index: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a><br>) -> (&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&mut </a>T, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)<spanclass="where fmt-newline">where<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.Ord.html"title="trait core::cmp::Ord">Ord</a>,</span></h4></section></summary><divclass="docblock"><p>Reorder the slice such that the element at <code>index</code> is at its final sorted position.</p>
<p>This reordering has the additional property that any value at position <code>i < index</code> will be
less than or equal to any value at a position <code>j > index</code>. Additionally, this reordering is
unstable (i.e. any number of equal elements may end up at position <code>index</code>), in-place
(i.e. does not allocate), and <em>O</em>(<em>n</em>) worst-case. This function is also/ known as “kth
element” in other libraries. It returns a triplet of the following from the reordered slice:
the subslice prior to <code>index</code>, the element at <code>index</code>, and the subslice after <code>index</code>;
accordingly, the values in those two subslices will respectively all be less-than-or-equal-to
and greater-than-or-equal-to the value of the element at <code>index</code>.</p>
v == [-<spanclass="number">5</span>, -<spanclass="number">3</span>, <spanclass="number">1</span>, <spanclass="number">2</span>, <spanclass="number">4</span>] ||
v == [-<spanclass="number">3</span>, -<spanclass="number">5</span>, <spanclass="number">1</span>, <spanclass="number">4</span>, <spanclass="number">2</span>] ||
v == [-<spanclass="number">5</span>, -<spanclass="number">3</span>, <spanclass="number">1</span>, <spanclass="number">4</span>, <spanclass="number">2</span>]);</code></pre></div>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.select_nth_unstable_by"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.49.0">1.49.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2766-2772">source</a></span><h4class="code-header">pub fn <ahref="#method.select_nth_unstable_by"class="fn">select_nth_unstable_by</a><F>(<br> &mut self,<br> index: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>,<br> compare: F<br>) -> (&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&mut </a>T, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)<spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T, <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/cmp/enum.Ordering.html"title="enum core::cmp::Ordering">Ordering</a>,</span></h4></section></summary><divclass="docblock"><p>Reorder the slice with a comparator function such that the element at <code>index</code> is at its
final sorted position.</p>
<p>This reordering has the additional property that any value at position <code>i < index</code> will be
less than or equal to any value at a position <code>j > index</code> using the comparator function.
Additionally, this reordering is unstable (i.e. any number of equal elements may end up at
position <code>index</code>), in-place (i.e. does not allocate), and <em>O</em>(<em>n</em>) worst-case. This function
is also known as “kth element” in other libraries. It returns a triplet of the following from
the slice reordered according to the provided comparator function: the subslice prior to
<code>index</code>, the element at <code>index</code>, and the subslice after <code>index</code>; accordingly, the values in
those two subslices will respectively all be less-than-or-equal-to and greater-than-or-equal-to
the value of the element at <code>index</code>.</p>
v == [<spanclass="number">2</span>, <spanclass="number">4</span>, <spanclass="number">1</span>, -<spanclass="number">3</span>, -<spanclass="number">5</span>] ||
v == [<spanclass="number">4</span>, <spanclass="number">2</span>, <spanclass="number">1</span>, -<spanclass="number">5</span>, -<spanclass="number">3</span>] ||
v == [<spanclass="number">4</span>, <spanclass="number">2</span>, <spanclass="number">1</span>, -<spanclass="number">3</span>, -<spanclass="number">5</span>]);</code></pre></div>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.select_nth_unstable_by_key"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.49.0">1.49.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2818-2825">source</a></span><h4class="code-header">pub fn <ahref="#method.select_nth_unstable_by_key"class="fn">select_nth_unstable_by_key</a><K, F>(<br> &mut self,<br> index: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>,<br> f: F<br>) -> (&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&mut </a>T, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)<spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -> K,<br> K: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.Ord.html"title="trait core::cmp::Ord">Ord</a>,</span></h4></section></summary><divclass="docblock"><p>Reorder the slice with a key extraction function such that the element at <code>index</code> is at its
final sorted position.</p>
<p>This reordering has the additional property that any value at position <code>i < index</code> will be
less than or equal to any value at a position <code>j > index</code> using the key extraction function.
Additionally, this reordering is unstable (i.e. any number of equal elements may end up at
position <code>index</code>), in-place (i.e. does not allocate), and <em>O</em>(<em>n</em>) worst-case. This function
is also known as “kth element” in other libraries. It returns a triplet of the following from
the slice reordered according to the provided key extraction function: the subslice prior to
<code>index</code>, the element at <code>index</code>, and the subslice after <code>index</code>; accordingly, the values in
those two subslices will respectively all be less-than-or-equal-to and greater-than-or-equal-to
the value of the element at <code>index</code>.</p>
v == [<spanclass="number">1</span>, <spanclass="number">2</span>, -<spanclass="number">3</span>, -<spanclass="number">5</span>, <spanclass="number">4</span>] ||
v == [<spanclass="number">2</span>, <spanclass="number">1</span>, -<spanclass="number">3</span>, <spanclass="number">4</span>, -<spanclass="number">5</span>] ||
v == [<spanclass="number">2</span>, <spanclass="number">1</span>, -<spanclass="number">3</span>, -<spanclass="number">5</span>, <spanclass="number">4</span>]);</code></pre></div>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.partition_dedup"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2852-2854">source</a><h4class="code-header">pub fn <ahref="#method.partition_dedup"class="fn">partition_dedup</a>(&mut self) -> (&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)<spanclass="where fmt-newline">where<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialEq.html"title="trait core::cmp::PartialEq">PartialEq</a><T>,</span></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_partition_dedup</code>)</span></div></span></summary><divclass="docblock"><p>Moves all consecutive repeated elements to the end of the slice according to the
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.partition_dedup_by"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#2886-2888">source</a><h4class="code-header">pub fn <ahref="#method.partition_dedup_by"class="fn">partition_dedup_by</a><F>(&mut self, same_bucket: F) -> (&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)<spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&mut </a>T, <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&mut </a>T) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a>,</span></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_partition_dedup</code>)</span></div></span></summary><divclass="docblock"><p>Moves all but the first of consecutive elements to the end of the slice satisfying
a given equality relation.</p>
<p>Returns two slices. The first contains no consecutive repeated elements.
The second contains all the duplicates in no specified order.</p>
<p>The <code>same_bucket</code> function is passed references to two elements from the slice and
must determine if the elements compare equal. The elements are passed in opposite order
from their order in the slice, so if <code>same_bucket(a, b)</code> returns <code>true</code>, <code>a</code> is moved
at the end of the slice.</p>
<p>If the slice is sorted, the first returned slice contains no duplicates.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.partition_dedup_by_key"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3012-3015">source</a><h4class="code-header">pub fn <ahref="#method.partition_dedup_by_key"class="fn">partition_dedup_by_key</a><K, F>(&mut self, key: F) -> (&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)<spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&mut </a>T) -> K,<br> K: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialEq.html"title="trait core::cmp::PartialEq">PartialEq</a><K>,</span></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_partition_dedup</code>)</span></div></span></summary><divclass="docblock"><p>Moves all but the first of consecutive elements to the end of the slice that resolve
to the same key.</p>
<p>Returns two slices. The first contains no consecutive repeated elements.
The second contains all the duplicates in no specified order.</p>
<p>If the slice is sorted, the first returned slice contains no duplicates.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.rotate_left"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.26.0">1.26.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3051">source</a></span><h4class="code-header">pub fn <ahref="#method.rotate_left"class="fn">rotate_left</a>(&mut self, mid: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>)</h4></section></summary><divclass="docblock"><p>Rotates the slice in-place such that the first <code>mid</code> elements of the
slice move to the end while the last <code>self.len() - mid</code> elements move to
the front. After calling <code>rotate_left</code>, the element previously at index
<code>mid</code> will become the first element in the slice.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.rotate_right"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.26.0">1.26.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3094">source</a></span><h4class="code-header">pub fn <ahref="#method.rotate_right"class="fn">rotate_right</a>(&mut self, k: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>)</h4></section></summary><divclass="docblock"><p>Rotates the slice in-place such that the first <code>self.len() - k</code>
elements of the slice move to the end while the last <code>k</code> elements move
to the front. After calling <code>rotate_right</code>, the element previously at
index <code>self.len() - k</code> will become the first element in the slice.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.fill"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.50.0">1.50.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3117-3119">source</a></span><h4class="code-header">pub fn <ahref="#method.fill"class="fn">fill</a>(&mut self, value: T)<spanclass="where fmt-newline">where<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a>,</span></h4></section></summary><divclass="docblock"><p>Fills <code>self</code> with elements by cloning <code>value</code>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.fill_with"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.51.0">1.51.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3141-3143">source</a></span><h4class="code-header">pub fn <ahref="#method.fill_with"class="fn">fill_with</a><F>(&mut self, f: F)<spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>() -> T,</span></h4></section></summary><divclass="docblock"><p>Fills <code>self</code> with elements returned by calling a closure repeatedly.</p>
<p>This method uses a closure to create new values. If you’d rather
<ahref="https://doc.rust-lang.org/1.67.0/core/clone/trait.Clone.html"title="Clone"><code>Clone</code></a> a given value, use <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.fill"><code>fill</code></a>. If you want to use the <ahref="https://doc.rust-lang.org/1.67.0/core/default/trait.Default.html"title="Default"><code>Default</code></a>
trait to generate values, you can pass <ahref="https://doc.rust-lang.org/1.67.0/core/default/trait.Default.html#tymethod.default"title="Default::default"><code>Default::default</code></a> as the
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.clone_from_slice-1"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.7.0">1.7.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3204-3206">source</a></span><h4class="code-header">pub fn <ahref="#method.clone_from_slice-1"class="fn">clone_from_slice</a>(&mut self, src: &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)<spanclass="where fmt-newline">where<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a>,</span></h4></section></summary><divclass="docblock"><p>Copies the elements from <code>src</code> into <code>self</code>.</p>
<p>The length of <code>src</code> must be the same as <code>self</code>.</p>
<p>To work around this, we can use <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.split_at_mut"><code>split_at_mut</code></a> to create two distinct
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.copy_from_slice"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.9.0">1.9.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3268-3270">source</a></span><h4class="code-header">pub fn <ahref="#method.copy_from_slice"class="fn">copy_from_slice</a>(&mut self, src: &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)<spanclass="where fmt-newline">where<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/marker/trait.Copy.html"title="trait core::marker::Copy">Copy</a>,</span></h4></section></summary><divclass="docblock"><p>Copies all elements from <code>src</code> into <code>self</code>, using a memcpy.</p>
<p>The length of <code>src</code> must be the same as <code>self</code>.</p>
<p>If <code>T</code> does not implement <code>Copy</code>, use <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.clone_from_slice"><code>clone_from_slice</code></a>.</p>
<p>To work around this, we can use <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.split_at_mut"><code>split_at_mut</code></a> to create two distinct
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.copy_within"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.37.0">1.37.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3322-3324">source</a></span><h4class="code-header">pub fn <ahref="#method.copy_within"class="fn">copy_within</a><R>(&mut self, src: R, dest: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>)<spanclass="where fmt-newline">where<br> R: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/range/trait.RangeBounds.html"title="trait core::ops::range::RangeBounds">RangeBounds</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>,<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/marker/trait.Copy.html"title="trait core::marker::Copy">Copy</a>,</span></h4></section></summary><divclass="docblock"><p>Copies elements from one part of the slice to another part of itself,
using a memmove.</p>
<p><code>src</code> is the range within <code>self</code> to copy from. <code>dest</code> is the starting
index of the range within <code>self</code> to copy to, which will have the same
length as <code>src</code>. The two ranges may overlap. The ends of the two ranges
must be less than or equal to <code>self.len()</code>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.swap_with_slice"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.27.0">1.27.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3389">source</a></span><h4class="code-header">pub fn <ahref="#method.swap_with_slice"class="fn">swap_with_slice</a>(&mut self, other: &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)</h4></section></summary><divclass="docblock"><p>Swaps all elements in <code>self</code> with those in <code>other</code>.</p>
<p>The length of <code>other</code> must be the same as <code>self</code>.</p>
<p>To work around this, we can use <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.split_at_mut"><code>split_at_mut</code></a> to create two distinct
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.align_to"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.30.0">1.30.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3500">source</a></span><h4class="code-header">pub unsafe fn <ahref="#method.align_to"class="fn">align_to</a><U>(&self) -> (&<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[U]</a>, &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)</h4></section></summary><divclass="docblock"><p>Transmute the slice to a slice of another type, ensuring alignment of the types is
maintained.</p>
<p>This method splits the slice into three distinct slices: prefix, correctly aligned middle
slice of a new type, and the suffix slice. How exactly the slice is split up is not
specified; the middle part may be smaller than necessary. However, if this fails to return a
maximal middle part, that is because code is running in a context where performance does not
matter, such as a sanitizer attempting to find alignment bugs. Regular code running
in a default (debug or release) execution <em>will</em> return a maximal middle part.</p>
<p>This method has no purpose when either input element <code>T</code> or output element <code>U</code> are
zero-sized and will return the original slice without splitting anything.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.align_to_mut"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.30.0">1.30.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3562">source</a></span><h4class="code-header">pub unsafe fn <ahref="#method.align_to_mut"class="fn">align_to_mut</a><U>(&mut self) -> (&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[U]</a>, &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)</h4></section></summary><divclass="docblock"><p>Transmute the mutable slice to a mutable slice of another type, ensuring alignment of the
types is maintained.</p>
<p>This method splits the slice into three distinct slices: prefix, correctly aligned middle
slice of a new type, and the suffix slice. How exactly the slice is split up is not
specified; the middle part may be smaller than necessary. However, if this fails to return a
maximal middle part, that is because code is running in a context where performance does not
matter, such as a sanitizer attempting to find alignment bugs. Regular code running
in a default (debug or release) execution <em>will</em> return a maximal middle part.</p>
<p>This method has no purpose when either input element <code>T</code> or output element <code>U</code> are
zero-sized and will return the original slice without splitting anything.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_simd"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3657-3661">source</a><h4class="code-header">pub fn <ahref="#method.as_simd"class="fn">as_simd</a><const LANES: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(&self) -> (&<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &[<aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/core_simd/vector/struct.Simd.html"title="struct core::core_simd::vector::Simd">Simd</a><T, LANES>], &<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)<spanclass="where fmt-newline">where<br> <aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/core_simd/vector/struct.Simd.html"title="struct core::core_simd::vector::Simd">Simd</a><T, LANES>: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/convert/trait.AsRef.html"title="trait core::convert::AsRef">AsRef</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; LANES]</a>>,<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/core_simd/vector/trait.SimdElement.html"title="trait core::core_simd::vector::SimdElement">SimdElement</a>,<br> <aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/core_simd/lane_count/struct.LaneCount.html"title="struct core::core_simd::lane_count::LaneCount">LaneCount</a><LANES>: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/core_simd/lane_count/trait.SupportedLaneCount.html"title="trait core::core_simd::lane_count::SupportedLaneCount">SupportedLaneCount</a>,</span></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>portable_simd</code>)</span></div></span></summary><divclass="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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.align_to"title="slice::align_to"><code>slice::align_to</code></a>, so has the same weak
postconditions as that method. You’re only assured that
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_simd_mut"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3702-3706">source</a><h4class="code-header">pub fn <ahref="#method.as_simd_mut"class="fn">as_simd_mut</a><const LANES: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(<br> &mut self<br>) -> (&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, &mut [<aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/core_simd/vector/struct.Simd.html"title="struct core::core_simd::vector::Simd">Simd</a><T, LANES>], &mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>)<spanclass="where fmt-newline">where<br> <aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/core_simd/vector/struct.Simd.html"title="struct core::core_simd::vector::Simd">Simd</a><T, LANES>: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/convert/trait.AsMut.html"title="trait core::convert::AsMut">AsMut</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; LANES]</a>>,<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/core_simd/vector/trait.SimdElement.html"title="trait core::core_simd::vector::SimdElement">SimdElement</a>,<br> <aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/core_simd/lane_count/struct.LaneCount.html"title="struct core::core_simd::lane_count::LaneCount">LaneCount</a><LANES>: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/core_simd/lane_count/trait.SupportedLaneCount.html"title="trait core::core_simd::lane_count::SupportedLaneCount">SupportedLaneCount</a>,</span></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>portable_simd</code>)</span></div></span></summary><divclass="docblock"><p>Split a mutable slice into a mutable prefix, a middle of aligned SIMD types,
and a mutable suffix.</p>
<p>This is a safe wrapper around <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.align_to_mut"title="slice::align_to_mut"><code>slice::align_to_mut</code></a>, so has the same weak
postconditions as that method. You’re only assured that
<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>
<p>This is the mutable version of <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.as_simd"title="slice::as_simd"><code>slice::as_simd</code></a>; see that for examples.</p>
<p>This will panic if the size of the SIMD type is different from
<code>LANES</code> times that of the scalar.</p>
<p>At the time of writing, the trait restrictions on <code>Simd<T, LANES></code> keeps
that from ever happening, as only power-of-two numbers of lanes are
supported. It’s possible that, in the future, those restrictions might
be lifted in a way that would make it possible to see panics from this
method for something like <code>LANES == 3</code>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.is_sorted"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3742-3744">source</a><h4class="code-header">pub fn <ahref="#method.is_sorted"class="fn">is_sorted</a>(&self) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a><spanclass="where fmt-newline">where<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html"title="trait core::cmp::PartialOrd">PartialOrd</a><T>,</span></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>is_sorted</code>)</span></div></span></summary><divclass="docblock"><p>Checks if the elements of this slice are sorted.</p>
<p>That is, for each element <code>a</code> and its following element <code>b</code>, <code>a <= b</code> must hold. If the
slice yields exactly zero or one element, <code>true</code> is returned.</p>
<p>Note that if <code>Self::Item</code> is only <code>PartialOrd</code>, but not <code>Ord</code>, the above definition
implies that this function returns <code>false</code> if any two consecutive items are not
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.is_sorted_by"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3758-3760">source</a><h4class="code-header">pub fn <ahref="#method.is_sorted_by"class="fn">is_sorted_by</a><'a, F>(&'a self, compare: F) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&'a </a>T, <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&'a </a>T) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/cmp/enum.Ordering.html"title="enum core::cmp::Ordering">Ordering</a>>,</span></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>is_sorted</code>)</span></div></span></summary><divclass="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
<ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.is_sorted"><code>is_sorted</code></a>; see its documentation for more information.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.is_sorted_by_key"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3784-3787">source</a><h4class="code-header">pub fn <ahref="#method.is_sorted_by_key"class="fn">is_sorted_by_key</a><'a, F, K>(&'a self, f: F) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&'a </a>T) -> K,<br> K: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html"title="trait core::cmp::PartialOrd">PartialOrd</a><K>,</span></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>is_sorted</code>)</span></div></span></summary><divclass="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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.is_sorted"><code>is_sorted</code></a>; see its
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.partition_point"class="method has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.52.0">1.52.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3843-3845">source</a></span><h4class="code-header">pub fn <ahref="#method.partition_point"class="fn">partition_point</a><P>(&self, pred: P) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a><spanclass="where fmt-newline">where<br> P: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>T) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a>,</span></h4></section></summary><divclass="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 <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.binary_search"><code>binary_search</code></a>, <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.binary_search_by"><code>binary_search_by</code></a>, and <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.binary_search_by_key"><code>binary_search_by_key</code></a>.</p>
<spanclass="macro">assert_eq!</span>(a.partition_point(|x| x <<spanclass="kw-2">&</span><spanclass="number">100</span>), <spanclass="number">0</span>);</code></pre></div>
<p>If you want to insert an item to a sorted vector, while maintaining
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.take"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3901">source</a><h4class="code-header">pub fn <ahref="#method.take"class="fn">take</a><R, 'a>(self: &mut &'a <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, range: R) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><&'a <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>><spanclass="where fmt-newline">where<br> R: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/range/trait.OneSidedRange.html"title="trait core::ops::range::OneSidedRange">OneSidedRange</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>,</span></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_take</code>)</span></div></span></summary><divclass="docblock"><p>Removes the subslice corresponding to the given range
and returns a reference to it.</p>
<p>Returns <code>None</code> and does not modify the slice if the given
range is out of bounds.</p>
<p>Note that this method only accepts one-sided ranges such as
<code>2..</code> or <code>..6</code>, but not <code>2..6</code>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.take_mut"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#3970-3973">source</a><h4class="code-header">pub fn <ahref="#method.take_mut"class="fn">take_mut</a><R, 'a>(self: &mut &'a mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>, range: R) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><&'a mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>><spanclass="where fmt-newline">where<br> R: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/range/trait.OneSidedRange.html"title="trait core::ops::range::OneSidedRange">OneSidedRange</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>,</span></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_take</code>)</span></div></span></summary><divclass="docblock"><p>Removes the subslice corresponding to the given range
and returns a mutable reference to it.</p>
<p>Returns <code>None</code> and does not modify the slice if the given
range is out of bounds.</p>
<p>Note that this method only accepts one-sided ranges such as
<code>2..</code> or <code>..6</code>, but not <code>2..6</code>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.take_first"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#4009">source</a><h4class="code-header">pub fn <ahref="#method.take_first"class="fn">take_first</a><'a>(self: &mut &'a <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&'a </a>T></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_take</code>)</span></div></span></summary><divclass="docblock"><p>Removes the first element of the slice and returns a reference
to it.</p>
<p>Returns <code>None</code> if the slice is empty.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.take_first_mut"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#4034">source</a><h4class="code-header">pub fn <ahref="#method.take_first_mut"class="fn">take_first_mut</a><'a>(self: &mut &'a mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&'a mut </a>T></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_take</code>)</span></div></span></summary><divclass="docblock"><p>Removes the first element of the slice and returns a mutable
reference to it.</p>
<p>Returns <code>None</code> if the slice is empty.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.take_last"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#4058">source</a><h4class="code-header">pub fn <ahref="#method.take_last"class="fn">take_last</a><'a>(self: &mut &'a <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&'a </a>T></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_take</code>)</span></div></span></summary><divclass="docblock"><p>Removes the last element of the slice and returns a reference
to it.</p>
<p>Returns <code>None</code> if the slice is empty.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.take_last_mut"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#4083">source</a><h4class="code-header">pub fn <ahref="#method.take_last_mut"class="fn">take_last_mut</a><'a>(self: &mut &'a mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a>) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&'a mut </a>T></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_take</code>)</span></div></span></summary><divclass="docblock"><p>Removes the last element of the slice and returns a mutable
reference to it.</p>
<p>Returns <code>None</code> if the slice is empty.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.get_many_unchecked_mut"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#4117-4120">source</a><h4class="code-header">pub unsafe fn <ahref="#method.get_many_unchecked_mut"class="fn">get_many_unchecked_mut</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(<br> &mut self,<br> indices: [<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>; <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">N</a>]<br>) -> [<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&mut </a>T; <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">N</a>]</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>get_many_mut</code>)</span></div></span></summary><divclass="docblock"><p>Returns mutable references to many indices at once, without doing any checks.</p>
<p>For a safe alternative see <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.get_many_mut"><code>get_many_mut</code></a>.</p>
<p>Calling this method with overlapping or out-of-bounds indices is <em><ahref="https://doc.rust-lang.org/reference/behavior-considered-undefined.html">undefined behavior</a></em>
even if the resulting references are not used.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.get_many_mut"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#4159-4162">source</a><h4class="code-header">pub fn <ahref="#method.get_many_mut"class="fn">get_many_mut</a><const N: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>>(<br> &mut self,<br> indices: [<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>; <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">N</a>]<br>) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><[<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&mut </a>T; <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">N</a>], <aclass="struct"href="https://doc.rust-lang.org/1.67.0/core/slice/struct.GetManyMutError.html"title="struct core::slice::GetManyMutError">GetManyMutError</a><N>></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>get_many_mut</code>)</span></div></span></summary><divclass="docblock"><p>Returns mutable references to many indices at once.</p>
<p>Returns an error if any index is out-of-bounds, or if the same index was
</div></details></div><divclass="impl-items"><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.sort_floats-1"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#4277">source</a><h4class="code-header">pub fn <ahref="#method.sort_floats-1"class="fn">sort_floats</a>(&mut self)</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>sort_floats</code>)</span></div></span></summary><divclass="docblock"><p>Sorts the slice of floats.</p>
<p>This sort is in-place (i.e. does not allocate), <em>O</em>(<em>n</em> * log(<em>n</em>)) worst-case, and uses
the ordering defined by <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.f32.html#method.total_cmp"title="f32::total_cmp"><code>f32::total_cmp</code></a>.</p>
<p>This uses the same sorting algorithm as <ahref="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html#method.sort_unstable_by"><code>sort_unstable_by</code></a>.</p>
</div></details></div><divclass="impl-items"><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.flatten"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#4202">source</a><h4class="code-header">pub fn <ahref="#method.flatten"class="fn">flatten</a>(&self) ->&<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_flatten</code>)</span></div></span></summary><divclass="docblock"><p>Takes a <code>&[[T; N]]</code>, and flattens it to a <code>&[T]</code>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.flatten_mut"class="method has-srclink"><aclass="srclink rightside"href="https://doc.rust-lang.org/1.67.0/src/core/slice/mod.rs.html#4240">source</a><h4class="code-header">pub fn <ahref="#method.flatten_mut"class="fn">flatten_mut</a>(&mut self) ->&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.slice.html">[T]</a></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_flatten</code>)</span></div></span></summary><divclass="docblock"><p>Takes a <code>&mut [[T; N]]</code>, and flattens it to a <code>&mut [T]</code>.</p>
</div></details></div></div><h2id="trait-implementations"class="small-section-header">Trait Implementations<ahref="#trait-implementations"class="anchor">§</a></h2><divid="trait-implementations-list"><detailsclass="rustdoc-toggle implementors-toggle"open><summary><sectionid="impl-AsMut%3C%5BT%3B%201%5D%3E-for-GenericArray%3CT%2C%20U1%3E"class="impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/impls.rs.html#183-216">source</a><ahref="#impl-AsMut%3C%5BT%3B%201%5D%3E-for-GenericArray%3CT%2C%20U1%3E"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/convert/trait.AsMut.html"title="trait core::convert::AsMut">AsMut</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; 1]</a>> for <aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, <aclass="type"href="../typenum/generated/consts/type.U1.html"title="type typenum::generated::consts::U1">U1</a>></h3></section></summary><divclass="impl-items"><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_mut-1"class="method trait-impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/impls.rs.html#183-216">source</a><ahref="#method.as_mut-1"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.67.0/core/convert/trait.AsMut.html#tymethod.as_mut"class="fn">as_mut</a>(&mut self) ->&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; 1]</a></h4></section></summary><divclass='docblock'>Converts this type into a mutable reference of the (usually inferred) input type.</div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><sectionid="impl-AsMut%3C%5BT%3B%2010%5D%3E-for-GenericArray%3CT%2C%20U10%3E"class="impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/impls.rs.html#183-216">source</a><ahref="#impl-AsMut%3C%5BT%3B%2010%5D%3E-for-GenericArray%3CT%2C%20U10%3E"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/convert/trait.AsMut.html"title="trait core::convert::AsMut">AsMut</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; 10]</a>> for <aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, <aclass="type"href="../typenum/generated/consts/type.U10.html"title="type typenum::generated::consts::U10">U10</a>></h3></section></summary><divclass="impl-items"><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.as_mut-10"class="method trait-impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/impls.rs.html#183-216">source</a><ahref="#method.as_mut-10"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.67.0/core/convert/trait.AsMut.html#tymethod.as_mut"class="fn">as_mut</a>(&mut self) ->&mut <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; 10]</a></h4></section></summary><divclass='docblock'>Converts this type into a mutable reference of the (usually inferred) input type.</div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><sectionid="impl-AsMut%3C%5BT%3B%2011%5D%3E-for-GenericArray%3CT%2C%20U11%3E"class="impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/impls.rs.html#183-216">source</a><ahref="#impl-AsMut%3C%5BT%3B%2011%5D%3E-for-GenericArray%3CT%2C%20U11%3E"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/convert/trait.AsMut.html"title="trait core::convert::AsMut">AsMut</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; 11]</a>> for <aclass="struct"href="struct.Gene
</div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><sectionid="impl-From%3C%5BT%3B%201%5D%3E-for-GenericArray%3CT%2C%20U1%3E"class="impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/impls.rs.html#183-216">source</a><ahref="#impl-From%3C%5BT%3B%201%5D%3E-for-GenericArray%3CT%2C%20U1%3E"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/convert/trait.From.html"title="trait core::convert::From">From</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; 1]</a>> for <aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, <aclass="type"href="../typenum/generated/consts/type.U1.html"title="type typenum::generated::consts::U1">U1</a>></h3></section></summary><divclass="impl-items"><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.from"class="method trait-impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/impls.rs.html#183-216">source</a><ahref="#method.from"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.67.0/core/convert/trait.From.html#tymethod.from"class="fn">from</a>(arr: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; 1]</a>) -> Self</h4></section></summary><divclass='docblock'>Converts to this type from the input type.</div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><sectionid="impl-From%3C%5BT%3B%2010%5D%3E-for-GenericArray%3CT%2C%20U10%3E"class="impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/impls.rs.html#183-216">source</a><ahref="#impl-From%3C%5BT%3B%2010%5D%3E-for-GenericArray%3CT%2C%20U10%3E"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/convert/trait.From.html"title="trait core::convert::From">From</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; 10]</a>> for <aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, <aclass="type"href="../typenum/generated/consts/type.U10.html"title="type typenum::generated::consts::U10">U10</a>></h3></section></summary><divclass="impl-items"><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.from-36"class="method trait-impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/impls.rs.html#183-216">source</a><ahref="#method.from-36"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.67.0/core/convert/trait.From.html#tymethod.from"class="fn">from</a>(arr: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; 10]</a>) -> Self</h4></section></summary><divclass='docblock'>Converts to this type from the input type.</div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><sectionid="impl-From%3C%5BT%3B%2011%5D%3E-for-GenericArray%3CT%2C%20U11%3E"class="impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/impls.rs.html#183-216">source</a><ahref="#impl-From%3C%5BT%3B%2011%5D%3E-for-GenericArray%3CT%2C%20U11%3E"class="anchor">§</a><h3class="code-header">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/convert/trait.From.html"title="trait core::convert::From">From</a><<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.array.html">[T; 11]</a>> for <aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, <aclass="type"href="../typenum/generated/consts/type.U11.html"title="type typenum::generated::consts::U11">U11</a>></h3></section></summary><divclass="impl-items"><detailsclass="rustdoc-toggle method-toggle"open><summary><se
initializing a new <code>GenericSequence</code> with the result of the zipped mapping function. <ahref="functional/trait.FunctionalSequence.html#method.zip">Read more</a></div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.fold"class="method trait-impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/lib.rs.html#506-523">source</a><ahref="#method.fold"class="anchor">§</a><h4class="code-header">fn <ahref="functional/trait.FunctionalSequence.html#method.fold"class="fn">fold</a><U, F>(self, init: U, f: F) -> U<spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(U, T) -> U,</span></h4></section></summary><divclass='docblock'>Folds (or reduces) a sequence of data into a single value. <ahref="functional/trait.FunctionalSequence.html#method.fold">Read more</a></div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><sectionid="impl-GenericSequence%3CT%3E-for-GenericArray%3CT%2C%20N%3E"class="impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/lib.rs.html#371-458">source</a><ahref="#impl-GenericSequence%3CT%3E-for-GenericArray%3CT%2C%20N%3E"class="anchor">§</a><h3class="code-header">impl<T, N><aclass="trait"href="sequence/trait.GenericSequence.html"title="trait generic_array::sequence::GenericSequence">GenericSequence</a><T> for <aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, N><spanclass="where fmt-newline">where<br> N: <aclass="trait"href="trait.ArrayLength.html"title="trait generic_array::ArrayLength">ArrayLength</a><T>,<br> Self: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/iter/traits/collect/trait.IntoIterator.html"title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = T>,</span></h3></section></summary><divclass="impl-items"><detailsclass="rustdoc-toggle"open><summary><sectionid="associatedtype.Length"class="associatedtype trait-impl has-srclink"><ahref="#associatedtype.Length"class="anchor">§</a><h4class="code-header">type <ahref="sequence/trait.GenericSequence.html#associatedtype.Length"class="associatedtype">Length</a> = N</h4></section></summary><divclass='docblock'><code>GenericArray</code> associated length</div></details><detailsclass="rustdoc-toggle"open><summary><sectionid="associatedtype.Sequence"class="associatedtype trait-impl has-srclink"><ahref="#associatedtype.Sequence"class="anchor">§</a><h4class="code-header">type <ahref="sequence/trait.GenericSequence.html#associatedtype.Sequence"class="associatedtype">Sequence</a> = <aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, N></h4></section></summary><divclass='docblock'>Concrete sequence type used in conjuction with reference implementations of <code>GenericSequence</code></div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.generate"class="method trait-impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/lib.rs.html#379-398">source</a><ahref="#method.generate"class="anchor">§</a><h4class="code-header">fn <ahref="sequence/trait.GenericSequence.html#tymethod.generate"class="fn">generate</a><F>(f: F) -><aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, N><spanclass="where fmt-newline">where<br> F: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/function/trait.FnMut.html"title="trait core::ops::function::FnMut">FnMut</a>(<aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.usize.html">usize</a>) -> T,</span></h4></section></summary><divclass='docblock'>Initializes a n
by <code>==</code>. <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.ne"class="method trait-impl has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/cmp.rs.html#229">source</a></span><ahref="#method.ne"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialEq.html#method.ne"class="fn">ne</a>(&self, other: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>Rhs) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
sufficient, and should not be overridden without very good reason. <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialEq.html#method.ne">Read more</a></div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><sectionid="impl-PartialOrd%3CGenericArray%3CT%2C%20N%3E%3E-for-GenericArray%3CT%2C%20N%3E"class="impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/impls.rs.html#47-54">source</a><ahref="#impl-PartialOrd%3CGenericArray%3CT%2C%20N%3E%3E-for-GenericArray%3CT%2C%20N%3E"class="anchor">§</a><h3class="code-header">impl<T: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html"title="trait core::cmp::PartialOrd">PartialOrd</a>, N><aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html"title="trait core::cmp::PartialOrd">PartialOrd</a><<aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, N>> for <aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, N><spanclass="where fmt-newline">where<br> N: <aclass="trait"href="trait.ArrayLength.html"title="trait generic_array::ArrayLength">ArrayLength</a><T>,</span></h3></section></summary><divclass="impl-items"><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.partial_cmp"class="method trait-impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/impls.rs.html#51-53">source</a><ahref="#method.partial_cmp"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp"class="fn">partial_cmp</a>(&self, other: &<aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, N>) -><aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="enum"href="https://doc.rust-lang.org/1.67.0/core/cmp/enum.Ordering.html"title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><divclass='docblock'>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.lt"class="method trait-impl has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/cmp.rs.html#1126">source</a></span><ahref="#method.lt"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html#method.lt"class="fn">lt</a>(&self, other: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>Rhs) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass='docblock'>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.le"class="method trait-impl has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/cmp.rs.html#1145">source</a></span><ahref="#method.le"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html#method.le"class="fn">le</a>(&self, other: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.refe
operator. <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.gt"class="method trait-impl has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/cmp.rs.html#1163">source</a></span><ahref="#method.gt"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html#method.gt"class="fn">gt</a>(&self, other: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>Rhs) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass='docblock'>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.ge"class="method trait-impl has-srclink"><spanclass="rightside"><spanclass="since"title="Stable since Rust version 1.0.0">1.0.0</span> · <aclass="srclink"href="https://doc.rust-lang.org/1.67.0/src/core/cmp.rs.html#1182">source</a></span><ahref="#method.ge"class="anchor">§</a><h4class="code-header">fn <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html#method.ge"class="fn">ge</a>(&self, other: <aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.reference.html">&</a>Rhs) -><aclass="primitive"href="https://doc.rust-lang.org/1.67.0/core/primitive.bool.html">bool</a></h4></section></summary><divclass='docblock'>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
operator. <ahref="https://doc.rust-lang.org/1.67.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><sectionid="impl-Shorten%3CT%3E-for-GenericArray%3CT%2C%20N%3E"class="impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/sequence.rs.html#232-263">source</a><ahref="#impl-Shorten%3CT%3E-for-GenericArray%3CT%2C%20N%3E"class="anchor">§</a><h3class="code-header">impl<T, N><aclass="trait"href="sequence/trait.Shorten.html"title="trait generic_array::sequence::Shorten">Shorten</a><T> for <aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, N><spanclass="where fmt-newline">where<br> N: <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/arith/trait.Sub.html"title="trait core::ops::arith::Sub">Sub</a><<aclass="struct"href="../typenum/bit/struct.B1.html"title="struct typenum::bit::B1">B1</a>> + <aclass="trait"href="trait.ArrayLength.html"title="trait generic_array::ArrayLength">ArrayLength</a><T>,<br> <aclass="type"href="../typenum/operator_aliases/type.Sub1.html"title="type typenum::operator_aliases::Sub1">Sub1</a><N>: <aclass="trait"href="trait.ArrayLength.html"title="trait generic_array::ArrayLength">ArrayLength</a><T> + <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/arith/trait.Add.html"title="trait core::ops::arith::Add">Add</a><<aclass="struct"href="../typenum/bit/struct.B1.html"title="struct typenum::bit::B1">B1</a>, Output = N>,<br> <aclass="type"href="../typenum/operator_aliases/type.Add1.html"title="type typenum::operator_aliases::Add1">Add1</a><<aclass="type"href="../typenum/operator_aliases/type.Sub1.html"title="type typenum::operator_aliases::Sub1">Sub1</a><N>>: <aclass="trait"href="trait.ArrayLength.html"title="trait generic_array::ArrayLength">ArrayLength</a><T>,</span></h3></section></summary><divclass="impl-items"><detailsclass="rustdoc-toggle"open><summary><sectionid="associatedtype.Shorter"class="associatedtype trait-impl has-srclink"><ahref="#associatedtype.Shorter"class="anchor">§</a><h4class="code-header">type <ahref="sequence/trait.Shorten.html#associatedtype.Shorter"class="associatedtype">Shorter</a> = <aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, <N as <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/arith/trait.Sub.html"title="trait core::ops::arith::Sub">Sub</a><<aclass="struct"href="../typenum/bit/struct.B1.html"title="struct typenum::bit::B1">B1</a>>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.67.0/core/ops/arith/trait.Sub.html#associatedtype.Output"title="type core::ops::arith::Sub::Output">Output</a>></h4></section></summary><divclass='docblock'><code>GenericSequence</code> that has one less element than <code>Self</code></div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.pop_back"class="method trait-impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/sequence.rs.html#241-250">source</a><ahref="#method.pop_back"class="anchor">§</a><h4class="code-header">fn <ahref="sequence/trait.Shorten.html#tymethod.pop_back"class="fn">pop_back</a>(self) -> (Self::<aclass="associatedtype"href="sequence/trait.Shorten.html#associatedtype.Shorter"title="type generic_array::sequence::Shorten::Shorter">Shorter</a>, T)</h4></section></summary><divclass='docblock'>Returns a new array without the last element, and the last element. <ahref="sequence/trait.Shorten.html#tymethod.pop_back">Read more</a></div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.pop_front"class="method trait-impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/sequence.rs.html#252-262">source
Example: <ahref="sequence/trait.Shorten.html#tymethod.pop_front">Read more</a></div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><sectionid="impl-Split%3CT%2C%20K%3E-for-%26%27a%20GenericArray%3CT%2C%20N%3E"class="impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/sequence.rs.html#302-320">source</a><ahref="#impl-Split%3CT%2C%20K%3E-for-%26%27a%20GenericArray%3CT%2C%20N%3E"class="anchor">§</a><h3class="code-header">impl<'a, T, N, K><aclass="trait"href="sequence/trait.Split.html"title="trait generic_array::sequence::Split">Split</a><T, K> for &'a <aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, N><spanclass="where fmt-newline">where<br> N: <aclass="trait"href="trait.ArrayLength.html"title="trait generic_array::ArrayLength">ArrayLength</a><T> + <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/arith/trait.Sub.html"title="trait core::ops::arith::Sub">Sub</a><K>,<br> K: <aclass="trait"href="trait.ArrayLength.html"title="trait generic_array::ArrayLength">ArrayLength</a><T> + 'static,<br> <aclass="type"href="../typenum/operator_aliases/type.Diff.html"title="type typenum::operator_aliases::Diff">Diff</a><N, K>: <aclass="trait"href="trait.ArrayLength.html"title="trait generic_array::ArrayLength">ArrayLength</a><T>,</span></h3></section></summary><divclass="impl-items"><detailsclass="rustdoc-toggle"open><summary><sectionid="associatedtype.First-1"class="associatedtype trait-impl has-srclink"><ahref="#associatedtype.First-1"class="anchor">§</a><h4class="code-header">type <ahref="sequence/trait.Split.html#associatedtype.First"class="associatedtype">First</a> = &'a <aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, K></h4></section></summary><divclass='docblock'>First part of the resulting split array</div></details><detailsclass="rustdoc-toggle"open><summary><sectionid="associatedtype.Second-1"class="associatedtype trait-impl has-srclink"><ahref="#associatedtype.Second-1"class="anchor">§</a><h4class="code-header">type <ahref="sequence/trait.Split.html#associatedtype.Second"class="associatedtype">Second</a> = &'a <aclass="struct"href="struct.GenericArray.html"title="struct generic_array::GenericArray">GenericArray</a><T, <N as <aclass="trait"href="https://doc.rust-lang.org/1.67.0/core/ops/arith/trait.Sub.html"title="trait core::ops::arith::Sub">Sub</a><K>>::<aclass="associatedtype"href="https://doc.rust-lang.org/1.67.0/core/ops/arith/trait.Sub.html#associatedtype.Output"title="type core::ops::arith::Sub::Output">Output</a>></h4></section></summary><divclass='docblock'>Second part of the resulting split array</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><sectionid="method.split-2"class="method trait-impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/sequence.rs.html#312-319">source</a><ahref="#method.split-2"class="anchor">§</a><h4class="code-header">fn <ahref="sequence/trait.Split.html#tymethod.split"class="fn">split</a>(self) -> (Self::<aclass="associatedtype"href="sequence/trait.Split.html#associatedtype.First"title="type generic_array::sequence::Split::First">First</a>, Self::<aclass="associatedtype"href="sequence/trait.Split.html#associatedtype.Second"title="type generic_array::sequence::Split::Second">Second</a>)</h4></section></summary><divclass='docblock'>Splits an array at the given index, returning the separate parts of the array.</div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><sectionid="impl-Split%3CT%2C%20K%3E-for-%26%27a%20mut%20GenericArray%3CT%2C%20N%3E"class="impl has-srclink"><aclass="srclink rightside"href="../src/generic_array/sequence.rs.html#322-340">source</a><ahref="#impl-