<!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="A “history buffer”, similar to a write-only ring buffer of fixed length."><title>HistoryBuffer in heapless - Rust</title><linkrel="preload"as="font"type="font/woff2"crossoriginhref="../static.files/SourceSerif4-Regular-46f98efaafac5295.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-a2c9cd1067f8b328.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-cb6f1f67f1bcd037.css"id="mainThemeStyle"><metaname="rustdoc-vars"data-root-path="../"data-static-root-path="../static.files/"data-current-crate="heapless"data-themes=""data-resource-suffix=""data-rustdoc-version="1.73.0-nightly (8131b9774 2023-08-02)"data-channel="nightly"data-search-js="search-6dfdfced5eff6596.js"data-settings-js="settings-de11bff964e9d4e5.js"data-settings-css="settings-8c76f75bfb6bd192.css"data-theme-light-css="light-6d2c9675f3d09c26.css"data-theme-dark-css="dark-45ceb8f2e522f4d1.css"data-theme-ayu-css="ayu-fd19013d6ce078bf.css"><scriptsrc="../static.files/storage-db41da1a38ea3cb8.js"></script><scriptdefersrc="sidebar-items.js"></script><scriptdefersrc="../static.files/main-0795b7d26be81095.js"></script><noscript><linkrel="stylesheet"media="(prefers-color-scheme:light)"href="../static.files/light-6d2c9675f3d09c26.css"><linkrel="stylesheet"media="(prefers-color-scheme:dark)"href="../static.files/dark-45ceb8f2e522f4d1.css"><linkrel="stylesheet"href="../static.files/noscript-cffde32267a19fd6.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="logo-container"href="../heapless/index.html"><imgclass="rust-logo"src="../static.files/rust-logo-151179464ae7ed46.svg"alt="logo"></a><h2></h2></nav><navclass="sidebar"><aclass="logo-container"href="../heapless/index.html"><imgclass="rust-logo"src="../static.files/rust-logo-151179464ae7ed46.svg"alt="logo"></a><h2class="location"><ahref="#">HistoryBuffer</a></h2><divclass="sidebar-elems"><section><h3><ahref="#implementations">Methods</a></h3><ulclass="block"><li><ahref="#method.as_slice">as_slice</a></li><li><ahref="#method.capacity">capacity</a></li><li><ahref="#method.clear">clear</a></li><li><ahref="#method.clear_with">clear_with</a></li><li><ahref="#method.extend_from_slice">extend_from_slice</a></li><li><ahref="#method.len">len</a></li><li><ahref="#method.new">new</a></li><li><ahref="#method.new_with">new_with</a></li><li><ahref="#method.oldest_ordered">oldest_ordered</a></li><li><ahref="#method.recent">recent</a></li><li><ahref="#method.write">write</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.array_chunks">array_chunks</a></li><li><ahref="#method.array_windows">a
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.clear"class="method"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#73-75">source</a><h4class="code-header">pub fn <ahref="#method.clear"class="fn">clear</a>(&mut self)</h4></section></summary><divclass="docblock"><p>Clears the buffer, replacing every element with the default value of
T: Copy + Clone,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.new_with"class="method"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#95-101">source</a><h4class="code-header">pub fn <ahref="#method.new_with"class="fn">new_with</a>(t: T) -> Self</h4></section></summary><divclass="docblock"><p>Constructs a new history buffer, where every element is the given value.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.clear_with"class="method"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#104-106">source</a><h4class="code-header">pub fn <ahref="#method.clear_with"class="fn">clear_with</a>(&mut self, t: T)</h4></section></summary><divclass="docblock"><p>Clears the buffer, replacing every element with the given value.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-HistoryBuffer%3CT,+N%3E-2"class="impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#109-216">source</a><ahref="#impl-HistoryBuffer%3CT,+N%3E-2"class="anchor">§</a><h3class="code-header">impl<T, const N: usize><aclass="struct"href="struct.HistoryBuffer.html"title="struct heapless::HistoryBuffer">HistoryBuffer</a><T, N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.len"class="method"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#112-118">source</a><h4class="code-header">pub fn <ahref="#method.len"class="fn">len</a>(&self) -> usize</h4></section></summary><divclass="docblock"><p>Returns the current fill level of the buffer.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.capacity"class="method"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#123-125">source</a><h4class="code-header">pub fn <ahref="#method.capacity"class="fn">capacity</a>(&self) -> usize</h4></section></summary><divclass="docblock"><p>Returns the capacity of the buffer, which is the length of the
underlying backing array.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.write"class="method"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#128-140">source</a><h4class="code-header">pub fn <ahref="#method.write"class="fn">write</a>(&mut self, t: T)</h4></section></summary><divclass="docblock"><p>Writes an element to the buffer, overwriting the oldest value.</p>
T: Clone,</span></h4></section></summary><divclass="docblock"><p>Clones and writes all elements in a slice to the buffer.</p>
<p>If the slice is longer than the buffer, only the last <code>self.len()</code>
elements will actually be stored.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.recent"class="method"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#167-177">source</a><h4class="code-header">pub fn <ahref="#method.recent"class="fn">recent</a>(&self) -> Option<&T></h4></section></summary><divclass="docblock"><p>Returns a reference to the most recently written value.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_slice"class="method"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#181-183">source</a><h4class="code-header">pub fn <ahref="#method.as_slice"class="fn">as_slice</a>(&self) ->&[T]</h4></section></summary><divclass="docblock"><p>Returns the array slice backing the buffer, without keeping track
of the write position. Therefore, the element order is unspecified.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.oldest_ordered"class="method"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#200-215">source</a><h4class="code-header">pub fn <ahref="#method.oldest_ordered"class="fn">oldest_ordered</a><'a>(&'a self) -><aclass="struct"href="struct.OldestOrdered.html"title="struct heapless::OldestOrdered">OldestOrdered</a><'a, T, N><ahref="#"class="tooltip"data-notable-ty="OldestOrdered<'a, T, N>">ⓘ</a></h4></section></summary><divclass="docblock"><p>Returns an iterator for iterating over the buffer from oldest to newest.</p>
</div></details></div></details></div><h2id="deref-methods-%5BT%5D"class="small-section-header"><span>Methods from Deref<Target = [T]></span><ahref="#deref-methods-%5BT%5D"class="anchor">§</a></h2><divid="deref-methods-%5BT%5D-1"class="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_str"class="method"><h4class="code-header">pub fn <ahref="#method.as_str"class="fn">as_str</a>(&self) ->&str</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>ascii_char</code>)</span></div></span></summary><divclass="docblock"><p>Views this slice of ASCII characters as a UTF-8 <code>str</code>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_bytes"class="method"><h4class="code-header">pub fn <ahref="#method.as_bytes"class="fn">as_bytes</a>(&self) ->&[u8]</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>ascii_char</code>)</span></div></span></summary><divclass="docblock"><p>Views this slice of ASCII characters as a slice of <code>u8</code> bytes.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.len-1"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.len-1"class="fn">len</a>(&self) -> usize</h4></section></summary><divclass="docblock"><p>Returns the number of elements in the slice.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.is_empty"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.is_empty"class="fn">is_empty</a>(&self) -> bool</h4></section></summary><divclass="docblock"><p>Returns <code>true</code> if the slice has a length of 0.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.first"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.first"class="fn">first</a>(&self) -> Option<&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="toggle method-toggle"open><summary><sectionid="method.split_first"class="method"><spanclass="since rightside"title="Stable since Rust version 1.5.0">1.5.0</span><h4class="code-header">pub fn <ahref="#method.split_first"class="fn">split_first</a>(&self) -> Option<(&T, &[T])></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="toggle method-toggle"open><summary><sectionid="method.split_last"class="method"><spanclass="since rightside"title="Stable since Rust version 1.5.0">1.5.0</span><h4class="code-header">pub fn <ahref="#method.split_last"class="fn">split_last</a>(&self) -> Option<(&T, &[T])></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="toggle method-toggle"open><summary><sectionid="method.last"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.last"class="fn">last</a>(&self) -> Option<&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="toggle method-toggle"open><summary><sectionid="method.first_chunk"class="method"><h4class="code-header">pub fn <ahref="#method.first_chunk"class="fn">first_chunk</a><const N: usize>(&self) -> Option<&[T; N]></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_first_last_chunk</code>)</span></div></span></summary><divclass="docblock"><p>Returns the first <code>N</code> elements of the slice, or <code>None</code> if it has fewer than <code>N</code> elements.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.split_first_chunk"class="method"><h4class="code-header">pub fn <ahref="#method.split_first_chunk"class="fn">split_first_chunk</a><const N: usize>(&self) -> Option<(&[T; N], &[T])></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_first_last_chunk</code>)</span></div></span></summary><divclass="docblock"><p>Returns the first <code>N</code> elements of the slice and the remainder,
or <code>None</code> if it has fewer than <code>N</code> elements.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.split_last_chunk"class="method"><h4class="code-header">pub fn <ahref="#method.split_last_chunk"class="fn">split_last_chunk</a><const N: usize>(&self) -> Option<(&[T; N], &[T])></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_first_last_chunk</code>)</span></div></span></summary><divclass="docblock"><p>Returns the last <code>N</code> elements of the slice and the remainder,
or <code>None</code> if it has fewer than <code>N</code> elements.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.last_chunk"class="method"><h4class="code-header">pub fn <ahref="#method.last_chunk"class="fn">last_chunk</a><const N: usize>(&self) -> Option<&[T; N]></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_first_last_chunk</code>)</span></div></span></summary><divclass="docblock"><p>Returns the last element of the slice, or <code>None</code> if it is empty.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.get"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.get"class="fn">get</a><I>(&self, index: I) -> Option<&<I as SliceIndex<[T]>>::Output><spanclass="where fmt-newline">where
I: SliceIndex<[T]>,</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="toggle method-toggle"open><summary><sectionid="method.get_unchecked"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub unsafe fn <ahref="#method.get_unchecked"class="fn">get_unchecked</a><I>(
&self,
index: I
) ->&<I as SliceIndex<[T]>>::Output<spanclass="where fmt-newline">where
I: SliceIndex<[T]>,</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="slice::get"><code>get</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="toggle method-toggle"open><summary><sectionid="method.as_ptr"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.as_ptr"class="fn">as_ptr</a>(&self) -> *const T</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="slice::as_mut_ptr"><code>as_mut_ptr</code></a>.</p>
<p>Modifying the container referenced by this slice may cause its buffer
to be reallocated, which would also make any pointers to it invalid.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_ptr_range"class="method"><spanclass="since rightside"title="Stable since Rust version 1.48.0">1.48.0</span><h4class="code-header">pub fn <ahref="#method.as_ptr_range"class="fn">as_ptr_range</a>(&self) -> Range<*const T></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="slice::as_ptr"><code>as_ptr</code></a> for warnings on using these pointers. The end pointer
requires extra caution, as it does not point to a valid element in the
slice.</p>
<p>This function is useful for interacting with foreign interfaces which
use two pointers to refer to a range of elements in memory, as is
common in C++.</p>
<p>It can also be useful to check if a pointer to an element refers to an
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.iter"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.iter"class="fn">iter</a>(&self) -> Iter<'_, 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="toggle method-toggle"open><summary><sectionid="method.windows"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.windows"class="fn">windows</a>(&self, size: usize) -> Windows<'_, 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="toggle method-toggle"open><summary><sectionid="method.chunks"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.chunks"class="fn">chunks</a>(&self, chunk_size: usize) -> Chunks<'_, 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="slice::chunks_exact"><code>chunks_exact</code></a> for a variant of this iterator that returns chunks of always exactly
<code>chunk_size</code> elements, and <ahref="slice::rchunks"><code>rchunks</code></a> for the same iterator but starting at the end of the
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.chunks_exact"class="method"><spanclass="since rightside"title="Stable since Rust version 1.31.0">1.31.0</span><h4class="code-header">pub fn <ahref="#method.chunks_exact"class="fn">chunks_exact</a>(&self, chunk_size: usize) -> ChunksExact<'_, 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="slice::chunks"><code>chunks</code></a>.</p>
<p>See <ahref="slice::chunks"><code>chunks</code></a> for a variant of this iterator that also returns the remainder as a smaller
chunk, and <ahref="slice::rchunks_exact"><code>rchunks_exact</code></a> for the same iterator but starting at the end of the slice.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_chunks_unchecked"class="method"><h4class="code-header">pub unsafe fn <ahref="#method.as_chunks_unchecked"class="fn">as_chunks_unchecked</a><const N: usize>(&self) ->&[[T; N]]</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="toggle method-toggle"open><summary><sectionid="method.as_chunks"class="method"><h4class="code-header">pub fn <ahref="#method.as_chunks"class="fn">as_chunks</a><const N: usize>(&self) -> (&[[T; N]], &[T])</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="toggle method-toggle"open><summary><sectionid="method.as_rchunks"class="method"><h4class="code-header">pub fn <ahref="#method.as_rchunks"class="fn">as_rchunks</a><const N: usize>(&self) -> (&[T], &[[T; N]])</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="toggle method-toggle"open><summary><sectionid="method.array_chunks"class="method"><h4class="code-header">pub fn <ahref="#method.array_chunks"class="fn">array_chunks</a><const N: usize>(&self) -> ArrayChunks<'_, 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="slice::chunks_exact"><code>chunks_exact</code></a>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.array_windows"class="method"><h4class="code-header">pub fn <ahref="#method.array_windows"class="fn">array_windows</a><const N: usize>(&self) -> ArrayWindows<'_, 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="slice::windows"><code>windows</code></a>.</p>
<p>If <code>N</code> is greater than the size of the slice, it will return no windows.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.rchunks"class="method"><spanclass="since rightside"title="Stable since Rust version 1.31.0">1.31.0</span><h4class="code-header">pub fn <ahref="#method.rchunks"class="fn">rchunks</a>(&self, chunk_size: usize) -> RChunks<'_, 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="slice::rchunks_exact"><code>rchunks_exact</code></a> for a variant of this iterator that returns chunks of always exactly
<code>chunk_size</code> elements, and <ahref="slice::chunks"><code>chunks</code></a> for the same iterator but starting at the beginning
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.rchunks_exact"class="method"><spanclass="since rightside"title="Stable since Rust version 1.31.0">1.31.0</span><h4class="code-header">pub fn <ahref="#method.rchunks_exact"class="fn">rchunks_exact</a>(&self, chunk_size: usize) -> RChunksExact<'_, 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="slice::rchunks"><code>rchunks</code></a>.</p>
<p>See <ahref="slice::rchunks"><code>rchunks</code></a> for a variant of this iterator that also returns the remainder as a smaller
chunk, and <ahref="slice::chunks_exact"><code>chunks_exact</code></a> for the same iterator but starting at the beginning of the
F: FnMut(&T, &T) -> bool,</span></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>slice_group_by</code>)</span></div></span></summary><divclass="docblock"><p>Returns an iterator over the slice producing non-overlapping runs
of elements using the predicate to separate them.</p>
<p>The predicate is called on two elements following themselves,
it means the predicate is called on <code>slice[0]</code> and <code>slice[1]</code>
then on <code>slice[1]</code> and <code>slice[2]</code> and so on.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.split_at"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.split_at"class="fn">split_at</a>(&self, mid: usize) -> (&[T], &[T])</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="toggle method-toggle"open><summary><sectionid="method.split_at_unchecked"class="method"><h4class="code-header">pub unsafe fn <ahref="#method.split_at_unchecked"class="fn">split_at_unchecked</a>(&self, mid: usize) -> (&[T], &[T])</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="slice::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="toggle method-toggle"open><summary><sectionid="method.split_array_ref"class="method"><h4class="code-header">pub fn <ahref="#method.split_array_ref"class="fn">split_array_ref</a><const N: usize>(&self) -> (&[T; N], &[T])</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="toggle method-toggle"open><summary><sectionid="method.rsplit_array_ref"class="method"><h4class="code-header">pub fn <ahref="#method.rsplit_array_ref"class="fn">rsplit_array_ref</a><const N: usize>(&self) -> (&[T], &[T; N])</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="toggle method-toggle"open><summary><sectionid="method.split"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.split"class="fn">split</a><F>(&self, pred: F) -> Split<'_, T, F><spanclass="where fmt-newline">where
F: FnMut(&T) -> bool,</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="toggle method-toggle"open><summary><sectionid="method.split_inclusive"class="method"><spanclass="since rightside"title="Stable since Rust version 1.51.0">1.51.0</span><h4class="code-header">pub fn <ahref="#method.split_inclusive"class="fn">split_inclusive</a><F>(&self, pred: F) -> SplitInclusive<'_, T, F><spanclass="where fmt-newline">where
F: FnMut(&T) -> bool,</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="toggle method-toggle"open><summary><sectionid="method.rsplit"class="method"><spanclass="since rightside"title="Stable since Rust version 1.27.0">1.27.0</span><h4class="code-header">pub fn <ahref="#method.rsplit"class="fn">rsplit</a><F>(&self, pred: F) -> RSplit<'_, T, F><spanclass="where fmt-newline">where
F: FnMut(&T) -> bool,</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="toggle method-toggle"open><summary><sectionid="method.splitn"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.splitn"class="fn">splitn</a><F>(&self, n: usize, pred: F) -> SplitN<'_, T, F><spanclass="where fmt-newline">where
F: FnMut(&T) -> bool,</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="toggle method-toggle"open><summary><sectionid="method.rsplitn"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.rsplitn"class="fn">rsplitn</a><F>(&self, n: usize, pred: F) -> RSplitN<'_, T, F><spanclass="where fmt-newline">where
F: FnMut(&T) -> bool,</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="toggle method-toggle"open><summary><sectionid="method.contains"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.contains"class="fn">contains</a>(&self, x: &T) -> bool<spanclass="where fmt-newline">where
T: PartialEq<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="slice::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="toggle method-toggle"open><summary><sectionid="method.starts_with"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.starts_with"class="fn">starts_with</a>(&self, needle: &[T]) -> bool<spanclass="where fmt-newline">where
T: PartialEq<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="toggle method-toggle"open><summary><sectionid="method.ends_with"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.ends_with"class="fn">ends_with</a>(&self, needle: &[T]) -> bool<spanclass="where fmt-newline">where
T: PartialEq<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="toggle method-toggle"open><summary><sectionid="method.binary_search"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.binary_search"class="fn">binary_search</a>(&self, x: &T) -> Result<usize, usize><spanclass="where fmt-newline">where
T: Ord,</span></h4></section></summary><divclass="docblock"><p>Binary searches this slice for a given element.
If the slice is not sorted, the returned result is unspecified and
meaningless.</p>
<p>If the value is found then [<code>Result::Ok</code>] is returned, containing the
index of the matching element. If there are multiple matches, then any
one of the matches could be returned. The index is chosen
deterministically, but is subject to change in future versions of Rust.
If the value is not found then [<code>Result::Err</code>] is returned, containing
the index where a matching element could be inserted while maintaining
sorted order.</p>
<p>See also <ahref="slice::binary_search_by"><code>binary_search_by</code></a>, <ahref="slice::binary_search_by_key"><code>binary_search_by_key</code></a>, and <ahref="slice::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>);
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.binary_search_by"class="method"><spanclass="since rightside"title="Stable since Rust version 1.0.0">1.0.0</span><h4class="code-header">pub fn <ahref="#method.binary_search_by"class="fn">binary_search_by</a><'a, F>(&'a self, f: F) -> Result<usize, usize><spanclass="where fmt-newline">where
F: FnMut(&'a T) -> Ordering,</span></h4></section></summary><divclass="docblock"><p>Binary searches this slice with a comparator function.</p>
<p>The comparator function should return an order code that indicates
whether its argument is <code>Less</code>, <code>Equal</code> or <code>Greater</code> the desired
target.
If the slice is not sorted or if the comparator function does not
implement an order consistent with the sort order of the underlying
slice, the returned result is unspecified and meaningless.</p>
<p>If the value is found then [<code>Result::Ok</code>] is returned, containing the
index of the matching element. If there are multiple matches, then any
one of the matches could be returned. The index is chosen
deterministically, but is subject to change in future versions of Rust.
If the value is not found then [<code>Result::Err</code>] is returned, containing
the index where a matching element could be inserted while maintaining
sorted order.</p>
<p>See also <ahref="slice::binary_search"><code>binary_search</code></a>, <ahref="slice::binary_search_by_key"><code>binary_search_by_key</code></a>, and <ahref="slice::partition_point"><code>partition_point</code></a>.</p>
B: Ord,</span></h4></section></summary><divclass="docblock"><p>Binary searches this slice with a key extraction function.</p>
<p>Assumes that the slice is sorted by the key, for instance with
<ahref="slice::sort_by_key"><code>sort_by_key</code></a> using the same key extraction function.
If the slice is not sorted by the key, the returned result is
unspecified and meaningless.</p>
<p>If the value is found then [<code>Result::Ok</code>] is returned, containing the
index of the matching element. If there are multiple matches, then any
one of the matches could be returned. The index is chosen
deterministically, but is subject to change in future versions of Rust.
If the value is not found then [<code>Result::Err</code>] is returned, containing
the index where a matching element could be inserted while maintaining
sorted order.</p>
<p>See also <ahref="slice::binary_search"><code>binary_search</code></a>, <ahref="slice::binary_search_by"><code>binary_search_by</code></a>, and <ahref="slice::partition_point"><code>partition_point</code></a>.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.align_to"class="method"><spanclass="since rightside"title="Stable since Rust version 1.30.0">1.30.0</span><h4class="code-header">pub unsafe fn <ahref="#method.align_to"class="fn">align_to</a><U>(&self) -> (&[T], &[U], &[T])</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>
LaneCount<LANES>: SupportedLaneCount,</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 [<code>slice::align_to</code>], so has the same weak
postconditions as that method. You’re only assured that
T: PartialOrd<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
F: FnMut(&'a T, &'a T) -> Option<Ordering>,</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="slice::is_sorted"><code>is_sorted</code></a>; see its documentation for more information.</p>
K: PartialOrd<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="slice::is_sorted"><code>is_sorted</code></a>; see its
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.partition_point"class="method"><spanclass="since rightside"title="Stable since Rust version 1.52.0">1.52.0</span><h4class="code-header">pub fn <ahref="#method.partition_point"class="fn">partition_point</a><P>(&self, pred: P) -> usize<spanclass="where fmt-newline">where
P: FnMut(&T) -> bool,</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, <code>[7, 15, 3, 5, 4, 12, 6]</code> is partitioned under the predicate <code>x % 2 != 0</code>
(all odd numbers are at the start, all even at the end).</p>
<p>If this slice is not partitioned, the returned result is unspecified and meaningless,
as this method performs a kind of binary search.</p>
<p>See also <ahref="slice::binary_search"><code>binary_search</code></a>, <ahref="slice::binary_search_by"><code>binary_search_by</code></a>, and <ahref="slice::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="toggle method-toggle"open><summary><sectionid="method.flatten"class="method"><h4class="code-header">pub fn <ahref="#method.flatten"class="fn">flatten</a>(&self) ->&[T]</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="toggle method-toggle"open><summary><sectionid="method.is_ascii"class="method"><spanclass="since rightside"title="Stable since Rust version 1.23.0">1.23.0</span><h4class="code-header">pub fn <ahref="#method.is_ascii"class="fn">is_ascii</a>(&self) -> bool</h4></section></summary><divclass="docblock"><p>Checks if all bytes in this slice are within the ASCII range.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_ascii"class="method"><h4class="code-header">pub fn <ahref="#method.as_ascii"class="fn">as_ascii</a>(&self) -> Option<&[AsciiChar]></h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>ascii_char</code>)</span></div></span></summary><divclass="docblock"><p>If this slice <ahref="Self::is_ascii"><code>is_ascii</code></a>, returns it as a slice of
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_ascii_unchecked"class="method"><h4class="code-header">pub unsafe fn <ahref="#method.as_ascii_unchecked"class="fn">as_ascii_unchecked</a>(&self) ->&[AsciiChar]</h4></section><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>ascii_char</code>)</span></div></span></summary><divclass="docblock"><p>Converts this slice of bytes into a slice of ASCII characters,
<p>Every byte in the slice must be in <code>0..=127</code>, or else this is UB.</p>
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.eq_ignore_ascii_case"class="method"><spanclass="since rightside"title="Stable since Rust version 1.23.0">1.23.0</span><h4class="code-header">pub fn <ahref="#method.eq_ignore_ascii_case"class="fn">eq_ignore_ascii_case</a>(&self, other: &[u8]) -> bool</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="toggle method-toggle"open><summary><sectionid="method.escape_ascii"class="method"><spanclass="since rightside"title="Stable since Rust version 1.60.0">1.60.0</span><h4class="code-header">pub fn <ahref="#method.escape_ascii"class="fn">escape_ascii</a>(&self) -> EscapeAscii<'_></h4></section></summary><divclass="docblock"><p>Returns an iterator that produces an escaped version of this slice,
</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.trim_ascii_start"class="method"><h4class="code-header">pub fn <ahref="#method.trim_ascii_start"class="fn">trim_ascii_start</a>(&self) ->&[u8]</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="toggle method-toggle"open><summary><sectionid="method.trim_ascii"class="method"><h4class="code-header">pub fn <ahref="#method.trim_ascii"class="fn">trim_ascii</a>(&self) ->&[u8]</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><h2id="trait-implementations"class="small-section-header">Trait Implementations<ahref="#trait-implementations"class="anchor">§</a></h2><divid="trait-implementations-list"><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-AsRef%3C%5BT%5D%3E-for-HistoryBuffer%3CT,+N%3E"class="impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#260-265">source</a><ahref="#impl-AsRef%3C%5BT%5D%3E-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, const N: usize> AsRef<[T]> for <aclass="struct"href="struct.HistoryBuffer.html"title="struct heapless::HistoryBuffer">HistoryBuffer</a><T, N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.as_ref"class="method trait-impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#262-264">source</a><ahref="#method.as_ref"class="anchor">§</a><h4class="code-header">fn <aclass="fn">as_ref</a>(&self) ->&[T]</h4></section></summary><divclass='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Debug-for-HistoryBuffer%3CT,+N%3E"class="impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#267-274">source</a><ahref="#impl-Debug-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, const N: usize> Debug for <aclass="struct"href="struct.HistoryBuffer.html"title="struct heapless::HistoryBuffer">HistoryBuffer</a><T, N><spanclass="where fmt-newline">where
T: Debug,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.fmt"class="method trait-impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#271-273">source</a><ahref="#method.fmt"class="anchor">§</a><h4class="code-header">fn <aclass="fn">fmt</a>(&self, f: &mut Formatter<'_>) -> Result</h4></section></summary><divclass='docblock'>Formats the value using the given formatter. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Default-for-HistoryBuffer%3CT,+N%3E"class="impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#276-280">source</a><ahref="#impl-Default-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, const N: usize> Default for <aclass="struct"href="struct.HistoryBuffer.html"title="struct heapless::HistoryBuffer">HistoryBuffer</a><T, N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.default"class="method trait-impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#277-279">source</a><ahref="#method.default"class="anchor">§</a><h4class="code-header">fn <aclass="fn">default</a>() -> Self</h4></section></summary><divclass='docblock'>Returns the “default value” for a type. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Deref-for-HistoryBuffer%3CT,+N%3E"class="impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#252-258">source</a><ahref="#impl-Deref-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, const N: usize> Deref for <aclass="struct"href="struct.HistoryBuffer.html"title="struct heapless::HistoryBuffer">HistoryBuffer</a><T, N></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Target"class="associatedtype trait-impl"><ahref="#associatedtype.Target"class="anchor">§</a><h4class="code-header">type <aclass="associatedtype">Target</a> = [T]</h4></section></summary><divclass='docblock'>The resulting type after dereferencing.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.deref"class="method trait-impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#255-257">source</a><ahref="#method.deref"class="anchor">§</a><h4class="code-header">fn <aclass="fn">deref</a>(&self) ->&[T]</h4></section></summary><divclass='docblock'>Dereferences the value.</div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Drop-for-HistoryBuffer%3CT,+N%3E"class="impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#241-250">source</a><ahref="#impl-Drop-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, const N: usize> Drop for <aclass="struct"href="struct.HistoryBuffer.html"title="struct heapless::HistoryBuffer">HistoryBuffer</a><T, N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.drop"class="method trait-impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#242-249">source</a><ahref="#method.drop"class="anchor">§</a><h4class="code-header">fn <aclass="fn">drop</a>(&mut self)</h4></section></summary><divclass='docblock'>Executes the destructor for this type. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Extend%3C%26'a+T%3E-for-HistoryBuffer%3CT,+N%3E"class="impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#229-239">source</a><ahref="#impl-Extend%3C%26'a+T%3E-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<'a, T, const N: usize> Extend<&'a T> for <aclass="struct"h
I: IntoIterator<Item = &'a T>,</span></h4></section></summary><divclass='docblock'>Extends a collection with the contents of an iterator. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend_one-1"class="method trait-impl"><ahref="#method.extend_one-1"class="anchor">§</a><h4class="code-header">fn <aclass="fn">extend_one</a>(&mut self, item: A)</h4></section></summary><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><divclass='docblock'>Extends a collection with exactly one element.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend_reserve-1"class="method trait-impl"><ahref="#method.extend_reserve-1"class="anchor">§</a><h4class="code-header">fn <aclass="fn">extend_reserve</a>(&mut self, additional: usize)</h4></section></summary><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><divclass='docblock'>Reserves capacity in a collection for the given number of additional elements. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"open><summary><sectionid="impl-Extend%3CT%3E-for-HistoryBuffer%3CT,+N%3E"class="impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#218-227">source</a><ahref="#impl-Extend%3CT%3E-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, const N: usize> Extend<T> for <aclass="struct"href="struct.HistoryBuffer.html"title="struct heapless::HistoryBuffer">HistoryBuffer</a><T, N></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend"class="method trait-impl"><aclass="src rightside"href="../src/heapless/histbuf.rs.html#219-226">source</a><ahref="#method.extend"class="anchor">§</a><h4class="code-header">fn <aclass="fn">extend</a><I>(&mut self, iter: I)<spanclass="where fmt-newline">where
I: IntoIterator<Item = T>,</span></h4></section></summary><divclass='docblock'>Extends a collection with the contents of an iterator. <a>Read more</a></div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend_one"class="method trait-impl"><ahref="#method.extend_one"class="anchor">§</a><h4class="code-header">fn <aclass="fn">extend_one</a>(&mut self, item: A)</h4></section></summary><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><divclass='docblock'>Extends a collection with exactly one element.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.extend_reserve"class="method trait-impl"><ahref="#method.extend_reserve"class="anchor">§</a><h4class="code-header">fn <aclass="fn">extend_reserve</a>(&mut self, additional: usize)</h4></section></summary><spanclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>extend_one</code>)</span></div></span><divclass='docblock'>Reserves capacity in a collection for the given number of additional elements. <a>Read more</a></div></details></div></details></div><h2id="synthetic-implementations"class="small-section-header">Auto Trait Implementations<ahref="#synthetic-implementations"class="anchor">§</a></h2><divid="synthetic-implementations-list"><sectionid="impl-RefUnwindSafe-for-HistoryBuffer%3CT,+N%3E"class="impl"><ahref="#impl-RefUnwindSafe-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, const N: usize> RefUnwindSafe for <aclass="struct"href="struct.HistoryBuffer.html"title="struct heapless::HistoryBuffer">HistoryBuffer</a><T, N><spanclass="where fmt-newline">where
T: UnwindSafe,</span></h3></section></div><h2id="blanket-implementations"class="small-section-header">Blanket Implementations<ahref="#blanket-implementations"class="anchor">§</a></h2><divid="blanket-implementations-list"><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Any-for-HistoryBuffer%3CT,+N%3E"class="impl"><ahref="#impl-Any-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<T> Any for T<spanclass="where fmt-newline">where
T: 'static + ?Sized,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.type_id"class="method trait-impl"><ahref="#method.type_id"class="anchor">§</a><h4class="code-header">fn <aclass="fn">type_id</a>(&self) -> TypeId</h4></section></summary><divclass='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Borrow%3CT%3E-for-HistoryBuffer%3CT,+N%3E"class="impl"><ahref="#impl-Borrow%3CT%3E-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<T> Borrow<T> for T<spanclass="where fmt-newline">where
T: ?Sized,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.borrow"class="method trait-impl"><ahref="#method.borrow"class="anchor">§</a><h4class="code-header">fn <aclass="fn">borrow</a>(&self) ->&T</h4></section></summary><divclass='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-BorrowMut%3CT%3E-for-HistoryBuffer%3CT,+N%3E"class="impl"><ahref="#impl-BorrowMut%3CT%3E-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<T> BorrowMut<T> for T<spanclass="where fmt-newline">where
T: ?Sized,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.borrow_mut"class="method trait-impl"><ahref="#method.borrow_mut"class="anchor">§</a><h4class="code-header">fn <aclass="fn">borrow_mut</a>(&mut self) ->&mut T</h4></section></summary><divclass='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-From%3CT%3E-for-HistoryBuffer%3CT,+N%3E"class="impl"><ahref="#impl-From%3CT%3E-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<T> From<T> for T</h3></section></summary><divclass="impl-items"><detailsclass="toggle method-toggle"open><summary><sectionid="method.from"class="method trait-impl"><ahref="#method.from"class="anchor">§</a><h4class="code-header">fn <aclass="fn">from</a>(t: T) -> T</h4></section></summary><divclass="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-Into%3CU%3E-for-HistoryBuffer%3CT,+N%3E"class="impl"><ahref="#impl-Into%3CU%3E-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, U> Into<U> for T<spanclass="where fmt-newline">where
U: Into<T>,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error-1"class="associatedtype trait-impl"><ahref="#associatedtype.Error-1"class="anchor">§</a><h4class="code-header">type <aclass="associatedtype">Error</a> = Infallible</h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_from"class="method trait-impl"><ahref="#method.try_from"class="anchor">§</a><h4class="code-header">fn <aclass="fn">try_from</a>(value: U) -> Result<T, <T as TryFrom<U>>::Error></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details><detailsclass="toggle implementors-toggle"><summary><sectionid="impl-TryInto%3CU%3E-for-HistoryBuffer%3CT,+N%3E"class="impl"><ahref="#impl-TryInto%3CU%3E-for-HistoryBuffer%3CT,+N%3E"class="anchor">§</a><h3class="code-header">impl<T, U> TryInto<U> for T<spanclass="where fmt-newline">where
U: TryFrom<T>,</span></h3></section></summary><divclass="impl-items"><detailsclass="toggle"open><summary><sectionid="associatedtype.Error"class="associatedtype trait-impl"><ahref="#associatedtype.Error"class="anchor">§</a><h4class="code-header">type <aclass="associatedtype">Error</a> = <U as TryFrom<T>>::Error</h4></section></summary><divclass='docblock'>The type returned in the event of a conversion error.</div></details><detailsclass="toggle method-toggle"open><summary><sectionid="method.try_into"class="method trait-impl"><ahref="#method.try_into"class="anchor">§</a><h4class="code-header">fn <aclass="fn">try_into</a>(self) -> Result<U, <U as TryFrom<T>>::Error></h4></section></summary><divclass='docblock'>Performs the conversion.</div></details></div></details></div><scripttype="text/json"id="notable-traits-data">{"OldestOrdered<'a, T, N>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.OldestOrdered.html\" title=\"struct heapless::OldestOrdered\">OldestOrdered</a><'a, T, N></code></h3><pre><code><span class=\"where fmt-newline\">impl<'a, T, const N: usize> Iterator for <a class=\"struct\" href=\"struct.OldestOrdered.html\" title=\"struct heapless::OldestOrdered\">OldestOrdered</a><'a, T, N></span><span class=\"where fmt-newline\"> type <a class=\"associatedtype\">Item</a> = &'a T;</span>"}</script></section></div></main></body></html>