Files
google-apis-rs/core_foundation/data/struct.CFData.html
2021-04-02 00:20:57 +08:00

797 lines
202 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `CFData` struct in crate `core_foundation`."><meta name="keywords" content="rust, rustlang, rust-lang, CFData"><title>core_foundation::data::CFData - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../core_foundation/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Struct CFData</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.bytes">bytes</a><a href="#method.from_buffer">from_buffer</a><a href="#method.len">len</a></div><a class="sidebar-title" href="#deref-methods-%5Bu8%5D">Methods from Deref&lt;Target=[u8]&gt;</a><div class="sidebar-links"><a href="#method.align_to">align_to</a><a href="#method.array_chunks">array_chunks</a><a href="#method.array_windows">array_windows</a><a href="#method.as_chunks">as_chunks</a><a href="#method.as_chunks_unchecked">as_chunks_unchecked</a><a href="#method.as_ptr">as_ptr</a><a href="#method.as_ptr_range">as_ptr_range</a><a href="#method.as_rchunks">as_rchunks</a><a href="#method.binary_search">binary_search</a><a href="#method.binary_search_by">binary_search_by</a><a href="#method.binary_search_by_key">binary_search_by_key</a><a href="#method.chunks">chunks</a><a href="#method.chunks_exact">chunks_exact</a><a href="#method.concat">concat</a><a href="#method.connect">connect</a><a href="#method.contains">contains</a><a href="#method.ends_with">ends_with</a><a href="#method.eq_ignore_ascii_case">eq_ignore_ascii_case</a><a href="#method.first">first</a><a href="#method.get">get</a><a href="#method.get_unchecked">get_unchecked</a><a href="#method.group_by">group_by</a><a href="#method.is_ascii">is_ascii</a><a href="#method.is_empty">is_empty</a><a href="#method.is_sorted">is_sorted</a><a href="#method.is_sorted_by">is_sorted_by</a><a href="#method.is_sorted_by_key">is_sorted_by_key</a><a href="#method.iter">iter</a><a href="#method.join">join</a><a href="#method.last">last</a><a href="#method.len">len</a><a href="#method.partition_point">partition_point</a><a href="#method.rchunks">rchunks</a><a href="#method.rchunks_exact">rchunks_exact</a><a href="#method.repeat">repeat</a><a href="#method.rsplit">rsplit</a><a href="#method.rsplitn">rsplitn</a><a href="#method.split">split</a><a href="#method.split_at">split_at</a><a href="#method.split_first">split_first</a><a href="#method.split_inclusive">split_inclusive</a><a href="#method.split_last">split_last</a><a href="#method.splitn">splitn</a><a href="#method.starts_with">starts_with</a><a href="#method.strip_prefix">strip_prefix</a><a href="#method.strip_suffix">strip_suffix</a><a href="#method.to_ascii_lowercase">to_ascii_lowercase</a><a href="#method.to_ascii_uppercase">to_ascii_uppercase</a><a href="#method.to_vec">to_vec</a><a href="#method.to_vec_in">to_vec_in</a><a href="#method.windows">windows</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-CFPropertyListSubClass">CFPropertyListSubClass</a><a href="#impl-Clone">Clone</a><a href="#impl-ConcreteCFType">ConcreteCFType</a><a href="#impl-Debug">Debug</a><a href="#impl-Deref">Deref</a><a href="#impl-Drop">Drop</a><a href="#impl-Eq">Eq</a><a href="#impl-PartialEq%3CCFData%3E">PartialEq&lt;CFData&gt;</a><a href="#impl-TCFType">TCFType</a><a href="#impl-ToVoid%3CCFData%3E">ToVoid&lt;CFData&gt;</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-FromMutVoid">FromMutVoid</a><a href="#impl-FromVoid">FromVoid</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class="location"><a href="../index.html">core_foundation</a>::<wbr><a href="index.html">data</a></p><div id="sidebar-vars" data-name="CFData" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Struct <a href="../index.html">core_foundation</a>::<wbr><a href="index.html">data</a>::<wbr><a class="struct" href="">CFData</a></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/core_foundation/data.rs.html#21-24" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct CFData(_);</pre></div><div class="docblock"><p>A byte buffer.</p>
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/core_foundation/data.rs.html#28-54" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from_buffer" class="method"><code>pub fn <a href="#method.from_buffer" class="fnname">from_buffer</a>(buffer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a class="srclink" href="../../src/core_foundation/data.rs.html#29-36" title="goto source code">[src]</a></h4><h4 id="method.bytes" class="method"><code>pub fn <a href="#method.bytes" class="fnname">bytes</a>&lt;'a&gt;(&amp;'a self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'a [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></h3><code class="content"><span class="where fmt-newline">impl&lt;'_&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span><span class="where fmt-newline">impl&lt;'_&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span></code></span></div></span></span></code><a class="srclink" href="../../src/core_foundation/data.rs.html#41-45" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a pointer to the underlying bytes in this data. Note that this byte buffer is
read-only.</p>
</div><h4 id="method.len" class="method"><code>pub fn <a href="#method.len" class="fnname">len</a>(&amp;self) -&gt; <a class="type" href="../../core_foundation/base/type.CFIndex.html" title="type core_foundation::base::CFIndex">CFIndex</a></code><a class="srclink" href="../../src/core_foundation/data.rs.html#49-53" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns the length of this byte buffer.</p>
</div></div><h2 id="deref-methods-%5Bu8%5D" class="small-section-header">Methods from <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&lt;Target = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>&gt;<a href="#deref-methods-%5Bu8%5D" class="anchor"></a></h2><div class="impl-items"><h4 id="method.len-1" class="method"><code>pub const fn <a href="#method.len-1" class="fnname">len</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code><span class="since" title="Stable since Rust version 1.0.0, const since 1.32.0">1.0.0 (const: 1.32.0)</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#96" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns the number of elements in the slice.</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">a</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">a</span>.<span class="ident">len</span>(), <span class="number">3</span>);</pre></div>
</div><h4 id="method.is_empty" class="method"><code>pub const fn <a href="#method.is_empty" class="fnname">is_empty</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class="since" title="Stable since Rust version 1.0.0, const since 1.32.0">1.0.0 (const: 1.32.0)</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#113" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns <code>true</code> if the slice has a length of 0.</p>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">a</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">a</span>.<span class="ident">is_empty</span>());</pre></div>
</div><h4 id="method.first" class="method"><code>pub fn <a href="#method.first" class="fnname">first</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T&gt;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#130" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns the first element of the slice, or <code>None</code> if it is empty.</p>
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">10</span>), <span class="ident">v</span>.<span class="ident">first</span>());
<span class="kw">let</span> <span class="ident">w</span>: <span class="kw-2">&amp;</span>[<span class="ident">i32</span>] <span class="op">=</span> <span class="kw-2">&amp;</span>[];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">None</span>, <span class="ident">w</span>.<span class="ident">first</span>());</pre></div>
</div><h4 id="method.split_first" class="method"><code>pub fn <a href="#method.split_first" class="fnname">split_first</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#166" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns the first and all the rest of the elements of the slice, or <code>None</code> if it is empty.</p>
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>];
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>((<span class="ident">first</span>, <span class="ident">elements</span>)) <span class="op">=</span> <span class="ident">x</span>.<span class="ident">split_first</span>() {
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">first</span>, <span class="kw-2">&amp;</span><span class="number">0</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">elements</span>, <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>]);
}</pre></div>
</div><h4 id="method.split_last" class="method"><code>pub fn <a href="#method.split_last" class="fnname">split_last</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code><span class="since" title="Stable since Rust version 1.5.0">1.5.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#204" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns the last and all the rest of the elements of the slice, or <code>None</code> if it is empty.</p>
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>];
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>((<span class="ident">last</span>, <span class="ident">elements</span>)) <span class="op">=</span> <span class="ident">x</span>.<span class="ident">split_last</span>() {
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">last</span>, <span class="kw-2">&amp;</span><span class="number">2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">elements</span>, <span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>]);
}</pre></div>
</div><h4 id="method.last" class="method"><code>pub fn <a href="#method.last" class="fnname">last</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T&gt;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#241" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns the last element of the slice, or <code>None</code> if it is empty.</p>
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">30</span>), <span class="ident">v</span>.<span class="ident">last</span>());
<span class="kw">let</span> <span class="ident">w</span>: <span class="kw-2">&amp;</span>[<span class="ident">i32</span>] <span class="op">=</span> <span class="kw-2">&amp;</span>[];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">None</span>, <span class="ident">w</span>.<span class="ident">last</span>());</pre></div>
</div><h4 id="method.get" class="method"><code>pub fn <a href="#method.get" class="fnname">get</a>&lt;I&gt;(&amp;self, index: I) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;&lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a>T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a>T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>&gt;,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#282-284" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a reference to an element or subslice depending on the type of
index.</p>
<ul>
<li>If given a position, returns a reference to the element at that
position or <code>None</code> if out of bounds.</li>
<li>If given a range, returns the subslice corresponding to that range,
or <code>None</code> if out of bounds.</li>
</ul>
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">40</span>), <span class="ident">v</span>.<span class="ident">get</span>(<span class="number">1</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>][..]), <span class="ident">v</span>.<span class="ident">get</span>(<span class="number">0</span>..<span class="number">2</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">None</span>, <span class="ident">v</span>.<span class="ident">get</span>(<span class="number">3</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">None</span>, <span class="ident">v</span>.<span class="ident">get</span>(<span class="number">0</span>..<span class="number">4</span>));</pre></div>
</div><h4 id="method.get_unchecked" class="method"><code>pub unsafe fn <a href="#method.get_unchecked" class="fnname">get_unchecked</a>&lt;I&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;index: I<br>) -&gt; &amp;&lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a>T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::index::SliceIndex::Output">Output</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/index/trait.SliceIndex.html" title="trait core::slice::index::SliceIndex">SliceIndex</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a>T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>&gt;,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#337-339" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a reference to an element or subslice, without doing bounds
checking.</p>
<p>For a safe alternative see <a href="#method.get"><code>get</code></a>.</p>
<h1 id="safety" class="section-header"><a href="#safety">Safety</a></h1>
<p>Calling this method with an out-of-bounds index is <em><a href="https://doc.rust-lang.org/reference/behavior-considered-undefined.html">undefined behavior</a></em>
even if the resulting reference is not used.</p>
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
<span class="kw">unsafe</span> {
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">get_unchecked</span>(<span class="number">1</span>), <span class="kw-2">&amp;</span><span class="number">2</span>);
}</pre></div>
</div><h4 id="method.as_ptr" class="method"><code>pub const fn <a href="#method.as_ptr" class="fnname">as_ptr</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*const T</a></code><span class="since" title="Stable since Rust version 1.0.0, const since 1.32.0">1.0.0 (const: 1.32.0)</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#412" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a raw pointer to the slice's buffer.</p>
<p>The caller must ensure that the slice outlives the pointer this
function returns, or else it will end up pointing to garbage.</p>
<p>The caller must also ensure that the memory the pointer (non-transitively) points to
is never written to (except inside an <code>UnsafeCell</code>) using this pointer or any pointer
derived from it. If you need to mutate the contents of the slice, use <a href="#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>
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
<span class="kw">let</span> <span class="ident">x_ptr</span> <span class="op">=</span> <span class="ident">x</span>.<span class="ident">as_ptr</span>();
<span class="kw">unsafe</span> {
<span class="kw">for</span> <span class="ident">i</span> <span class="kw">in</span> <span class="number">0</span>..<span class="ident">x</span>.<span class="ident">len</span>() {
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">get_unchecked</span>(<span class="ident">i</span>), <span class="kw-2">&amp;</span><span class="kw-2">*</span><span class="ident">x_ptr</span>.<span class="ident">add</span>(<span class="ident">i</span>));
}
}</pre></div>
</div><h4 id="method.as_ptr_range" class="method"><code>pub const fn <a href="#method.as_ptr_range" class="fnname">as_ptr_range</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*const T</a>&gt;</code><span class="since" title="Stable since Rust version 1.48.0">1.48.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#475" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns the two raw pointers spanning the slice.</p>
<p>The returned range is half-open, which means that the end pointer
points <em>one past</em> the last element of the slice. This way, an empty
slice is represented by two equal pointers, and the difference between
the two pointers represents the size of the slice.</p>
<p>See <a href="#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
element of this slice:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">a</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&amp;</span><span class="ident">a</span>[<span class="number">1</span>] <span class="kw">as</span> <span class="kw-2">*</span><span class="kw">const</span> <span class="kw">_</span>;
<span class="kw">let</span> <span class="ident">y</span> <span class="op">=</span> <span class="kw-2">&amp;</span><span class="number">5</span> <span class="kw">as</span> <span class="kw-2">*</span><span class="kw">const</span> <span class="kw">_</span>;
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">a</span>.<span class="ident">as_ptr_range</span>().<span class="ident">contains</span>(<span class="kw-2">&amp;</span><span class="ident">x</span>));
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">a</span>.<span class="ident">as_ptr_range</span>().<span class="ident">contains</span>(<span class="kw-2">&amp;</span><span class="ident">y</span>));</pre></div>
</div><h4 id="method.iter" class="method"><code>pub fn <a href="#method.iter" class="fnname">iter</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.Iter.html" title="struct core::slice::iter::Iter">Iter</a>&lt;'_, T&gt;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#685" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns an iterator over the slice.</p>
<h1 id="examples-9" class="section-header"><a href="#examples-9">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iterator</span> <span class="op">=</span> <span class="ident">x</span>.<span class="ident">iter</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iterator</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">1</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iterator</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">2</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iterator</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">4</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iterator</span>.<span class="ident">next</span>(), <span class="prelude-val">None</span>);</pre></div>
</div><h4 id="method.windows" class="method"><code>pub fn <a href="#method.windows" class="fnname">windows</a>(&amp;self, size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.Windows.html" title="struct core::slice::iter::Windows">Windows</a>&lt;'_, T&gt;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#734" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns an iterator over all contiguous windows of length
<code>size</code>. The windows overlap. If the slice is shorter than
<code>size</code>, the iterator returns no values.</p>
<h1 id="panics" class="section-header"><a href="#panics">Panics</a></h1>
<p>Panics if <code>size</code> is 0.</p>
<h1 id="examples-10" class="section-header"><a href="#examples-10">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="string">&#39;r&#39;</span>, <span class="string">&#39;u&#39;</span>, <span class="string">&#39;s&#39;</span>, <span class="string">&#39;t&#39;</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">windows</span>(<span class="number">2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;r&#39;</span>, <span class="string">&#39;u&#39;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;u&#39;</span>, <span class="string">&#39;s&#39;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;s&#39;</span>, <span class="string">&#39;t&#39;</span>]);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">is_none</span>());</pre></div>
<p>If the slice is shorter than <code>size</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="string">&#39;f&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;o&#39;</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">windows</span>(<span class="number">4</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">is_none</span>());</pre></div>
</div><h4 id="method.chunks" class="method"><code>pub fn <a href="#method.chunks" class="fnname">chunks</a>(&amp;self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.Chunks.html" title="struct core::slice::iter::Chunks">Chunks</a>&lt;'_, T&gt;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#768" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time, starting at the
beginning of the slice.</p>
<p>The chunks are slices and do not overlap. If <code>chunk_size</code> does not divide the length of the
slice, then the last chunk will not have length <code>chunk_size</code>.</p>
<p>See <a href="#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 <a href="#method.rchunks"><code>rchunks</code></a> for the same iterator but starting at the end of the
slice.</p>
<h1 id="panics-1" class="section-header"><a href="#panics-1">Panics</a></h1>
<p>Panics if <code>chunk_size</code> is 0.</p>
<h1 id="examples-11" class="section-header"><a href="#examples-11">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">chunks</span>(<span class="number">2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;m&#39;</span>]);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">is_none</span>());</pre></div>
</div><h4 id="method.chunks_exact" class="method"><code>pub fn <a href="#method.chunks_exact" class="fnname">chunks_exact</a>(&amp;self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.ChunksExact.html" title="struct core::slice::iter::ChunksExact">ChunksExact</a>&lt;'_, T&gt;</code><span class="since" title="Stable since Rust version 1.31.0">1.31.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#843" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time, starting at the
beginning of the slice.</p>
<p>The chunks are slices and do not overlap. If <code>chunk_size</code> does not divide the length of the
slice, then the last up to <code>chunk_size-1</code> elements will be omitted and can be retrieved
from the <code>remainder</code> function of the iterator.</p>
<p>Due to each chunk having exactly <code>chunk_size</code> elements, the compiler can often optimize the
resulting code better than in the case of <a href="#method.chunks"><code>chunks</code></a>.</p>
<p>See <a href="#method.chunks"><code>chunks</code></a> for a variant of this iterator that also returns the remainder as a smaller
chunk, and <a href="#method.rchunks_exact"><code>rchunks_exact</code></a> for the same iterator but starting at the end of the slice.</p>
<h1 id="panics-2" class="section-header"><a href="#panics-2">Panics</a></h1>
<p>Panics if <code>chunk_size</code> is 0.</p>
<h1 id="examples-12" class="section-header"><a href="#examples-12">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">chunks_exact</span>(<span class="number">2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>]);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">is_none</span>());
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">remainder</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;m&#39;</span>]);</pre></div>
</div><h4 id="method.as_chunks_unchecked" class="method"><code>pub unsafe fn <a href="#method.as_chunks_unchecked" class="fnname">as_chunks_unchecked</a>&lt;const N:&nbsp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[</a>T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">; N]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></h3><code class="content"><span class="where fmt-newline">impl&lt;'_&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span><span class="where fmt-newline">impl&lt;'_&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span></code></span></div></span></span></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#919" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>slice_as_chunks</code>)</div></div><div class="docblock"><p>Splits the slice into a slice of <code>N</code>-element arrays,
assuming that there's no remainder.</p>
<h1 id="safety-1" class="section-header"><a href="#safety-1">Safety</a></h1>
<p>This may only be called when</p>
<ul>
<li>The slice splits exactly into <code>N</code>-element chunks (aka <code>self.len() % N == 0</code>).</li>
<li><code>N != 0</code>.</li>
</ul>
<h1 id="examples-13" class="section-header"><a href="#examples-13">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">slice_as_chunks</span>)]</span>
<span class="kw">let</span> <span class="ident">slice</span>: <span class="kw-2">&amp;</span>[<span class="ident">char</span>] <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>, <span class="string">&#39;!&#39;</span>];
<span class="kw">let</span> <span class="ident">chunks</span>: <span class="kw-2">&amp;</span>[[<span class="ident">char</span>; <span class="number">1</span>]] <span class="op">=</span>
<span class="comment">// SAFETY: 1-element chunks never have remainder</span>
<span class="kw">unsafe</span> { <span class="ident">slice</span>.<span class="ident">as_chunks_unchecked</span>() };
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">chunks</span>, <span class="kw-2">&amp;</span>[[<span class="string">&#39;l&#39;</span>], [<span class="string">&#39;o&#39;</span>], [<span class="string">&#39;r&#39;</span>], [<span class="string">&#39;e&#39;</span>], [<span class="string">&#39;m&#39;</span>], [<span class="string">&#39;!&#39;</span>]]);
<span class="kw">let</span> <span class="ident">chunks</span>: <span class="kw-2">&amp;</span>[[<span class="ident">char</span>; <span class="number">3</span>]] <span class="op">=</span>
<span class="comment">// SAFETY: The slice length (6) is a multiple of 3</span>
<span class="kw">unsafe</span> { <span class="ident">slice</span>.<span class="ident">as_chunks_unchecked</span>() };
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">chunks</span>, <span class="kw-2">&amp;</span>[[<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>], [<span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>, <span class="string">&#39;!&#39;</span>]]);
<span class="comment">// These would be unsound:</span>
<span class="comment">// let chunks: &amp;[[_; 5]] = slice.as_chunks_unchecked() // The slice length is not a multiple of 5</span>
<span class="comment">// let chunks: &amp;[[_; 0]] = slice.as_chunks_unchecked() // Zero-length chunks are never allowed</span></pre></div>
</div><h4 id="method.as_chunks" class="method"><code>pub fn <a href="#method.as_chunks" class="fnname">as_chunks</a>&lt;const N:&nbsp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[</a>T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">; N]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#950" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>slice_as_chunks</code>)</div></div><div class="docblock"><p>Splits the slice into a slice of <code>N</code>-element arrays,
starting at the beginning of the slice,
and a remainder slice with length strictly less than <code>N</code>.</p>
<h1 id="panics-3" class="section-header"><a href="#panics-3">Panics</a></h1>
<p>Panics if <code>N</code> is 0. This check will most probably get changed to a compile time
error before this method gets stabilized.</p>
<h1 id="examples-14" class="section-header"><a href="#examples-14">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">slice_as_chunks</span>)]</span>
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>];
<span class="kw">let</span> (<span class="ident">chunks</span>, <span class="ident">remainder</span>) <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">as_chunks</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">chunks</span>, <span class="kw-2">&amp;</span>[[<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>], [<span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>]]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">remainder</span>, <span class="kw-2">&amp;</span>[<span class="string">&#39;m&#39;</span>]);</pre></div>
</div><h4 id="method.as_rchunks" class="method"><code>pub fn <a href="#method.as_rchunks" class="fnname">as_rchunks</a>&lt;const N:&nbsp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">[</a>T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">; N]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#980" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>slice_as_chunks</code>)</div></div><div class="docblock"><p>Splits the slice into a slice of <code>N</code>-element arrays,
starting at the end of the slice,
and a remainder slice with length strictly less than <code>N</code>.</p>
<h1 id="panics-4" class="section-header"><a href="#panics-4">Panics</a></h1>
<p>Panics if <code>N</code> is 0. This check will most probably get changed to a compile time
error before this method gets stabilized.</p>
<h1 id="examples-15" class="section-header"><a href="#examples-15">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">slice_as_chunks</span>)]</span>
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>];
<span class="kw">let</span> (<span class="ident">remainder</span>, <span class="ident">chunks</span>) <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">as_rchunks</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">remainder</span>, <span class="kw-2">&amp;</span>[<span class="string">&#39;l&#39;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">chunks</span>, <span class="kw-2">&amp;</span>[[<span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>], [<span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>]]);</pre></div>
</div><h4 id="method.array_chunks" class="method"><code>pub fn <a href="#method.array_chunks" class="fnname">array_chunks</a>&lt;const N:&nbsp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.ArrayChunks.html" title="struct core::slice::iter::ArrayChunks">ArrayChunks</a>&lt;'_, T, N&gt;</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1019" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>array_chunks</code>)</div></div><div class="docblock"><p>Returns an iterator over <code>N</code> elements of the slice at a time, starting at the
beginning of the slice.</p>
<p>The chunks are array references and do not overlap. If <code>N</code> does not divide the
length of the slice, then the last up to <code>N-1</code> elements will be omitted and can be
retrieved from the <code>remainder</code> function of the iterator.</p>
<p>This method is the const generic equivalent of <a href="#method.chunks_exact"><code>chunks_exact</code></a>.</p>
<h1 id="panics-5" class="section-header"><a href="#panics-5">Panics</a></h1>
<p>Panics if <code>N</code> is 0. This check will most probably get changed to a compile time
error before this method gets stabilized.</p>
<h1 id="examples-16" class="section-header"><a href="#examples-16">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">array_chunks</span>)]</span>
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">array_chunks</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>]);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">is_none</span>());
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">remainder</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;m&#39;</span>]);</pre></div>
</div><h4 id="method.array_windows" class="method"><code>pub fn <a href="#method.array_windows" class="fnname">array_windows</a>&lt;const N:&nbsp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.ArrayWindows.html" title="struct core::slice::iter::ArrayWindows">ArrayWindows</a>&lt;'_, T, N&gt;</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1201" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>array_windows</code>)</div></div><div class="docblock"><p>Returns an iterator over overlapping windows of <code>N</code> elements of a slice,
starting at the beginning of the slice.</p>
<p>This is the const generic equivalent of <a href="#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>
<h1 id="panics-6" class="section-header"><a href="#panics-6">Panics</a></h1>
<p>Panics if <code>N</code> is 0. This check will most probably get changed to a compile time
error before this method gets stabilized.</p>
<h1 id="examples-17" class="section-header"><a href="#examples-17">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">array_windows</span>)]</span>
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">array_windows</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">2</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">2</span>, <span class="number">3</span>]);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">is_none</span>());</pre></div>
</div><h4 id="method.rchunks" class="method"><code>pub fn <a href="#method.rchunks" class="fnname">rchunks</a>(&amp;self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.RChunks.html" title="struct core::slice::iter::RChunks">RChunks</a>&lt;'_, T&gt;</code><span class="since" title="Stable since Rust version 1.31.0">1.31.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1235" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time, starting at the end
of the slice.</p>
<p>The chunks are slices and do not overlap. If <code>chunk_size</code> does not divide the length of the
slice, then the last chunk will not have length <code>chunk_size</code>.</p>
<p>See <a href="#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 <a href="#method.chunks"><code>chunks</code></a> for the same iterator but starting at the beginning
of the slice.</p>
<h1 id="panics-7" class="section-header"><a href="#panics-7">Panics</a></h1>
<p>Panics if <code>chunk_size</code> is 0.</p>
<h1 id="examples-18" class="section-header"><a href="#examples-18">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">rchunks</span>(<span class="number">2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;l&#39;</span>]);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">is_none</span>());</pre></div>
</div><h4 id="method.rchunks_exact" class="method"><code>pub fn <a href="#method.rchunks_exact" class="fnname">rchunks_exact</a>(&amp;self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.RChunksExact.html" title="struct core::slice::iter::RChunksExact">RChunksExact</a>&lt;'_, T&gt;</code><span class="since" title="Stable since Rust version 1.31.0">1.31.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1312" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time, starting at the
end of the slice.</p>
<p>The chunks are slices and do not overlap. If <code>chunk_size</code> does not divide the length of the
slice, then the last up to <code>chunk_size-1</code> elements will be omitted and can be retrieved
from the <code>remainder</code> function of the iterator.</p>
<p>Due to each chunk having exactly <code>chunk_size</code> elements, the compiler can often optimize the
resulting code better than in the case of <a href="#method.chunks"><code>chunks</code></a>.</p>
<p>See <a href="#method.rchunks"><code>rchunks</code></a> for a variant of this iterator that also returns the remainder as a smaller
chunk, and <a href="#method.chunks_exact"><code>chunks_exact</code></a> for the same iterator but starting at the beginning of the
slice.</p>
<h1 id="panics-8" class="section-header"><a href="#panics-8">Panics</a></h1>
<p>Panics if <code>chunk_size</code> is 0.</p>
<h1 id="examples-19" class="section-header"><a href="#examples-19">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="string">&#39;l&#39;</span>, <span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>, <span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">rchunks_exact</span>(<span class="number">2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;e&#39;</span>, <span class="string">&#39;m&#39;</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;o&#39;</span>, <span class="string">&#39;r&#39;</span>]);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">is_none</span>());
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">remainder</span>(), <span class="kw-2">&amp;</span>[<span class="string">&#39;l&#39;</span>]);</pre></div>
</div><h4 id="method.group_by" class="method"><code>pub fn <a href="#method.group_by" class="fnname">group_by</a>&lt;F&gt;(&amp;self, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.GroupBy.html" title="struct core::slice::iter::GroupBy">GroupBy</a>&lt;'_, T, F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,&nbsp;</span></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1398-1400" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>slice_group_by</code>)</div></div><div class="docblock"><p>Returns an iterator over the slice producing non-overlapping runs
of elements using the predicate to separate them.</p>
<p>The predicate is called on two elements following themselves,
it means the predicate is called on <code>slice[0]</code> and <code>slice[1]</code>
then on <code>slice[1]</code> and <code>slice[2]</code> and so on.</p>
<h1 id="examples-20" class="section-header"><a href="#examples-20">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">slice_group_by</span>)]</span>
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">2</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">group_by</span>(<span class="op">|</span><span class="ident">a</span>, <span class="ident">b</span><span class="op">|</span> <span class="ident">a</span> <span class="op">=</span><span class="op">=</span> <span class="ident">b</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>][..]));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">3</span>, <span class="number">3</span>][..]));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">2</span>, <span class="number">2</span>, <span class="number">2</span>][..]));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>(), <span class="prelude-val">None</span>);</pre></div>
<p>This method can be used to extract the sorted subslices:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">slice_group_by</span>)]</span>
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">group_by</span>(<span class="op">|</span><span class="ident">a</span>, <span class="ident">b</span><span class="op">|</span> <span class="ident">a</span> <span class="op">&lt;</span><span class="op">=</span> <span class="ident">b</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>][..]));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">2</span>, <span class="number">3</span>][..]));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>(), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>][..]));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>(), <span class="prelude-val">None</span>);</pre></div>
</div><h4 id="method.split_at" class="method"><code>pub fn <a href="#method.split_at" class="fnname">split_at</a>(&amp;self, mid: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1485" title="goto source code">[src]</a></h4><div class="docblock"><p>Divides one slice into two at an index.</p>
<p>The first will contain all indices from <code>[0, mid)</code> (excluding
the index <code>mid</code> itself) and the second will contain all
indices from <code>[mid, len)</code> (excluding the index <code>len</code> itself).</p>
<h1 id="panics-9" class="section-header"><a href="#panics-9">Panics</a></h1>
<p>Panics if <code>mid &gt; len</code>.</p>
<h1 id="examples-21" class="section-header"><a href="#examples-21">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>];
{
<span class="kw">let</span> (<span class="ident">left</span>, <span class="ident">right</span>) <span class="op">=</span> <span class="ident">v</span>.<span class="ident">split_at</span>(<span class="number">0</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">left</span>, []);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">right</span>, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
}
{
<span class="kw">let</span> (<span class="ident">left</span>, <span class="ident">right</span>) <span class="op">=</span> <span class="ident">v</span>.<span class="ident">split_at</span>(<span class="number">2</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">left</span>, [<span class="number">1</span>, <span class="number">2</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">right</span>, [<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
}
{
<span class="kw">let</span> (<span class="ident">left</span>, <span class="ident">right</span>) <span class="op">=</span> <span class="ident">v</span>.<span class="ident">split_at</span>(<span class="number">6</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">left</span>, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">right</span>, []);
}</pre></div>
</div><h4 id="method.split" class="method"><code>pub fn <a href="#method.split" class="fnname">split</a>&lt;F&gt;(&amp;self, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.Split.html" title="struct core::slice::iter::Split">Split</a>&lt;'_, T, F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1659-1661" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns an iterator over subslices separated by elements that match
<code>pred</code>. The matched element is not contained in the subslices.</p>
<h1 id="examples-22" class="section-header"><a href="#examples-22">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>, <span class="number">20</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">split</span>(<span class="op">|</span><span class="ident">num</span><span class="op">|</span> <span class="ident">num</span> <span class="op">%</span> <span class="number">3</span> <span class="op">=</span><span class="op">=</span> <span class="number">0</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">20</span>]);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">is_none</span>());</pre></div>
<p>If the first element is matched, an empty slice will be the first item
returned by the iterator. Similarly, if the last element in the slice
is matched, an empty slice will be the last item returned by the
iterator:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">split</span>(<span class="op">|</span><span class="ident">num</span><span class="op">|</span> <span class="ident">num</span> <span class="op">%</span> <span class="number">3</span> <span class="op">=</span><span class="op">=</span> <span class="number">0</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[]);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">is_none</span>());</pre></div>
<p>If two matched elements are directly adjacent, an empty slice will be
present between them:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">6</span>, <span class="number">33</span>, <span class="number">20</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">split</span>(<span class="op">|</span><span class="ident">num</span><span class="op">|</span> <span class="ident">num</span> <span class="op">%</span> <span class="number">3</span> <span class="op">=</span><span class="op">=</span> <span class="number">0</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">10</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">20</span>]);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">is_none</span>());</pre></div>
</div><h4 id="method.split_inclusive" class="method"><code>pub fn <a href="#method.split_inclusive" class="fnname">split_inclusive</a>&lt;F&gt;(&amp;self, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.SplitInclusive.html" title="struct core::slice::iter::SplitInclusive">SplitInclusive</a>&lt;'_, T, F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.51.0">1.51.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1717-1719" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns an iterator over subslices separated by elements that match
<code>pred</code>. The matched element is contained in the end of the previous
subslice as a terminator.</p>
<h1 id="examples-23" class="section-header"><a href="#examples-23">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>, <span class="number">20</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">split_inclusive</span>(<span class="op">|</span><span class="ident">num</span><span class="op">|</span> <span class="ident">num</span> <span class="op">%</span> <span class="number">3</span> <span class="op">=</span><span class="op">=</span> <span class="number">0</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">20</span>]);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">is_none</span>());</pre></div>
<p>If the last element of the slice is matched,
that element will be considered the terminator of the preceding slice.
That slice will be the last item returned by the iterator.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="number">3</span>, <span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">split_inclusive</span>(<span class="op">|</span><span class="ident">num</span><span class="op">|</span> <span class="ident">num</span> <span class="op">%</span> <span class="number">3</span> <span class="op">=</span><span class="op">=</span> <span class="number">0</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">3</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">33</span>]);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">is_none</span>());</pre></div>
</div><h4 id="method.rsplit" class="method"><code>pub fn <a href="#method.rsplit" class="fnname">rsplit</a>&lt;F&gt;(&amp;self, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.RSplit.html" title="struct core::slice::iter::RSplit">RSplit</a>&lt;'_, T, F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.27.0">1.27.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1777-1779" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns an iterator over subslices separated by elements that match
<code>pred</code>, starting at the end of the slice and working backwards.
The matched element is not contained in the subslices.</p>
<h1 id="examples-24" class="section-header"><a href="#examples-24">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="number">11</span>, <span class="number">22</span>, <span class="number">33</span>, <span class="number">0</span>, <span class="number">44</span>, <span class="number">55</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">iter</span> <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">rsplit</span>(<span class="op">|</span><span class="ident">num</span><span class="op">|</span> <span class="kw-2">*</span><span class="ident">num</span> <span class="op">=</span><span class="op">=</span> <span class="number">0</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">44</span>, <span class="number">55</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">11</span>, <span class="number">22</span>, <span class="number">33</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">iter</span>.<span class="ident">next</span>(), <span class="prelude-val">None</span>);</pre></div>
<p>As with <code>split()</code>, if the first or last element is matched, an empty
slice will be the first (or last) item returned by the iterator.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>];
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">it</span> <span class="op">=</span> <span class="ident">v</span>.<span class="ident">rsplit</span>(<span class="op">|</span><span class="ident">n</span><span class="op">|</span> <span class="kw-2">*</span><span class="ident">n</span> <span class="op">%</span> <span class="number">2</span> <span class="op">=</span><span class="op">=</span> <span class="number">0</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">it</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">it</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">3</span>, <span class="number">5</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">it</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[<span class="number">1</span>, <span class="number">1</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">it</span>.<span class="ident">next</span>().<span class="ident">unwrap</span>(), <span class="kw-2">&amp;</span>[]);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">it</span>.<span class="ident">next</span>(), <span class="prelude-val">None</span>);</pre></div>
</div><h4 id="method.splitn" class="method"><code>pub fn <a href="#method.splitn" class="fnname">splitn</a>&lt;F&gt;(&amp;self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.SplitN.html" title="struct core::slice::iter::SplitN">SplitN</a>&lt;'_, T, F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1831-1833" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns an iterator over subslices separated by elements that match
<code>pred</code>, limited to returning at most <code>n</code> items. The matched element is
not contained in the subslices.</p>
<p>The last element returned, if any, will contain the remainder of the
slice.</p>
<h1 id="examples-25" class="section-header"><a href="#examples-25">Examples</a></h1>
<p>Print the slice split once by numbers divisible by 3 (i.e., <code>[10, 40]</code>,
<code>[20, 60, 50]</code>):</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>, <span class="number">20</span>, <span class="number">60</span>, <span class="number">50</span>];
<span class="kw">for</span> <span class="ident">group</span> <span class="kw">in</span> <span class="ident">v</span>.<span class="ident">splitn</span>(<span class="number">2</span>, <span class="op">|</span><span class="ident">num</span><span class="op">|</span> <span class="kw-2">*</span><span class="ident">num</span> <span class="op">%</span> <span class="number">3</span> <span class="op">=</span><span class="op">=</span> <span class="number">0</span>) {
<span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{:?}&quot;</span>, <span class="ident">group</span>);
}</pre></div>
</div><h4 id="method.rsplitn" class="method"><code>pub fn <a href="#method.rsplitn" class="fnname">rsplitn</a>&lt;F&gt;(&amp;self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, pred: F) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/iter/struct.RSplitN.html" title="struct core::slice::iter::RSplitN">RSplitN</a>&lt;'_, T, F&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1886-1888" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns an iterator over subslices separated by elements that match
<code>pred</code> limited to returning at most <code>n</code> items. This starts at the end of
the slice and works backwards. The matched element is not contained in
the subslices.</p>
<p>The last element returned, if any, will contain the remainder of the
slice.</p>
<h1 id="examples-26" class="section-header"><a href="#examples-26">Examples</a></h1>
<p>Print the slice split once, starting from the end, by numbers divisible
by 3 (i.e., <code>[50]</code>, <code>[10, 40, 30, 20]</code>):</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>, <span class="number">20</span>, <span class="number">60</span>, <span class="number">50</span>];
<span class="kw">for</span> <span class="ident">group</span> <span class="kw">in</span> <span class="ident">v</span>.<span class="ident">rsplitn</span>(<span class="number">2</span>, <span class="op">|</span><span class="ident">num</span><span class="op">|</span> <span class="kw-2">*</span><span class="ident">num</span> <span class="op">%</span> <span class="number">3</span> <span class="op">=</span><span class="op">=</span> <span class="number">0</span>) {
<span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;{:?}&quot;</span>, <span class="ident">group</span>);
}</pre></div>
</div><h4 id="method.contains" class="method"><code>pub fn <a href="#method.contains" class="fnname">contains</a>(&amp;self, x: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;T&gt;,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1940-1942" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns <code>true</code> if the slice contains an element with the given value.</p>
<h1 id="examples-27" class="section-header"><a href="#examples-27">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">contains</span>(<span class="kw-2">&amp;</span><span class="number">30</span>));
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">v</span>.<span class="ident">contains</span>(<span class="kw-2">&amp;</span><span class="number">50</span>));</pre></div>
<p>If you do not have an <code>&amp;T</code>, but just an <code>&amp;U</code> such that <code>T: Borrow&lt;U&gt;</code>
(e.g. <code>String: Borrow&lt;str&gt;</code>), you can use <code>iter().any</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> [<span class="ident">String</span>::<span class="ident">from</span>(<span class="string">&quot;hello&quot;</span>), <span class="ident">String</span>::<span class="ident">from</span>(<span class="string">&quot;world&quot;</span>)]; <span class="comment">// slice of `String`</span>
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">iter</span>().<span class="ident">any</span>(<span class="op">|</span><span class="ident">e</span><span class="op">|</span> <span class="ident">e</span> <span class="op">=</span><span class="op">=</span> <span class="string">&quot;hello&quot;</span>)); <span class="comment">// search with `&amp;str`</span>
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">v</span>.<span class="ident">iter</span>().<span class="ident">any</span>(<span class="op">|</span><span class="ident">e</span><span class="op">|</span> <span class="ident">e</span> <span class="op">=</span><span class="op">=</span> <span class="string">&quot;hi&quot;</span>));</pre></div>
</div><h4 id="method.starts_with" class="method"><code>pub fn <a href="#method.starts_with" class="fnname">starts_with</a>(&amp;self, needle: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;T&gt;,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1968-1970" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns <code>true</code> if <code>needle</code> is a prefix of the slice.</p>
<h1 id="examples-28" class="section-header"><a href="#examples-28">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">starts_with</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>]));
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">starts_with</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]));
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">v</span>.<span class="ident">starts_with</span>(<span class="kw-2">&amp;</span>[<span class="number">50</span>]));
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">v</span>.<span class="ident">starts_with</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">50</span>]));</pre></div>
<p>Always returns <code>true</code> if <code>needle</code> is an empty slice:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">starts_with</span>(<span class="kw-2">&amp;</span>[]));
<span class="kw">let</span> <span class="ident">v</span>: <span class="kw-2">&amp;</span>[<span class="ident">u8</span>] <span class="op">=</span> <span class="kw-2">&amp;</span>[];
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">starts_with</span>(<span class="kw-2">&amp;</span>[]));</pre></div>
</div><h4 id="method.ends_with" class="method"><code>pub fn <a href="#method.ends_with" class="fnname">ends_with</a>(&amp;self, needle: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;T&gt;,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#1997-1999" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns <code>true</code> if <code>needle</code> is a suffix of the slice.</p>
<h1 id="examples-29" class="section-header"><a href="#examples-29">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">ends_with</span>(<span class="kw-2">&amp;</span>[<span class="number">30</span>]));
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">ends_with</span>(<span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>]));
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">v</span>.<span class="ident">ends_with</span>(<span class="kw-2">&amp;</span>[<span class="number">50</span>]));
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span><span class="ident">v</span>.<span class="ident">ends_with</span>(<span class="kw-2">&amp;</span>[<span class="number">50</span>, <span class="number">30</span>]));</pre></div>
<p>Always returns <code>true</code> if <code>needle</code> is an empty slice:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">ends_with</span>(<span class="kw-2">&amp;</span>[]));
<span class="kw">let</span> <span class="ident">v</span>: <span class="kw-2">&amp;</span>[<span class="ident">u8</span>] <span class="op">=</span> <span class="kw-2">&amp;</span>[];
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">ends_with</span>(<span class="kw-2">&amp;</span>[]));</pre></div>
</div><h4 id="method.strip_prefix" class="method"><code><span class="docblock attributes">#[must_use = "returns the subslice without modifying the original"]</span>pub fn <a href="#method.strip_prefix" class="fnname">strip_prefix</a>&lt;P&gt;(&amp;self, prefix: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>P) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a>&lt;Item = T&gt; + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.51.0">1.51.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#2027-2029" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a subslice with the prefix removed.</p>
<p>If the slice starts with <code>prefix</code>, returns the subslice after the prefix, wrapped in <code>Some</code>.
If <code>prefix</code> is empty, simply returns the original slice.</p>
<p>If the slice does not start with <code>prefix</code>, returns <code>None</code>.</p>
<h1 id="examples-30" class="section-header"><a href="#examples-30">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">strip_prefix</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>][..]));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">strip_prefix</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">30</span>][..]));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">strip_prefix</span>(<span class="kw-2">&amp;</span>[<span class="number">50</span>]), <span class="prelude-val">None</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">strip_prefix</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">50</span>]), <span class="prelude-val">None</span>);
<span class="kw">let</span> <span class="ident">prefix</span> : <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="string">&quot;he&quot;</span>;
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">b&quot;hello&quot;</span>.<span class="ident">strip_prefix</span>(<span class="ident">prefix</span>.<span class="ident">as_bytes</span>()),
<span class="prelude-val">Some</span>(<span class="string">b&quot;llo&quot;</span>.<span class="ident">as_ref</span>()));</pre></div>
</div><h4 id="method.strip_suffix" class="method"><code><span class="docblock attributes">#[must_use = "returns the subslice without modifying the original"]</span>pub fn <a href="#method.strip_suffix" class="fnname">strip_suffix</a>&lt;P&gt;(&amp;self, suffix: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>P) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;T&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/trait.SlicePattern.html" title="trait core::slice::SlicePattern">SlicePattern</a>&lt;Item = T&gt; + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.51.0">1.51.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#2061-2063" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a subslice with the suffix removed.</p>
<p>If the slice ends with <code>suffix</code>, returns the subslice before the suffix, wrapped in <code>Some</code>.
If <code>suffix</code> is empty, simply returns the original slice.</p>
<p>If the slice does not end with <code>suffix</code>, returns <code>None</code>.</p>
<h1 id="examples-31" class="section-header"><a href="#examples-31">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> <span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">strip_suffix</span>(<span class="kw-2">&amp;</span>[<span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>, <span class="number">40</span>][..]));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">strip_suffix</span>(<span class="kw-2">&amp;</span>[<span class="number">40</span>, <span class="number">30</span>]), <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>[<span class="number">10</span>][..]));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">strip_suffix</span>(<span class="kw-2">&amp;</span>[<span class="number">50</span>]), <span class="prelude-val">None</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">strip_suffix</span>(<span class="kw-2">&amp;</span>[<span class="number">50</span>, <span class="number">30</span>]), <span class="prelude-val">None</span>);</pre></div>
</div><h4 id="method.binary_search" class="method"><code>pub fn <a href="#method.binary_search" class="fnname">binary_search</a>(&amp;self, x: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#2112-2114" title="goto source code">[src]</a></h4><div class="docblock"><p>Binary searches this sorted slice for a given element.</p>
<p>If the value is found then <a href="https://doc.rust-lang.org/nightly/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. If the value is not found then
<a href="https://doc.rust-lang.org/nightly/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>
<h1 id="examples-32" class="section-header"><a href="#examples-32">Examples</a></h1>
<p>Looks up a series of four elements. The first is found, with a
uniquely determined position; the second and third are not
found; the fourth could match any position in <code>[1, 4]</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">s</span> <span class="op">=</span> [<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">55</span>];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">binary_search</span>(<span class="kw-2">&amp;</span><span class="number">13</span>), <span class="prelude-val">Ok</span>(<span class="number">9</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">binary_search</span>(<span class="kw-2">&amp;</span><span class="number">4</span>), <span class="prelude-val">Err</span>(<span class="number">7</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">binary_search</span>(<span class="kw-2">&amp;</span><span class="number">100</span>), <span class="prelude-val">Err</span>(<span class="number">13</span>));
<span class="kw">let</span> <span class="ident">r</span> <span class="op">=</span> <span class="ident">s</span>.<span class="ident">binary_search</span>(<span class="kw-2">&amp;</span><span class="number">1</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="kw">match</span> <span class="ident">r</span> { <span class="prelude-val">Ok</span>(<span class="number">1</span>..<span class="op">=</span><span class="number">4</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="bool-val">true</span>, <span class="kw">_</span> <span class="op">=</span><span class="op">&gt;</span> <span class="bool-val">false</span>, });</pre></div>
<p>If you want to insert an item to a sorted vector, while maintaining
sort order:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">s</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">55</span>];
<span class="kw">let</span> <span class="ident">num</span> <span class="op">=</span> <span class="number">42</span>;
<span class="kw">let</span> <span class="ident">idx</span> <span class="op">=</span> <span class="ident">s</span>.<span class="ident">binary_search</span>(<span class="kw-2">&amp;</span><span class="ident">num</span>).<span class="ident">unwrap_or_else</span>(<span class="op">|</span><span class="ident">x</span><span class="op">|</span> <span class="ident">x</span>);
<span class="ident">s</span>.<span class="ident">insert</span>(<span class="ident">idx</span>, <span class="ident">num</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">s</span>, [<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">42</span>, <span class="number">55</span>]);</pre></div>
</div><h4 id="method.binary_search_by" class="method"><code>pub fn <a href="#method.binary_search_by" class="fnname">binary_search_by</a>&lt;'a, F&gt;(&amp;'a self, f: F) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>T) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#2153-2155" title="goto source code">[src]</a></h4><div class="docblock"><p>Binary searches this sorted slice with a comparator function.</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 <a href="https://doc.rust-lang.org/nightly/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. If the value is not found then
<a href="https://doc.rust-lang.org/nightly/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>
<h1 id="examples-33" class="section-header"><a href="#examples-33">Examples</a></h1>
<p>Looks up a series of four elements. The first is found, with a
uniquely determined position; the second and third are not
found; the fourth could match any position in <code>[1, 4]</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">s</span> <span class="op">=</span> [<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>, <span class="number">13</span>, <span class="number">21</span>, <span class="number">34</span>, <span class="number">55</span>];
<span class="kw">let</span> <span class="ident">seek</span> <span class="op">=</span> <span class="number">13</span>;
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">binary_search_by</span>(<span class="op">|</span><span class="ident">probe</span><span class="op">|</span> <span class="ident">probe</span>.<span class="ident">cmp</span>(<span class="kw-2">&amp;</span><span class="ident">seek</span>)), <span class="prelude-val">Ok</span>(<span class="number">9</span>));
<span class="kw">let</span> <span class="ident">seek</span> <span class="op">=</span> <span class="number">4</span>;
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">binary_search_by</span>(<span class="op">|</span><span class="ident">probe</span><span class="op">|</span> <span class="ident">probe</span>.<span class="ident">cmp</span>(<span class="kw-2">&amp;</span><span class="ident">seek</span>)), <span class="prelude-val">Err</span>(<span class="number">7</span>));
<span class="kw">let</span> <span class="ident">seek</span> <span class="op">=</span> <span class="number">100</span>;
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">binary_search_by</span>(<span class="op">|</span><span class="ident">probe</span><span class="op">|</span> <span class="ident">probe</span>.<span class="ident">cmp</span>(<span class="kw-2">&amp;</span><span class="ident">seek</span>)), <span class="prelude-val">Err</span>(<span class="number">13</span>));
<span class="kw">let</span> <span class="ident">seek</span> <span class="op">=</span> <span class="number">1</span>;
<span class="kw">let</span> <span class="ident">r</span> <span class="op">=</span> <span class="ident">s</span>.<span class="ident">binary_search_by</span>(<span class="op">|</span><span class="ident">probe</span><span class="op">|</span> <span class="ident">probe</span>.<span class="ident">cmp</span>(<span class="kw-2">&amp;</span><span class="ident">seek</span>));
<span class="macro">assert</span><span class="macro">!</span>(<span class="kw">match</span> <span class="ident">r</span> { <span class="prelude-val">Ok</span>(<span class="number">1</span>..<span class="op">=</span><span class="number">4</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="bool-val">true</span>, <span class="kw">_</span> <span class="op">=</span><span class="op">&gt;</span> <span class="bool-val">false</span>, });</pre></div>
</div><h4 id="method.binary_search_by_key" class="method"><code>pub fn <a href="#method.binary_search_by_key" class="fnname">binary_search_by_key</a>&lt;'a, B, F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;'a self, <br>&nbsp;&nbsp;&nbsp;&nbsp;b: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>B, <br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a </a>T) -&gt; B,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.10.0">1.10.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#2211-2214" title="goto source code">[src]</a></h4><div class="docblock"><p>Binary searches this sorted slice with a key extraction function.</p>
<p>Assumes that the slice is sorted by the key, for instance with
<a href="#method.sort_by_key"><code>sort_by_key</code></a> using the same key extraction function.</p>
<p>If the value is found then <a href="https://doc.rust-lang.org/nightly/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. If the value is not found then
<a href="https://doc.rust-lang.org/nightly/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>
<h1 id="examples-34" class="section-header"><a href="#examples-34">Examples</a></h1>
<p>Looks up a series of four elements in a slice of pairs sorted by
their second elements. The first is found, with a uniquely
determined position; the second and third are not found; the
fourth could match any position in <code>[1, 4]</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">s</span> <span class="op">=</span> [(<span class="number">0</span>, <span class="number">0</span>), (<span class="number">2</span>, <span class="number">1</span>), (<span class="number">4</span>, <span class="number">1</span>), (<span class="number">5</span>, <span class="number">1</span>), (<span class="number">3</span>, <span class="number">1</span>),
(<span class="number">1</span>, <span class="number">2</span>), (<span class="number">2</span>, <span class="number">3</span>), (<span class="number">4</span>, <span class="number">5</span>), (<span class="number">5</span>, <span class="number">8</span>), (<span class="number">3</span>, <span class="number">13</span>),
(<span class="number">1</span>, <span class="number">21</span>), (<span class="number">2</span>, <span class="number">34</span>), (<span class="number">4</span>, <span class="number">55</span>)];
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">binary_search_by_key</span>(<span class="kw-2">&amp;</span><span class="number">13</span>, <span class="op">|</span><span class="kw-2">&amp;</span>(<span class="ident">a</span>, <span class="ident">b</span>)<span class="op">|</span> <span class="ident">b</span>), <span class="prelude-val">Ok</span>(<span class="number">9</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">binary_search_by_key</span>(<span class="kw-2">&amp;</span><span class="number">4</span>, <span class="op">|</span><span class="kw-2">&amp;</span>(<span class="ident">a</span>, <span class="ident">b</span>)<span class="op">|</span> <span class="ident">b</span>), <span class="prelude-val">Err</span>(<span class="number">7</span>));
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">s</span>.<span class="ident">binary_search_by_key</span>(<span class="kw-2">&amp;</span><span class="number">100</span>, <span class="op">|</span><span class="kw-2">&amp;</span>(<span class="ident">a</span>, <span class="ident">b</span>)<span class="op">|</span> <span class="ident">b</span>), <span class="prelude-val">Err</span>(<span class="number">13</span>));
<span class="kw">let</span> <span class="ident">r</span> <span class="op">=</span> <span class="ident">s</span>.<span class="ident">binary_search_by_key</span>(<span class="kw-2">&amp;</span><span class="number">1</span>, <span class="op">|</span><span class="kw-2">&amp;</span>(<span class="ident">a</span>, <span class="ident">b</span>)<span class="op">|</span> <span class="ident">b</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="kw">match</span> <span class="ident">r</span> { <span class="prelude-val">Ok</span>(<span class="number">1</span>..<span class="op">=</span><span class="number">4</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="bool-val">true</span>, <span class="kw">_</span> <span class="op">=</span><span class="op">&gt;</span> <span class="bool-val">false</span>, });</pre></div>
</div><h4 id="method.align_to" class="method"><code>pub unsafe fn <a href="#method.align_to" class="fnname">align_to</a>&lt;U&gt;(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[U]</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[T]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><span class="since" title="Stable since Rust version 1.30.0">1.30.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#3222" title="goto source code">[src]</a></h4><div class="docblock"><p>Transmute the slice to a slice of another type, ensuring alignment of the types is
maintained.</p>
<p>This method splits the slice into three distinct slices: prefix, correctly aligned middle
slice of a new type, and the suffix slice. The method may make the middle slice the greatest
length possible for a given type and input slice, but only your algorithm's performance
should depend on that, not its correctness. It is permissible for all of the input data to
be returned as the prefix or suffix slice.</p>
<p>This method has no purpose when either input element <code>T</code> or output element <code>U</code> are
zero-sized and will return the original slice without splitting anything.</p>
<h1 id="safety-2" class="section-header"><a href="#safety-2">Safety</a></h1>
<p>This method is essentially a <code>transmute</code> with respect to the elements in the returned
middle slice, so all the usual caveats pertaining to <code>transmute::&lt;T, U&gt;</code> also apply here.</p>
<h1 id="examples-35" class="section-header"><a href="#examples-35">Examples</a></h1>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">unsafe</span> {
<span class="kw">let</span> <span class="ident">bytes</span>: [<span class="ident">u8</span>; <span class="number">7</span>] <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>];
<span class="kw">let</span> (<span class="ident">prefix</span>, <span class="ident">shorts</span>, <span class="ident">suffix</span>) <span class="op">=</span> <span class="ident">bytes</span>.<span class="ident">align_to</span>::<span class="op">&lt;</span><span class="ident">u16</span><span class="op">&gt;</span>();
<span class="comment">// less_efficient_algorithm_for_bytes(prefix);</span>
<span class="comment">// more_efficient_algorithm_for_aligned_shorts(shorts);</span>
<span class="comment">// less_efficient_algorithm_for_bytes(suffix);</span>
}</pre></div>
</div><h4 id="method.is_sorted" class="method"><code>pub fn <a href="#method.is_sorted" class="fnname">is_sorted</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;T&gt;,&nbsp;</span></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#3342-3344" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>is_sorted</code>)</summary><p>new API</p>
</details></div></div><div class="docblock"><p>Checks if the elements of this slice are sorted.</p>
<p>That is, for each element <code>a</code> and its following element <code>b</code>, <code>a &lt;= b</code> must hold. If the
slice yields exactly zero or one element, <code>true</code> is returned.</p>
<p>Note that if <code>Self::Item</code> is only <code>PartialOrd</code>, but not <code>Ord</code>, the above definition
implies that this function returns <code>false</code> if any two consecutive items are not
comparable.</p>
<h1 id="examples-36" class="section-header"><a href="#examples-36">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">is_sorted</span>)]</span>
<span class="kw">let</span> <span class="ident">empty</span>: [<span class="ident">i32</span>; <span class="number">0</span>] <span class="op">=</span> [];
<span class="macro">assert</span><span class="macro">!</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">9</span>].<span class="ident">is_sorted</span>());
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span>[<span class="number">1</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">4</span>].<span class="ident">is_sorted</span>());
<span class="macro">assert</span><span class="macro">!</span>([<span class="number">0</span>].<span class="ident">is_sorted</span>());
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">empty</span>.<span class="ident">is_sorted</span>());
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span>[<span class="number">0.0</span>, <span class="number">1.0</span>, <span class="ident">f32</span>::<span class="ident">NAN</span>].<span class="ident">is_sorted</span>());</pre></div>
</div><h4 id="method.is_sorted_by" class="method"><code>pub fn <a href="#method.is_sorted_by" class="fnname">is_sorted_by</a>&lt;F&gt;(&amp;self, compare: F) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;,&nbsp;</span></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#3357-3359" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>is_sorted</code>)</summary><p>new API</p>
</details></div></div><div class="docblock"><p>Checks if the elements of this slice are sorted using the given comparator function.</p>
<p>Instead of using <code>PartialOrd::partial_cmp</code>, this function uses the given <code>compare</code>
function to determine the ordering of two elements. Apart from that, it's equivalent to
<a href="#method.is_sorted"><code>is_sorted</code></a>; see its documentation for more information.</p>
</div><h4 id="method.is_sorted_by_key" class="method"><code>pub fn <a href="#method.is_sorted_by_key" class="fnname">is_sorted_by_key</a>&lt;F, K&gt;(&amp;self, f: F) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;K&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T) -&gt; K,&nbsp;</span></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#3382-3385" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>is_sorted</code>)</summary><p>new API</p>
</details></div></div><div class="docblock"><p>Checks if the elements of this slice are sorted using the given key extraction function.</p>
<p>Instead of comparing the slice's elements directly, this function compares the keys of the
elements, as determined by <code>f</code>. Apart from that, it's equivalent to <a href="#method.is_sorted"><code>is_sorted</code></a>; see its
documentation for more information.</p>
<h1 id="examples-37" class="section-header"><a href="#examples-37">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">is_sorted</span>)]</span>
<span class="macro">assert</span><span class="macro">!</span>([<span class="string">&quot;c&quot;</span>, <span class="string">&quot;bb&quot;</span>, <span class="string">&quot;aaa&quot;</span>].<span class="ident">is_sorted_by_key</span>(<span class="op">|</span><span class="ident">s</span><span class="op">|</span> <span class="ident">s</span>.<span class="ident">len</span>()));
<span class="macro">assert</span><span class="macro">!</span>(<span class="op">!</span>[<span class="op">-</span><span class="number">2i32</span>, <span class="op">-</span><span class="number">1</span>, <span class="number">0</span>, <span class="number">3</span>].<span class="ident">is_sorted_by_key</span>(<span class="op">|</span><span class="ident">n</span><span class="op">|</span> <span class="ident">n</span>.<span class="ident">abs</span>()));</pre></div>
</div><h4 id="method.partition_point" class="method"><code>pub fn <a href="#method.partition_point" class="fnname">partition_point</a>&lt;P&gt;(&amp;self, pred: P) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,&nbsp;</span></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/mod.rs.html#3415-3417" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>partition_point</code>)</summary><p>new API</p>
</details></div></div><div class="docblock"><p>Returns the index of the partition point according to the given predicate
(the index of the first element of the second partition).</p>
<p>The slice is assumed to be partitioned according to the given predicate.
This means that all elements for which the predicate returns true are at the start of the slice
and all elements for which the predicate returns false are at the end.
For example, [7, 15, 3, 5, 4, 12, 6] is a partitioned under the predicate x % 2 != 0
(all odd numbers are at the start, all even at the end).</p>
<p>If this slice is not partitioned, the returned result is unspecified and meaningless,
as this method performs a kind of binary search.</p>
<h1 id="examples-38" class="section-header"><a href="#examples-38">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">partition_point</span>)]</span>
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>];
<span class="kw">let</span> <span class="ident">i</span> <span class="op">=</span> <span class="ident">v</span>.<span class="ident">partition_point</span>(<span class="op">|</span><span class="kw-2">&amp;</span><span class="ident">x</span><span class="op">|</span> <span class="ident">x</span> <span class="op">&lt;</span> <span class="number">5</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">i</span>, <span class="number">4</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>[..<span class="ident">i</span>].<span class="ident">iter</span>().<span class="ident">all</span>(<span class="op">|</span><span class="kw-2">&amp;</span><span class="ident">x</span><span class="op">|</span> <span class="ident">x</span> <span class="op">&lt;</span> <span class="number">5</span>));
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>[<span class="ident">i</span>..].<span class="ident">iter</span>().<span class="ident">all</span>(<span class="op">|</span><span class="kw-2">&amp;</span><span class="ident">x</span><span class="op">|</span> <span class="op">!</span>(<span class="ident">x</span> <span class="op">&lt;</span> <span class="number">5</span>)));</pre></div>
</div></div><div class="impl-items"><h4 id="method.is_ascii" class="method"><code>pub fn <a href="#method.is_ascii" class="fnname">is_ascii</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class="since" title="Stable since Rust version 1.23.0">1.23.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/ascii.rs.html#11" title="goto source code">[src]</a></h4><div class="docblock"><p>Checks if all bytes in this slice are within the ASCII range.</p>
</div><h4 id="method.eq_ignore_ascii_case" class="method"><code>pub fn <a href="#method.eq_ignore_ascii_case" class="fnname">eq_ignore_ascii_case</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class="since" title="Stable since Rust version 1.23.0">1.23.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/slice/ascii.rs.html#21" title="goto source code">[src]</a></h4><div class="docblock"><p>Checks that two slices are an ASCII case-insensitive match.</p>
<p>Same as <code>to_ascii_lowercase(a) == to_ascii_lowercase(b)</code>,
but without allocating and copying temporaries.</p>
</div></div><div class="impl-items"><h4 id="method.to_vec" class="method"><code>pub fn <a href="#method.to_vec" class="fnname">to_vec</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#447-449" title="goto source code">[src]</a></h4><div class="docblock"><p>Copies <code>self</code> into a new <code>Vec</code>.</p>
<h1 id="examples-39" class="section-header"><a href="#examples-39">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">s</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="ident">s</span>.<span class="ident">to_vec</span>();
<span class="comment">// Here, `s` and `x` can be modified independently.</span></pre></div>
</div><h4 id="method.to_vec_in" class="method"><code>pub fn <a href="#method.to_vec_in" class="fnname">to_vec_in</a>&lt;A&gt;(&amp;self, alloc: A) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;T, A&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;A: <a class="trait" href="https://doc.rust-lang.org/nightly/core/alloc/trait.Allocator.html" title="trait core::alloc::Allocator">Allocator</a>,&nbsp;</span></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#469-471" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>allocator_api</code>)</div></div><div class="docblock"><p>Copies <code>self</code> into a new <code>Vec</code> with an allocator.</p>
<h1 id="examples-40" class="section-header"><a href="#examples-40">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">allocator_api</span>)]</span>
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">alloc</span>::<span class="ident">System</span>;
<span class="kw">let</span> <span class="ident">s</span> <span class="op">=</span> [<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="ident">s</span>.<span class="ident">to_vec_in</span>(<span class="ident">System</span>);
<span class="comment">// Here, `s` and `x` can be modified independently.</span></pre></div>
</div><h4 id="method.repeat" class="method"><code>pub fn <a href="#method.repeat" class="fnname">repeat</a>(&amp;self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;T, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.40.0">1.40.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#519-521" title="goto source code">[src]</a></h4><div class="docblock"><p>Creates a vector by repeating a slice <code>n</code> times.</p>
<h1 id="panics-10" class="section-header"><a href="#panics-10">Panics</a></h1>
<p>This function will panic if the capacity would overflow.</p>
<h1 id="examples-41" class="section-header"><a href="#examples-41">Examples</a></h1>
<p>Basic usage:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>([<span class="number">1</span>, <span class="number">2</span>].<span class="ident">repeat</span>(<span class="number">3</span>), <span class="macro">vec</span><span class="macro">!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">2</span>]);</pre></div>
<p>A panic upon overflow:</p>
<div class='information'><div class='tooltip should_panic'></div></div><div class="example-wrap"><pre class="rust rust-example-rendered should_panic">
<span class="comment">// this will panic at runtime</span>
<span class="string">b&quot;0123456789abcdef&quot;</span>.<span class="ident">repeat</span>(<span class="ident">usize</span>::<span class="ident">MAX</span>);</pre></div>
</div><h4 id="method.concat" class="method"><code>pub fn <a href="#method.concat" class="fnname">concat</a>&lt;Item&gt;(&amp;self) -&gt; &lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a>T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a> as <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/slice/trait.Concat.html" title="trait alloc::slice::Concat">Concat</a>&lt;Item&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/alloc/slice/trait.Concat.html#associatedtype.Output" title="type alloc::slice::Concat::Output">Output</a><span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></h3><code class="content"><span class="where fmt-newline">impl&lt;'_&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span><span class="where fmt-newline">impl&lt;'_&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span></code></span></div></span></span> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Item: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a>T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/slice/trait.Concat.html" title="trait alloc::slice::Concat">Concat</a>&lt;Item&gt;,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#586-588" title="goto source code">[src]</a></h4><div class="docblock"><p>Flattens a slice of <code>T</code> into a single value <code>Self::Output</code>.</p>
<h1 id="examples-42" class="section-header"><a href="#examples-42">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>([<span class="string">&quot;hello&quot;</span>, <span class="string">&quot;world&quot;</span>].<span class="ident">concat</span>(), <span class="string">&quot;helloworld&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>([[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]].<span class="ident">concat</span>(), [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);</pre></div>
</div><h4 id="method.join" class="method"><code>pub fn <a href="#method.join" class="fnname">join</a>&lt;Separator&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;sep: Separator<br>) -&gt; &lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a>T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a> as <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a>&lt;Separator&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/alloc/slice/trait.Join.html#associatedtype.Output" title="type alloc::slice::Join::Output">Output</a><span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></h3><code class="content"><span class="where fmt-newline">impl&lt;'_&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span><span class="where fmt-newline">impl&lt;'_&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span></code></span></div></span></span> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a>T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a>&lt;Separator&gt;,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#604-606" title="goto source code">[src]</a></h4><div class="docblock"><p>Flattens a slice of <code>T</code> into a single value <code>Self::Output</code>, placing a
given separator between each.</p>
<h1 id="examples-43" class="section-header"><a href="#examples-43">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>([<span class="string">&quot;hello&quot;</span>, <span class="string">&quot;world&quot;</span>].<span class="ident">join</span>(<span class="string">&quot; &quot;</span>), <span class="string">&quot;hello world&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>([[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]].<span class="ident">join</span>(<span class="kw-2">&amp;</span><span class="number">0</span>), [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">4</span>]);
<span class="macro">assert_eq</span><span class="macro">!</span>([[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]].<span class="ident">join</span>(<span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">0</span>][..]), [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">4</span>]);</pre></div>
</div><h4 id="method.connect" class="method"><code>pub fn <a href="#method.connect" class="fnname">connect</a>&lt;Separator&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;sep: Separator<br>) -&gt; &lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a>T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a> as <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a>&lt;Separator&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/alloc/slice/trait.Join.html#associatedtype.Output" title="type alloc::slice::Join::Output">Output</a><span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></h3><code class="content"><span class="where fmt-newline">impl&lt;'_&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span><span class="where fmt-newline">impl&lt;'_&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span></code></span></div></span></span> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a>T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/slice/trait.Join.html" title="trait alloc::slice::Join">Join</a>&lt;Separator&gt;,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#623-625" title="goto source code">[src]</a></h4><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.3.0: <p>renamed to join</p>
</div></div><div class="docblock"><p>Flattens a slice of <code>T</code> into a single value <code>Self::Output</code>, placing a
given separator between each.</p>
<h1 id="examples-44" class="section-header"><a href="#examples-44">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="macro">assert_eq</span><span class="macro">!</span>([<span class="string">&quot;hello&quot;</span>, <span class="string">&quot;world&quot;</span>].<span class="ident">connect</span>(<span class="string">&quot; &quot;</span>), <span class="string">&quot;hello world&quot;</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>([[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]].<span class="ident">connect</span>(<span class="kw-2">&amp;</span><span class="number">0</span>), [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">4</span>]);</pre></div>
</div></div><div class="impl-items"><h4 id="method.to_ascii_uppercase" class="method"><code>pub fn <a href="#method.to_ascii_uppercase" class="fnname">to_ascii_uppercase</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;</code><span class="since" title="Stable since Rust version 1.23.0">1.23.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#645" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a vector containing a copy of this slice where each byte
is mapped to its ASCII upper case equivalent.</p>
<p>ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
but non-ASCII letters are unchanged.</p>
<p>To uppercase the value in-place, use <a href="https://doc.rust-lang.org/nightly/std/primitive.u8.html#method.make_ascii_uppercase"><code>make_ascii_uppercase</code></a>.</p>
</div><h4 id="method.to_ascii_lowercase" class="method"><code>pub fn <a href="#method.to_ascii_lowercase" class="fnname">to_ascii_lowercase</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;</code><span class="since" title="Stable since Rust version 1.23.0">1.23.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#662" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a vector containing a copy of this slice where each byte
is mapped to its ASCII lower case equivalent.</p>
<p>ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
but non-ASCII letters are unchanged.</p>
<p>To lowercase the value in-place, use <a href="https://doc.rust-lang.org/nightly/std/primitive.u8.html#method.make_ascii_lowercase"><code>make_ascii_lowercase</code></a>.</p>
</div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-CFPropertyListSubClass" class="impl"><code class="in-band">impl <a class="trait" href="../../core_foundation/propertylist/trait.CFPropertyListSubClass.html" title="trait core_foundation::propertylist::CFPropertyListSubClass">CFPropertyListSubClass</a> for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-CFPropertyListSubClass" class="anchor"></a><a class="srclink" href="../../src/core_foundation/propertylist.rs.html#87" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.to_CFPropertyList" class="method hidden"><code>fn <a href="../../core_foundation/propertylist/trait.CFPropertyListSubClass.html#method.to_CFPropertyList" class="fnname">to_CFPropertyList</a>(&amp;self) -&gt; <a class="struct" href="../../core_foundation/propertylist/struct.CFPropertyList.html" title="struct core_foundation::propertylist::CFPropertyList">CFPropertyList</a></code><a class="srclink" href="../../src/core_foundation/propertylist.rs.html#69-71" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Create an instance of the superclass type <a href="struct.CFPropertyList.html"><code>CFPropertyList</code></a> for this instance. <a href="../../core_foundation/propertylist/trait.CFPropertyListSubClass.html#method.to_CFPropertyList">Read more</a></p>
</div><h4 id="method.into_CFPropertyList" class="method hidden"><code>fn <a href="../../core_foundation/propertylist/trait.CFPropertyListSubClass.html#method.into_CFPropertyList" class="fnname">into_CFPropertyList</a>(self) -&gt; <a class="struct" href="../../core_foundation/propertylist/struct.CFPropertyList.html" title="struct core_foundation::propertylist::CFPropertyList">CFPropertyList</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a class="srclink" href="../../src/core_foundation/propertylist.rs.html#77-84" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Equal to <a href="#method.to_CFPropertyList"><code>to_CFPropertyList</code></a>, but consumes self and avoids changing the reference count. <a href="../../core_foundation/propertylist/trait.CFPropertyListSubClass.html#method.into_CFPropertyList">Read more</a></p>
</div></div><h3 id="impl-Clone" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.clone" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&amp;self) -&gt; <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id="method.clone_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#128" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id="impl-ConcreteCFType" class="impl"><code class="in-band">impl <a class="trait" href="../../core_foundation/trait.ConcreteCFType.html" title="trait core_foundation::ConcreteCFType">ConcreteCFType</a> for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-ConcreteCFType" class="anchor"></a><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/core_foundation/data.rs.html#26" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../src/core_foundation/data.rs.html#26" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div><h3 id="impl-Deref" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-Deref" class="anchor"></a><a class="srclink" href="../../src/core_foundation/data.rs.html#56-63" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Target" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" class="type">Target</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></code></h4><div class='docblock'><p>The resulting type after dereferencing.</p>
</div><h4 id="method.deref" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#tymethod.deref" class="fnname">deref</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></h3><code class="content"><span class="where fmt-newline">impl&lt;'_&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span><span class="where fmt-newline">impl&lt;'_&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;'_ mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></span></code></span></div></span></span></code><a class="srclink" href="../../src/core_foundation/data.rs.html#60-62" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Dereferences the value.</p>
</div></div><h3 id="impl-Drop" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-Drop" class="anchor"></a><a class="srclink" href="../../src/core_foundation/data.rs.html#21-24" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.drop" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop" class="fnname">drop</a>(&amp;mut self)</code><a class="srclink" href="../../src/core_foundation/data.rs.html#21-24" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Executes the destructor for this type. <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></p>
</div></div><h3 id="impl-Eq" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-Eq" class="anchor"></a><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-PartialEq%3CCFData%3E" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a>&gt; for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-PartialEq%3CCFData%3E" class="anchor"></a><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.eq" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq" class="fnname">eq</a>(&amp;self, other: &amp;<a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
by <code>==</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id="method.ne" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne" class="fnname">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#213" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>!=</code>.</p>
</div></div><h3 id="impl-TCFType" class="impl"><code class="in-band">impl <a class="trait" href="../../core_foundation/base/trait.TCFType.html" title="trait core_foundation::base::TCFType">TCFType</a> for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-TCFType" class="anchor"></a><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Ref" class="type"><code>type <a href="../../core_foundation/base/trait.TCFType.html#associatedtype.Ref" class="type">Ref</a> = <a class="type" href="../../core_foundation/data/type.CFDataRef.html" title="type core_foundation::data::CFDataRef">CFDataRef</a></code></h4><div class='docblock'><p>The reference type wrapped inside this type.</p>
</div><h4 id="method.as_concrete_TypeRef" class="method hidden"><code>fn <a href="../../core_foundation/base/trait.TCFType.html#tymethod.as_concrete_TypeRef" class="fnname">as_concrete_TypeRef</a>(&amp;self) -&gt; <a class="type" href="../../core_foundation/data/type.CFDataRef.html" title="type core_foundation::data::CFDataRef">CFDataRef</a></code><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the object as its concrete TypeRef.</p>
</div><h4 id="method.wrap_under_get_rule" class="method hidden"><code>unsafe fn <a href="../../core_foundation/base/trait.TCFType.html#tymethod.wrap_under_get_rule" class="fnname">wrap_under_get_rule</a>(reference: <a class="type" href="../../core_foundation/data/type.CFDataRef.html" title="type core_foundation::data::CFDataRef">CFDataRef</a>) -&gt; Self</code><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns an instance of the object, wrapping the underlying <code>CFTypeRef</code> subclass. Use this
when following Core Foundation's &quot;Get Rule&quot;. The reference count <em>is</em> bumped. <a href="../../core_foundation/base/trait.TCFType.html#tymethod.wrap_under_get_rule">Read more</a></p>
</div><h4 id="method.as_CFTypeRef" class="method hidden"><code>fn <a href="../../core_foundation/base/trait.TCFType.html#tymethod.as_CFTypeRef" class="fnname">as_CFTypeRef</a>(&amp;self) -&gt; <a class="type" href="../../core_foundation/base/type.CFTypeRef.html" title="type core_foundation::base::CFTypeRef">CFTypeRef</a></code><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the object as a raw <code>CFTypeRef</code>. The reference count is not adjusted.</p>
</div><h4 id="method.wrap_under_create_rule" class="method hidden"><code>unsafe fn <a href="../../core_foundation/base/trait.TCFType.html#tymethod.wrap_under_create_rule" class="fnname">wrap_under_create_rule</a>(reference: <a class="type" href="../../core_foundation/data/type.CFDataRef.html" title="type core_foundation::data::CFDataRef">CFDataRef</a>) -&gt; Self</code><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns an instance of the object, wrapping the underlying <code>CFTypeRef</code> subclass. Use this
when following Core Foundation's &quot;Create Rule&quot;. The reference count is <em>not</em> bumped. <a href="../../core_foundation/base/trait.TCFType.html#tymethod.wrap_under_create_rule">Read more</a></p>
</div><h4 id="method.type_id" class="method hidden"><code>fn <a href="../../core_foundation/base/trait.TCFType.html#tymethod.type_id" class="fnname">type_id</a>() -&gt; <a class="type" href="../../core_foundation/base/type.CFTypeID.html" title="type core_foundation::base::CFTypeID">CFTypeID</a></code><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the type ID for this class.</p>
</div><h4 id="method.as_CFType" class="method hidden"><code>fn <a href="../../core_foundation/base/trait.TCFType.html#method.as_CFType" class="fnname">as_CFType</a>(&amp;self) -&gt; <a class="struct" href="../../core_foundation/base/struct.CFType.html" title="struct core_foundation::base::CFType">CFType</a></code><a class="srclink" href="../../src/core_foundation/base.rs.html#180-184" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the object as a wrapped <code>CFType</code>. The reference count is incremented by one.</p>
</div><h4 id="method.into_CFType" class="method hidden"><code>fn <a href="../../core_foundation/base/trait.TCFType.html#method.into_CFType" class="fnname">into_CFType</a>(self) -&gt; <a class="struct" href="../../core_foundation/base/struct.CFType.html" title="struct core_foundation::base::CFType">CFType</a> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a class="srclink" href="../../src/core_foundation/base.rs.html#189-196" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the object as a wrapped <code>CFType</code>. Consumes self and avoids changing the reference
count. <a href="../../core_foundation/base/trait.TCFType.html#method.into_CFType">Read more</a></p>
</div><h4 id="method.retain_count" class="method hidden"><code>fn <a href="../../core_foundation/base/trait.TCFType.html#method.retain_count" class="fnname">retain_count</a>(&amp;self) -&gt; <a class="type" href="../../core_foundation/base/type.CFIndex.html" title="type core_foundation::base::CFIndex">CFIndex</a></code><a class="srclink" href="../../src/core_foundation/base.rs.html#208-212" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the reference count of the object. It is unwise to do anything other than test
whether the return value of this method is greater than zero. <a href="../../core_foundation/base/trait.TCFType.html#method.retain_count">Read more</a></p>
</div><h4 id="method.type_of" class="method hidden"><code>fn <a href="../../core_foundation/base/trait.TCFType.html#method.type_of" class="fnname">type_of</a>(&amp;self) -&gt; <a class="type" href="../../core_foundation/base/type.CFTypeID.html" title="type core_foundation::base::CFTypeID">CFTypeID</a></code><a class="srclink" href="../../src/core_foundation/base.rs.html#216-220" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the type ID of this object.</p>
</div><h4 id="method.show" class="method hidden"><code>fn <a href="../../core_foundation/base/trait.TCFType.html#method.show" class="fnname">show</a>(&amp;self)</code><a class="srclink" href="../../src/core_foundation/base.rs.html#223-227" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Writes a debugging version of this object on standard error.</p>
</div><h4 id="method.instance_of" class="method hidden"><code>fn <a href="../../core_foundation/base/trait.TCFType.html#method.instance_of" class="fnname">instance_of</a>&lt;OtherCFType:&nbsp;<a class="trait" href="../../core_foundation/base/trait.TCFType.html" title="trait core_foundation::base::TCFType">TCFType</a>&gt;(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../../src/core_foundation/base.rs.html#231-233" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns true if this value is an instance of another type.</p>
</div></div><h3 id="impl-ToVoid%3CCFData%3E" class="impl"><code class="in-band">impl&lt;'a&gt; <a class="trait" href="../../core_foundation/base/trait.ToVoid.html" title="trait core_foundation::base::ToVoid">ToVoid</a>&lt;<a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a>&gt; for &amp;'a <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-ToVoid%3CCFData%3E" class="anchor"></a><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.to_void" class="method hidden"><code>fn <a href="../../core_foundation/base/trait.ToVoid.html#tymethod.to_void" class="fnname">to_void</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*const </a><a class="enum" href="https://doc.rust-lang.org/nightly/core/ffi/enum.c_void.html" title="enum core::ffi::c_void">c_void</a></code><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h4></div><h3 id="impl-ToVoid%3CCFData%3E-1" class="impl"><code class="in-band">impl <a class="trait" href="../../core_foundation/base/trait.ToVoid.html" title="trait core_foundation::base::ToVoid">ToVoid</a>&lt;<a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a>&gt; for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-ToVoid%3CCFData%3E-1" class="anchor"></a><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.to_void-1" class="method hidden"><code>fn <a href="../../core_foundation/base/trait.ToVoid.html#tymethod.to_void" class="fnname">to_void</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*const </a><a class="enum" href="https://doc.rust-lang.org/nightly/core/ffi/enum.c_void.html" title="enum core::ffi::c_void">c_void</a></code><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h4></div><h3 id="impl-ToVoid%3CCFData%3E-2" class="impl"><code class="in-band">impl <a class="trait" href="../../core_foundation/base/trait.ToVoid.html" title="trait core_foundation::base::ToVoid">ToVoid</a>&lt;<a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a>&gt; for <a class="type" href="../../core_foundation/data/type.CFDataRef.html" title="type core_foundation::data::CFDataRef">CFDataRef</a></code><a href="#impl-ToVoid%3CCFData%3E-2" class="anchor"></a><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.to_void-2" class="method hidden"><code>fn <a href="../../core_foundation/base/trait.ToVoid.html#tymethod.to_void" class="fnname">to_void</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*const </a><a class="enum" href="https://doc.rust-lang.org/nightly/core/ffi/enum.c_void.html" title="enum core::ffi::c_void">c_void</a></code><a class="srclink" href="../../src/core_foundation/data.rs.html#25" title="goto source code">[src]</a></h4></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a><a class="srclink" href="../../src/core_foundation/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Send" class="impl"><code class="in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-Send" class="anchor"></a><a class="srclink" href="../../src/core_foundation/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-Sync" class="anchor"></a><a class="srclink" href="../../src/core_foundation/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-Unpin" class="anchor"></a><a class="srclink" href="../../src/core_foundation/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../core_foundation/data/struct.CFData.html" title="struct core_foundation::data::CFData">CFData</a></code><a href="#impl-UnwindSafe" class="anchor"></a><a class="srclink" href="../../src/core_foundation/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -&gt; T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-FromMutVoid" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="../../core_foundation/base/trait.FromMutVoid.html" title="trait core_foundation::base::FromMutVoid">FromMutVoid</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../core_foundation/base/trait.TCFType.html" title="trait core_foundation::base::TCFType">TCFType</a>,&nbsp;</span></code><a href="#impl-FromMutVoid" class="anchor"></a><a class="srclink" href="../../src/core_foundation/base.rs.html#338-342" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from_mut_void" class="method hidden"><code>pub unsafe fn <a href="../../core_foundation/base/trait.FromMutVoid.html#tymethod.from_mut_void" class="fnname">from_mut_void</a>&lt;'a&gt;(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut </a><a class="enum" href="https://doc.rust-lang.org/nightly/core/ffi/enum.c_void.html" title="enum core::ffi::c_void">c_void</a>) -&gt; <a class="struct" href="../../core_foundation/base/struct.ItemMutRef.html" title="struct core_foundation::base::ItemMutRef">ItemMutRef</a>&lt;'a, T&gt;</code><a class="srclink" href="../../src/core_foundation/base.rs.html#339-341" title="goto source code">[src]</a></h4></div><h3 id="impl-FromVoid" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="../../core_foundation/base/trait.FromVoid.html" title="trait core_foundation::base::FromVoid">FromVoid</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../core_foundation/base/trait.TCFType.html" title="trait core_foundation::base::TCFType">TCFType</a>,&nbsp;</span></code><a href="#impl-FromVoid" class="anchor"></a><a class="srclink" href="../../src/core_foundation/base.rs.html#363-367" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from_void" class="method hidden"><code>pub unsafe fn <a href="../../core_foundation/base/trait.FromVoid.html#tymethod.from_void" class="fnname">from_void</a>&lt;'a&gt;(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*const </a><a class="enum" href="https://doc.rust-lang.org/nightly/core/ffi/enum.c_void.html" title="enum core::ffi::c_void">c_void</a>) -&gt; <a class="struct" href="../../core_foundation/base/struct.ItemRef.html" title="struct core_foundation::base::ItemRef">ItemRef</a>&lt;'a, T&gt;</code><a class="srclink" href="../../src/core_foundation/base.rs.html#364-366" title="goto source code">[src]</a></h4></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,&nbsp;</span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -&gt; U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-ToOwned" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,&nbsp;</span></code><a href="#impl-ToOwned" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#80-92" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Owned" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
</div><h4 id="method.to_owned" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&amp;self) -&gt; T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#85" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
</div><h4 id="method.clone_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T)</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#89" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,&nbsp;</span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,&nbsp;</span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="core_foundation"></div>
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>