1785 lines
405 KiB
HTML
1785 lines
405 KiB
HTML
|
<!DOCTYPE html>
|
|||
|
<html lang="en">
|
|||
|
<head>
|
|||
|
<meta charset="utf-8">
|
|||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|||
|
<meta name="generator" content="rustdoc">
|
|||
|
<meta name="description" content="API documentation for the Rust `BytesMut` struct in crate `bytes`.">
|
|||
|
<meta name="keywords" content="rust, rustlang, rust-lang, BytesMut">
|
|||
|
|
|||
|
<title>bytes::BytesMut - 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="../dark.css">
|
|||
|
<link rel="stylesheet" type="text/css" href="../main.css" id="themeStyle">
|
|||
|
<script src="../storage.js"></script>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
</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">☰</div>
|
|||
|
|
|||
|
<p class='location'>Struct BytesMut</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.with_capacity">with_capacity</a><a href="#method.new">new</a><a href="#method.len">len</a><a href="#method.is_empty">is_empty</a><a href="#method.capacity">capacity</a><a href="#method.freeze">freeze</a><a href="#method.split_off">split_off</a><a href="#method.take">take</a><a href="#method.split_to">split_to</a><a href="#method.truncate">truncate</a><a href="#method.advance">advance</a><a href="#method.clear">clear</a><a href="#method.resize">resize</a><a href="#method.set_len">set_len</a><a href="#method.reserve">reserve</a><a href="#method.extend_from_slice">extend_from_slice</a><a href="#method.unsplit">unsplit</a></div><a class="sidebar-title" href="#deref-methods">Methods from Deref<Target=[u8]></a><div class="sidebar-links"><a href="#method.len">len</a><a href="#method.is_empty">is_empty</a><a href="#method.first">first</a><a href="#method.split_first">split_first</a><a href="#method.split_last">split_last</a><a href="#method.last">last</a><a href="#method.get">get</a><a href="#method.get_unchecked">get_unchecked</a><a href="#method.as_ptr">as_ptr</a><a href="#method.iter">iter</a><a href="#method.windows">windows</a><a href="#method.chunks">chunks</a><a href="#method.exact_chunks">exact_chunks</a><a href="#method.split_at">split_at</a><a href="#method.split">split</a><a href="#method.rsplit">rsplit</a><a href="#method.splitn">splitn</a><a href="#method.rsplitn">rsplitn</a><a href="#method.contains">contains</a><a href="#method.starts_with">starts_with</a><a href="#method.ends_with">ends_with</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.to_vec">to_vec</a><a href="#method.is_ascii">is_ascii</a><a href="#method.to_ascii_uppercase">to_ascii_uppercase</a><a href="#method.to_ascii_lowercase">to_ascii_lowercase</a><a href="#method.eq_ignore_ascii_case">eq_ignore_ascii_case</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-FromBuf">FromBuf</a><a href="#impl-From%3CBytesMut%3E">From<BytesMut></a><a href="#impl-FromIterator%3Cu8%3E">FromIterator<u8></a><a href="#impl-BufMut">BufMut</a><a href="#impl-IntoBuf">IntoBuf</a><a href="#impl-AsRef%3C%5Bu8%5D%3E">AsRef<[u8]></a><a href="#impl-Deref">Deref</a><a href="#impl-AsMut%3C%5Bu8%5D%3E">AsMut<[u8]></a><a href="#impl-DerefMut">DerefMut</a><a href="#impl-From%3CVec%3Cu8%3E%3E">From<Vec<u8>></a><a href="#impl-From%3CString%3E">From<String></a><a href="#impl-From%3C%26%27a%20%5Bu8%5D%3E">From<&'a [u8]></a><a href="#impl-From%3C%26%27a%20str%3E">From<&'a str></a><a href="#impl-From%3CBytes%3E">From<Bytes></a><a href="#impl-PartialEq">PartialEq</a><a href="#impl-PartialOrd">PartialOrd</a><a href="#impl-Ord">Ord</a><a href="#impl-Eq">Eq</a><a href="#impl-Default">Default</a><a href="#impl-Debug">Debug</a><a href="#impl-Hash">Hash</a><a href="#impl-Borrow%3C%5Bu8%5D%3E">Borrow<[u8]></a><a href="#impl-BorrowMut%3C%5Bu8%5D%3E">BorrowMut<[u8]></a><a href="#impl-Write">Write</a><a href="#impl-Clone">Clone</a><a href="#impl-IntoIterator">IntoIterator</a><a href="#impl-Extend%3Cu8%3E">Extend<u8></a><a href="#impl-Extend%3C%26%27a%20u8%3E">Extend<&'a u8></a><a href="#impl-PartialEq%3C%5Bu8%5D%3E">PartialEq<[u8]></a><a href="#impl-PartialOrd%3C%5Bu8%5D%3E">PartialOrd<[u8]></a><a href="#impl-PartialEq%3CBytesMut%3E">PartialEq<BytesMut></a><a href="#impl-PartialOrd%3CBytesMut%3E">PartialOrd<BytesMut></a><a href="#impl-PartialEq%3Cstr%3E">PartialEq<str></a><a href="#impl-PartialOrd%3Cstr%3E">PartialOrd<str></a><a href="#impl-PartialEq%3CVec%3Cu8%3E%3E">PartialEq<Vec<u8>></a><a href="#impl-PartialOrd%3CVec%3Cu8%3E%3E">PartialOrd&l
|
|||
|
</nav>
|
|||
|
|
|||
|
<div class="theme-picker">
|
|||
|
<button id="theme-picker" aria-label="Pick another theme!">
|
|||
|
<img src="../brush.svg" width="18" alt="Pick another theme!">
|
|||
|
</button>
|
|||
|
<div id="theme-choices"></div>
|
|||
|
</div>
|
|||
|
<script src="../theme.js"></script>
|
|||
|
<nav class="sub">
|
|||
|
<form class="search-form js-only">
|
|||
|
<div class="search-container">
|
|||
|
<input class="search-input" name="search"
|
|||
|
autocomplete="off"
|
|||
|
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
|||
|
type="search">
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
</nav>
|
|||
|
|
|||
|
<section id='main' class="content">
|
|||
|
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>bytes</a>::<wbr><a class="struct" href=''>BytesMut</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'>−</span>]
|
|||
|
</a>
|
|||
|
</span><a class='srclink' href='../src/bytes/bytes.rs.html#151-153' title='goto source code'>[src]</a></span></h1>
|
|||
|
<pre class='rust struct'>pub struct BytesMut { /* fields omitted */ }</pre><div class='docblock'><p>A unique reference to a contiguous slice of memory.</p>
|
|||
|
<p><code>BytesMut</code> represents a unique view into a potentially shared memory region.
|
|||
|
Given the uniqueness guarantee, owners of <code>BytesMut</code> handles are able to
|
|||
|
mutate the memory. It is similar to a <code>Vec<u8></code> but with less copies and
|
|||
|
allocations.</p>
|
|||
|
<p>For more detail, see <a href="struct.Bytes.html">Bytes</a>.</p>
|
|||
|
<h1 id="growth" class="section-header"><a href="#growth">Growth</a></h1>
|
|||
|
<p>One key difference from <code>Vec<u8></code> is that most operations <strong>do not
|
|||
|
implicitly grow the buffer</strong>. This means that calling <code>my_bytes.put("hello world");</code> could panic if <code>my_bytes</code> does not have enough capacity. Before
|
|||
|
writing to the buffer, ensure that there is enough remaining capacity by
|
|||
|
calling <code>my_bytes.remaining_mut()</code>. In general, avoiding calls to <code>reserve</code>
|
|||
|
is preferable.</p>
|
|||
|
<p>The only exception is <code>extend</code> which implicitly reserves required capacity.</p>
|
|||
|
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::{<span class="ident">BytesMut</span>, <span class="ident">BufMut</span>};
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">with_capacity</span>(<span class="number">64</span>);
|
|||
|
|
|||
|
<span class="ident">buf</span>.<span class="ident">put</span>(<span class="string">b'h'</span>);
|
|||
|
<span class="ident">buf</span>.<span class="ident">put</span>(<span class="string">b'e'</span>);
|
|||
|
<span class="ident">buf</span>.<span class="ident">put</span>(<span class="string">"llo"</span>);
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">buf</span>[..], <span class="string">b"hello"</span>);
|
|||
|
|
|||
|
<span class="comment">// Freeze the buffer so that it can be shared</span>
|
|||
|
<span class="kw">let</span> <span class="ident">a</span> <span class="op">=</span> <span class="ident">buf</span>.<span class="ident">freeze</span>();
|
|||
|
|
|||
|
<span class="comment">// This does not allocate, instead `b` points to the same memory.</span>
|
|||
|
<span class="kw">let</span> <span class="ident">b</span> <span class="op">=</span> <span class="ident">a</span>.<span class="ident">clone</span>();
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">a</span>[..], <span class="string">b"hello"</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">b</span>[..], <span class="string">b"hello"</span>);</pre>
|
|||
|
</div>
|
|||
|
<h2 id='methods' class='small-section-header'>
|
|||
|
Methods<a href='#methods' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<h3 id='impl' class='impl'><span class='in-band'><code>impl <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#992-1464' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.with_capacity' class="method"><span id='with_capacity.v' class='invisible'><code>pub fn <a href='#method.with_capacity' class='fnname'>with_capacity</a>(capacity: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1017-1021' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Creates a new <code>BytesMut</code> with the specified capacity.</p>
|
|||
|
<p>The returned <code>BytesMut</code> will be able to hold at least <code>capacity</code> bytes
|
|||
|
without reallocating. If <code>capacity</code> is under <code>4 * size_of::<usize>() - 1</code>,
|
|||
|
then <code>BytesMut</code> will not allocate.</p>
|
|||
|
<p>It is important to note that this function does not specify the length
|
|||
|
of the returned <code>BytesMut</code>, but only the capacity.</p>
|
|||
|
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::{<span class="ident">BytesMut</span>, <span class="ident">BufMut</span>};
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">with_capacity</span>(<span class="number">64</span>);
|
|||
|
|
|||
|
<span class="comment">// `bytes` contains no data, even though there is capacity</span>
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">bytes</span>.<span class="ident">len</span>(), <span class="number">0</span>);
|
|||
|
|
|||
|
<span class="ident">bytes</span>.<span class="ident">put</span>(<span class="kw-2">&</span><span class="string">b"hello world"</span>[..]);
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">bytes</span>[..], <span class="string">b"hello world"</span>);</pre>
|
|||
|
</div><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>pub fn <a href='#method.new' class='fnname'>new</a>() -> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1043-1045' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Creates a new <code>BytesMut</code> with default capacity.</p>
|
|||
|
<p>Resulting object has length 0 and unspecified capacity.
|
|||
|
This function does not allocate.</p>
|
|||
|
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::{<span class="ident">BytesMut</span>, <span class="ident">BufMut</span>};
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">bytes</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">new</span>();
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">0</span>, <span class="ident">bytes</span>.<span class="ident">len</span>());
|
|||
|
|
|||
|
<span class="ident">bytes</span>.<span class="ident">reserve</span>(<span class="number">2</span>);
|
|||
|
<span class="ident">bytes</span>.<span class="ident">put_slice</span>(<span class="string">b"xy"</span>);
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="string">b"xy"</span>[..], <span class="kw-2">&</span><span class="ident">bytes</span>[..]);</pre>
|
|||
|
</div><h4 id='method.len' class="method"><span id='len.v' class='invisible'><code>pub fn <a href='#method.len' class='fnname'>len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1058-1060' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns the number of bytes contained in this <code>BytesMut</code>.</p>
|
|||
|
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">b</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">from</span>(<span class="kw-2">&</span><span class="string">b"hello"</span>[..]);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">b</span>.<span class="ident">len</span>(), <span class="number">5</span>);</pre>
|
|||
|
</div><h4 id='method.is_empty' class="method"><span id='is_empty.v' class='invisible'><code>pub fn <a href='#method.is_empty' class='fnname'>is_empty</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1073-1075' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns true if the <code>BytesMut</code> has a length of 0.</p>
|
|||
|
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">b</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">with_capacity</span>(<span class="number">64</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">b</span>.<span class="ident">is_empty</span>());</pre>
|
|||
|
</div><h4 id='method.capacity' class="method"><span id='capacity.v' class='invisible'><code>pub fn <a href='#method.capacity' class='fnname'>capacity</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1088-1090' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns the number of bytes the <code>BytesMut</code> can hold without reallocating.</p>
|
|||
|
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">b</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">with_capacity</span>(<span class="number">64</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">b</span>.<span class="ident">capacity</span>(), <span class="number">64</span>);</pre>
|
|||
|
</div><h4 id='method.freeze' class="method"><span id='freeze.v' class='invisible'><code>pub fn <a href='#method.freeze' class='fnname'>freeze</a>(self) -> <a class="struct" href="../bytes/struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1117-1119' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Converts <code>self</code> into an immutable <code>Bytes</code>.</p>
|
|||
|
<p>The conversion is zero cost and is used to indicate that the slice
|
|||
|
referenced by the handle will no longer be mutated. Once the conversion
|
|||
|
is done, the handle can be cloned and shared across threads.</p>
|
|||
|
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::{<span class="ident">BytesMut</span>, <span class="ident">BufMut</span>};
|
|||
|
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">thread</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">b</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">with_capacity</span>(<span class="number">64</span>);
|
|||
|
<span class="ident">b</span>.<span class="ident">put</span>(<span class="string">"hello world"</span>);
|
|||
|
<span class="kw">let</span> <span class="ident">b1</span> <span class="op">=</span> <span class="ident">b</span>.<span class="ident">freeze</span>();
|
|||
|
<span class="kw">let</span> <span class="ident">b2</span> <span class="op">=</span> <span class="ident">b1</span>.<span class="ident">clone</span>();
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">th</span> <span class="op">=</span> <span class="ident">thread</span>::<span class="ident">spawn</span>(<span class="kw">move</span> <span class="op">||</span> {
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">b1</span>[..], <span class="string">b"hello world"</span>);
|
|||
|
});
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">b2</span>[..], <span class="string">b"hello world"</span>);
|
|||
|
<span class="ident">th</span>.<span class="ident">join</span>().<span class="ident">unwrap</span>();</pre>
|
|||
|
</div><h4 id='method.split_off' class="method"><span id='split_off.v' class='invisible'><code>pub fn <a href='#method.split_off' class='fnname'>split_off</a>(&mut self, at: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1147-1151' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Splits the bytes into two at the given index.</p>
|
|||
|
<p>Afterwards <code>self</code> contains elements <code>[0, at)</code>, and the returned
|
|||
|
<code>BytesMut</code> contains elements <code>[at, capacity)</code>.</p>
|
|||
|
<p>This is an <code>O(1)</code> operation that just increases the reference count
|
|||
|
and sets a few indices.</p>
|
|||
|
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">a</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">from</span>(<span class="kw-2">&</span><span class="string">b"hello world"</span>[..]);
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">b</span> <span class="op">=</span> <span class="ident">a</span>.<span class="ident">split_off</span>(<span class="number">5</span>);
|
|||
|
|
|||
|
<span class="ident">a</span>[<span class="number">0</span>] <span class="op">=</span> <span class="string">b'j'</span>;
|
|||
|
<span class="ident">b</span>[<span class="number">0</span>] <span class="op">=</span> <span class="string">b'!'</span>;
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">a</span>[..], <span class="string">b"jello"</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">b</span>[..], <span class="string">b"!world"</span>);</pre>
|
|||
|
<h1 id="panics" class="section-header"><a href="#panics">Panics</a></h1>
|
|||
|
<p>Panics if <code>at > capacity</code>.</p>
|
|||
|
</div><h4 id='method.take' class="method"><span id='take.v' class='invisible'><code>pub fn <a href='#method.take' class='fnname'>take</a>(&mut self) -> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1178-1181' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Removes the bytes from the current view, returning them in a new
|
|||
|
<code>BytesMut</code> handle.</p>
|
|||
|
<p>Afterwards, <code>self</code> will be empty, but will retain any additional
|
|||
|
capacity that it had before the operation. This is identical to
|
|||
|
<code>self.split_to(self.len())</code>.</p>
|
|||
|
<p>This is an <code>O(1)</code> operation that just increases the reference count and
|
|||
|
sets a few indices.</p>
|
|||
|
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::{<span class="ident">BytesMut</span>, <span class="ident">BufMut</span>};
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">with_capacity</span>(<span class="number">1024</span>);
|
|||
|
<span class="ident">buf</span>.<span class="ident">put</span>(<span class="kw-2">&</span><span class="string">b"hello world"</span>[..]);
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">other</span> <span class="op">=</span> <span class="ident">buf</span>.<span class="ident">take</span>();
|
|||
|
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">buf</span>.<span class="ident">is_empty</span>());
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">1013</span>, <span class="ident">buf</span>.<span class="ident">capacity</span>());
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">other</span>, <span class="string">b"hello world"</span>[..]);</pre>
|
|||
|
</div><h4 id='method.split_to' class="method"><span id='split_to.v' class='invisible'><code>pub fn <a href='#method.split_to' class='fnname'>split_to</a>(&mut self, at: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1215-1219' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Splits the buffer into two at the given index.</p>
|
|||
|
<p>Afterwards <code>self</code> contains elements <code>[at, len)</code>, and the returned <code>BytesMut</code>
|
|||
|
contains elements <code>[0, at)</code>.</p>
|
|||
|
<p>This is an <code>O(1)</code> operation that just increases the reference count and
|
|||
|
sets a few indices.</p>
|
|||
|
<h1 id="examples-9" class="section-header"><a href="#examples-9">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">a</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">from</span>(<span class="kw-2">&</span><span class="string">b"hello world"</span>[..]);
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">b</span> <span class="op">=</span> <span class="ident">a</span>.<span class="ident">split_to</span>(<span class="number">5</span>);
|
|||
|
|
|||
|
<span class="ident">a</span>[<span class="number">0</span>] <span class="op">=</span> <span class="string">b'!'</span>;
|
|||
|
<span class="ident">b</span>[<span class="number">0</span>] <span class="op">=</span> <span class="string">b'j'</span>;
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">a</span>[..], <span class="string">b"!world"</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">b</span>[..], <span class="string">b"jello"</span>);</pre>
|
|||
|
<h1 id="panics-1" class="section-header"><a href="#panics-1">Panics</a></h1>
|
|||
|
<p>Panics if <code>at > len</code>.</p>
|
|||
|
</div><h4 id='method.truncate' class="method"><span id='truncate.v' class='invisible'><code>pub fn <a href='#method.truncate' class='fnname'>truncate</a>(&mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1247-1249' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Shortens the buffer, keeping the first <code>len</code> bytes and dropping the
|
|||
|
rest.</p>
|
|||
|
<p>If <code>len</code> is greater than the buffer's current length, this has no
|
|||
|
effect.</p>
|
|||
|
<p>The <a href="#method.split_off"><code>split_off</code></a> method can emulate <code>truncate</code>, but this causes the
|
|||
|
excess bytes to be returned instead of dropped.</p>
|
|||
|
<h1 id="examples-10" class="section-header"><a href="#examples-10">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">from</span>(<span class="kw-2">&</span><span class="string">b"hello world"</span>[..]);
|
|||
|
<span class="ident">buf</span>.<span class="ident">truncate</span>(<span class="number">5</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">buf</span>, <span class="string">b"hello"</span>[..]);</pre>
|
|||
|
</div><h4 id='method.advance' class="method"><span id='advance.v' class='invisible'><code>pub fn <a href='#method.advance' class='fnname'>advance</a>(&mut self, cnt: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1262-1265' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Shortens the buffer, dropping the first <code>cnt</code> bytes and keeping the
|
|||
|
rest.</p>
|
|||
|
<p>This is the same function as <code>Buf::advance</code>, and in the next breaking
|
|||
|
release of <code>bytes</code>, this implementation will be removed in favor of
|
|||
|
having <code>BytesMut</code> implement <code>Buf</code>.</p>
|
|||
|
<h1 id="panics-2" class="section-header"><a href="#panics-2">Panics</a></h1>
|
|||
|
<p>This function panics if <code>cnt</code> is greater than <code>self.len()</code></p>
|
|||
|
</div><h4 id='method.clear' class="method"><span id='clear.v' class='invisible'><code>pub fn <a href='#method.clear' class='fnname'>clear</a>(&mut self)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1278-1280' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Clears the buffer, removing all data.</p>
|
|||
|
<h1 id="examples-11" class="section-header"><a href="#examples-11">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">from</span>(<span class="kw-2">&</span><span class="string">b"hello world"</span>[..]);
|
|||
|
<span class="ident">buf</span>.<span class="ident">clear</span>();
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">buf</span>.<span class="ident">is_empty</span>());</pre>
|
|||
|
</div><h4 id='method.resize' class="method"><span id='resize.v' class='invisible'><code>pub fn <a href='#method.resize' class='fnname'>resize</a>(&mut self, new_len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, value: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1304-1306' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Resizes the buffer so that <code>len</code> is equal to <code>new_len</code>.</p>
|
|||
|
<p>If <code>new_len</code> is greater than <code>len</code>, the buffer is extended by the
|
|||
|
difference with each additional byte set to <code>value</code>. If <code>new_len</code> is
|
|||
|
less than <code>len</code>, the buffer is simply truncated.</p>
|
|||
|
<h1 id="examples-12" class="section-header"><a href="#examples-12">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">new</span>();
|
|||
|
|
|||
|
<span class="ident">buf</span>.<span class="ident">resize</span>(<span class="number">3</span>, <span class="number">0x1</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">buf</span>[..], <span class="kw-2">&</span>[<span class="number">0x1</span>, <span class="number">0x1</span>, <span class="number">0x1</span>]);
|
|||
|
|
|||
|
<span class="ident">buf</span>.<span class="ident">resize</span>(<span class="number">2</span>, <span class="number">0x2</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">buf</span>[..], <span class="kw-2">&</span>[<span class="number">0x1</span>, <span class="number">0x1</span>]);
|
|||
|
|
|||
|
<span class="ident">buf</span>.<span class="ident">resize</span>(<span class="number">4</span>, <span class="number">0x3</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">buf</span>[..], <span class="kw-2">&</span>[<span class="number">0x1</span>, <span class="number">0x1</span>, <span class="number">0x3</span>, <span class="number">0x3</span>]);</pre>
|
|||
|
</div><h4 id='method.set_len' class="method"><span id='set_len.v' class='invisible'><code>pub unsafe fn <a href='#method.set_len' class='fnname'>set_len</a>(&mut self, len: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1338-1340' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Sets the length of the buffer.</p>
|
|||
|
<p>This will explicitly set the size of the buffer without actually
|
|||
|
modifying the data, so it is up to the caller to ensure that the data
|
|||
|
has been initialized.</p>
|
|||
|
<h1 id="examples-13" class="section-header"><a href="#examples-13">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">b</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">from</span>(<span class="kw-2">&</span><span class="string">b"hello world"</span>[..]);
|
|||
|
|
|||
|
<span class="kw">unsafe</span> {
|
|||
|
<span class="ident">b</span>.<span class="ident">set_len</span>(<span class="number">5</span>);
|
|||
|
}
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">b</span>[..], <span class="string">b"hello"</span>);
|
|||
|
|
|||
|
<span class="kw">unsafe</span> {
|
|||
|
<span class="ident">b</span>.<span class="ident">set_len</span>(<span class="number">11</span>);
|
|||
|
}
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="kw-2">&</span><span class="ident">b</span>[..], <span class="string">b"hello world"</span>);</pre>
|
|||
|
<h1 id="panics-3" class="section-header"><a href="#panics-3">Panics</a></h1>
|
|||
|
<p>This method will panic if <code>len</code> is out of bounds for the underlying
|
|||
|
slice or if it comes after the <code>end</code> of the configured window.</p>
|
|||
|
</div><h4 id='method.reserve' class="method"><span id='reserve.v' class='invisible'><code>pub fn <a href='#method.reserve' class='fnname'>reserve</a>(&mut self, additional: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1391-1393' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Reserves capacity for at least <code>additional</code> more bytes to be inserted
|
|||
|
into the given <code>BytesMut</code>.</p>
|
|||
|
<p>More than <code>additional</code> bytes may be reserved in order to avoid frequent
|
|||
|
reallocations. A call to <code>reserve</code> may result in an allocation.</p>
|
|||
|
<p>Before allocating new buffer space, the function will attempt to reclaim
|
|||
|
space in the existing buffer. If the current handle references a small
|
|||
|
view in the original buffer and all other handles have been dropped,
|
|||
|
and the requested capacity is less than or equal to the existing
|
|||
|
buffer's capacity, then the current view will be copied to the front of
|
|||
|
the buffer and the handle will take ownership of the full buffer.</p>
|
|||
|
<h1 id="examples-14" class="section-header"><a href="#examples-14">Examples</a></h1>
|
|||
|
<p>In the following example, a new buffer is allocated.</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">from</span>(<span class="kw-2">&</span><span class="string">b"hello"</span>[..]);
|
|||
|
<span class="ident">buf</span>.<span class="ident">reserve</span>(<span class="number">64</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">buf</span>.<span class="ident">capacity</span>() <span class="op">>=</span> <span class="number">69</span>);</pre>
|
|||
|
<p>In the following example, the existing buffer is reclaimed.</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::{<span class="ident">BytesMut</span>, <span class="ident">BufMut</span>};
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">with_capacity</span>(<span class="number">128</span>);
|
|||
|
<span class="ident">buf</span>.<span class="ident">put</span>(<span class="kw-2">&</span>[<span class="number">0</span>; <span class="number">64</span>][..]);
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">ptr</span> <span class="op">=</span> <span class="ident">buf</span>.<span class="ident">as_ptr</span>();
|
|||
|
<span class="kw">let</span> <span class="ident">other</span> <span class="op">=</span> <span class="ident">buf</span>.<span class="ident">take</span>();
|
|||
|
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">buf</span>.<span class="ident">is_empty</span>());
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">buf</span>.<span class="ident">capacity</span>(), <span class="number">64</span>);
|
|||
|
|
|||
|
<span class="ident">drop</span>(<span class="ident">other</span>);
|
|||
|
<span class="ident">buf</span>.<span class="ident">reserve</span>(<span class="number">128</span>);
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">buf</span>.<span class="ident">capacity</span>(), <span class="number">128</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">buf</span>.<span class="ident">as_ptr</span>(), <span class="ident">ptr</span>);</pre>
|
|||
|
<h1 id="panics-4" class="section-header"><a href="#panics-4">Panics</a></h1>
|
|||
|
<p>Panics if the new capacity overflows <code>usize</code>.</p>
|
|||
|
</div><h4 id='method.extend_from_slice' class="method"><span id='extend_from_slice.v' class='invisible'><code>pub fn <a href='#method.extend_from_slice' class='fnname'>extend_from_slice</a>(&mut self, extend: <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></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1411-1414' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Appends given bytes to this object.</p>
|
|||
|
<p>If this <code>BytesMut</code> object has not enough capacity, it is resized first.
|
|||
|
So unlike <code>put_slice</code> operation, <code>extend_from_slice</code> does not panic.</p>
|
|||
|
<h1 id="examples-15" class="section-header"><a href="#examples-15">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">with_capacity</span>(<span class="number">0</span>);
|
|||
|
<span class="ident">buf</span>.<span class="ident">extend_from_slice</span>(<span class="string">b"aaabbb"</span>);
|
|||
|
<span class="ident">buf</span>.<span class="ident">extend_from_slice</span>(<span class="string">b"cccddd"</span>);
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">b"aaabbbcccddd"</span>, <span class="kw-2">&</span><span class="ident">buf</span>[..]);</pre>
|
|||
|
</div><h4 id='method.unsplit' class="method"><span id='unsplit.v' class='invisible'><code>pub fn <a href='#method.unsplit' class='fnname'>unsplit</a>(&mut self, other: <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1435-1463' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Combine splitted BytesMut objects back as contiguous.</p>
|
|||
|
<p>If <code>BytesMut</code> objects were not contiguous originally, they will be extended.</p>
|
|||
|
<h1 id="examples-16" class="section-header"><a href="#examples-16">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>;
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> <span class="ident">BytesMut</span>::<span class="ident">with_capacity</span>(<span class="number">64</span>);
|
|||
|
<span class="ident">buf</span>.<span class="ident">extend_from_slice</span>(<span class="string">b"aaabbbcccddd"</span>);
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">splitted</span> <span class="op">=</span> <span class="ident">buf</span>.<span class="ident">split_off</span>(<span class="number">6</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">b"aaabbb"</span>, <span class="kw-2">&</span><span class="ident">buf</span>[..]);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">b"cccddd"</span>, <span class="kw-2">&</span><span class="ident">splitted</span>[..]);
|
|||
|
|
|||
|
<span class="ident">buf</span>.<span class="ident">unsplit</span>(<span class="ident">splitted</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">b"aaabbbcccddd"</span>, <span class="kw-2">&</span><span class="ident">buf</span>[..]);</pre>
|
|||
|
</div></div>
|
|||
|
<h2 id='deref-methods' 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><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>><a href='#deref-methods' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<div class='impl-items'><h4 id='method.len-1' class="method"><span id='len.v-1' class='invisible'><code>pub fn <a href='#method.len-1' class='fnname'>len</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#186-188' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns the number of elements in the slice.</p>
|
|||
|
<h1 id="examples-17" class="section-header"><a href="#examples-17">Examples</a></h1>
|
|||
|
<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><h4 id='method.is_empty-1' class="method"><span id='is_empty.v-1' class='invisible'><code>pub fn <a href='#method.is_empty-1' class='fnname'>is_empty</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#200-202' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the slice has a length of 0.</p>
|
|||
|
<h1 id="examples-18" class="section-header"><a href="#examples-18">Examples</a></h1>
|
|||
|
<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><h4 id='method.first' class="method"><span id='first.v' class='invisible'><code>pub fn <a href='#method.first' class='fnname'>first</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#217-219' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns the first element of the slice, or <code>None</code> if it is empty.</p>
|
|||
|
<h1 id="examples-19" class="section-header"><a href="#examples-19">Examples</a></h1>
|
|||
|
<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">&</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">&</span>[<span class="ident">i32</span>] <span class="op">=</span> <span class="kw-2">&</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><h4 id='method.first_mut' class="method"><span id='first_mut.v' class='invisible'><code>pub fn <a href='#method.first_mut' class='fnname'>first_mut</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#235-237' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns a mutable pointer to the first element of the slice, or <code>None</code> if it is empty.</p>
|
|||
|
<h1 id="examples-20" class="section-header"><a href="#examples-20">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&</span><span class="kw-2">mut</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="op">=</span> <span class="ident">x</span>.<span class="ident">first_mut</span>() {
|
|||
|
<span class="kw-2">*</span><span class="ident">first</span> <span class="op">=</span> <span class="number">5</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>, <span class="kw-2">&</span>[<span class="number">5</span>, <span class="number">1</span>, <span class="number">2</span>]);</pre>
|
|||
|
</div><h4 id='method.split_first' class="method"><span id='split_first.v' class='invisible'><code>pub fn <a href='#method.split_first' class='fnname'>split_first</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<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">&</a>T, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[T]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.5.0'>1.5.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#253-255' title='goto source code'>[src]</a></span></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-21" class="section-header"><a href="#examples-21">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&</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">&</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">&</span>[<span class="number">1</span>, <span class="number">2</span>]);
|
|||
|
}</pre>
|
|||
|
</div><h4 id='method.split_first_mut' class="method"><span id='split_first_mut.v' class='invisible'><code>pub fn <a href='#method.split_first_mut' class='fnname'>split_first_mut</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<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">&mut </a>T, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [T]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.5.0'>1.5.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#273-275' title='goto source code'>[src]</a></span></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-22" class="section-header"><a href="#examples-22">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&</span><span class="kw-2">mut</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_mut</span>() {
|
|||
|
<span class="kw-2">*</span><span class="ident">first</span> <span class="op">=</span> <span class="number">3</span>;
|
|||
|
<span class="ident">elements</span>[<span class="number">0</span>] <span class="op">=</span> <span class="number">4</span>;
|
|||
|
<span class="ident">elements</span>[<span class="number">1</span>] <span class="op">=</span> <span class="number">5</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>, <span class="kw-2">&</span>[<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]);</pre>
|
|||
|
</div><h4 id='method.split_last' class="method"><span id='split_last.v' class='invisible'><code>pub fn <a href='#method.split_last' class='fnname'>split_last</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<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">&</a>T, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[T]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.5.0'>1.5.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#291-294' title='goto source code'>[src]</a></span></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-23" class="section-header"><a href="#examples-23">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&</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">&</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">&</span>[<span class="number">0</span>, <span class="number">1</span>]);
|
|||
|
}</pre>
|
|||
|
</div><h4 id='method.split_last_mut' class="method"><span id='split_last_mut.v' class='invisible'><code>pub fn <a href='#method.split_last_mut' class='fnname'>split_last_mut</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<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">&mut </a>T, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [T]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.5.0'>1.5.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#312-314' title='goto source code'>[src]</a></span></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-24" class="section-header"><a href="#examples-24">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&</span><span class="kw-2">mut</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_mut</span>() {
|
|||
|
<span class="kw-2">*</span><span class="ident">last</span> <span class="op">=</span> <span class="number">3</span>;
|
|||
|
<span class="ident">elements</span>[<span class="number">0</span>] <span class="op">=</span> <span class="number">4</span>;
|
|||
|
<span class="ident">elements</span>[<span class="number">1</span>] <span class="op">=</span> <span class="number">5</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>, <span class="kw-2">&</span>[<span class="number">4</span>, <span class="number">5</span>, <span class="number">3</span>]);</pre>
|
|||
|
</div><h4 id='method.last' class="method"><span id='last.v' class='invisible'><code>pub fn <a href='#method.last' class='fnname'>last</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#329-331' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns the last element of the slice, or <code>None</code> if it is empty.</p>
|
|||
|
<h1 id="examples-25" class="section-header"><a href="#examples-25">Examples</a></h1>
|
|||
|
<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">&</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">&</span>[<span class="ident">i32</span>] <span class="op">=</span> <span class="kw-2">&</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><h4 id='method.last_mut' class="method"><span id='last_mut.v' class='invisible'><code>pub fn <a href='#method.last_mut' class='fnname'>last_mut</a>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#347-349' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns a mutable pointer to the last item in the slice.</p>
|
|||
|
<h1 id="examples-26" class="section-header"><a href="#examples-26">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&</span><span class="kw-2">mut</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="op">=</span> <span class="ident">x</span>.<span class="ident">last_mut</span>() {
|
|||
|
<span class="kw-2">*</span><span class="ident">last</span> <span class="op">=</span> <span class="number">10</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>, <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">10</span>]);</pre>
|
|||
|
</div><h4 id='method.get' class="method"><span id='get.v' class='invisible'><code>pub fn <a href='#method.get' class='fnname'>get</a><I>(&self, index: I) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/trait.SliceIndex.html" title="trait core::slice::SliceIndex">SliceIndex</a><<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="type" href="https://doc.rust-lang.org/nightly/core/slice/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::SliceIndex::Output">Output</a>> <span class="where fmt-newline">where<br> I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/trait.SliceIndex.html" title="trait core::slice::SliceIndex">SliceIndex</a><<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>>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#370-374' title='goto source code'>[src]</a></span></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-27" class="section-header"><a href="#examples-27">Examples</a></h1>
|
|||
|
<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">&</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">&</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><h4 id='method.get_mut' class="method"><span id='get_mut.v' class='invisible'><code>pub fn <a href='#method.get_mut' class='fnname'>get_mut</a><I>(<br> &mut self, <br> index: I<br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&mut <I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/trait.SliceIndex.html" title="trait core::slice::SliceIndex">SliceIndex</a><<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="type" href="https://doc.rust-lang.org/nightly/core/slice/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::SliceIndex::Output">Output</a>> <span class="where fmt-newline">where<br> I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/trait.SliceIndex.html" title="trait core::slice::SliceIndex">SliceIndex</a><<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>>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#393-397' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns a mutable reference to an element or subslice depending on the
|
|||
|
type of index (see <a href="#method.get"><code>get</code></a>) or <code>None</code> if the index is out of bounds.</p>
|
|||
|
<h1 id="examples-28" class="section-header"><a href="#examples-28">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&</span><span class="kw-2">mut</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">elem</span>) <span class="op">=</span> <span class="ident">x</span>.<span class="ident">get_mut</span>(<span class="number">1</span>) {
|
|||
|
<span class="kw-2">*</span><span class="ident">elem</span> <span class="op">=</span> <span class="number">42</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>, <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">42</span>, <span class="number">2</span>]);</pre>
|
|||
|
</div><h4 id='method.get_unchecked' class="method"><span id='get_unchecked.v' class='invisible'><code>pub unsafe fn <a href='#method.get_unchecked' class='fnname'>get_unchecked</a><I>(<br> &self, <br> index: I<br>) -> &<I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/trait.SliceIndex.html" title="trait core::slice::SliceIndex">SliceIndex</a><<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="type" href="https://doc.rust-lang.org/nightly/core/slice/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::SliceIndex::Output">Output</a> <span class="where fmt-newline">where<br> I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/trait.SliceIndex.html" title="trait core::slice::SliceIndex">SliceIndex</a><<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>>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#418-422' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns a reference to an element or subslice, without doing bounds
|
|||
|
checking.</p>
|
|||
|
<p>This is generally not recommended, use with caution! For a safe
|
|||
|
alternative see <a href="#method.get"><code>get</code></a>.</p>
|
|||
|
<h1 id="examples-29" class="section-header"><a href="#examples-29">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
|
|||
|
|
|||
|
<span class="kw">unsafe</span> {
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">get_unchecked</span>(<span class="number">1</span>), <span class="kw-2">&</span><span class="number">2</span>);
|
|||
|
}</pre>
|
|||
|
</div><h4 id='method.get_unchecked_mut' class="method"><span id='get_unchecked_mut.v' class='invisible'><code>pub unsafe fn <a href='#method.get_unchecked_mut' class='fnname'>get_unchecked_mut</a><I>(<br> &mut self, <br> index: I<br>) -> &mut <I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/trait.SliceIndex.html" title="trait core::slice::SliceIndex">SliceIndex</a><<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="type" href="https://doc.rust-lang.org/nightly/core/slice/trait.SliceIndex.html#associatedtype.Output" title="type core::slice::SliceIndex::Output">Output</a> <span class="where fmt-newline">where<br> I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/slice/trait.SliceIndex.html" title="trait core::slice::SliceIndex">SliceIndex</a><<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>>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#445-449' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns a mutable reference to an element or subslice, without doing
|
|||
|
bounds checking.</p>
|
|||
|
<p>This is generally not recommended, use with caution! For a safe
|
|||
|
alternative see <a href="#method.get_mut"><code>get_mut</code></a>.</p>
|
|||
|
<h1 id="examples-30" class="section-header"><a href="#examples-30">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&</span><span class="kw-2">mut</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
|
|||
|
|
|||
|
<span class="kw">unsafe</span> {
|
|||
|
<span class="kw">let</span> <span class="ident">elem</span> <span class="op">=</span> <span class="ident">x</span>.<span class="ident">get_unchecked_mut</span>(<span class="number">1</span>);
|
|||
|
<span class="kw-2">*</span><span class="ident">elem</span> <span class="op">=</span> <span class="number">13</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>, <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">13</span>, <span class="number">4</span>]);</pre>
|
|||
|
</div><h4 id='method.as_ptr' class="method"><span id='as_ptr.v' class='invisible'><code>pub fn <a href='#method.as_ptr' class='fnname'>as_ptr</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*const T</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#473-475' title='goto source code'>[src]</a></span></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>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-31" class="section-header"><a href="#examples-31">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
|
|||
|
<span class="kw">let</span> <span class="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">&</span><span class="kw-2">*</span><span class="ident">x_ptr</span>.<span class="ident">offset</span>(<span class="ident">i</span> <span class="kw">as</span> <span class="ident">isize</span>));
|
|||
|
}
|
|||
|
}</pre>
|
|||
|
</div><h4 id='method.as_mut_ptr' class="method"><span id='as_mut_ptr.v' class='invisible'><code>pub fn <a href='#method.as_mut_ptr' class='fnname'>as_mut_ptr</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*mut T</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#500-502' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns an unsafe mutable pointer to the slice's buffer.</p>
|
|||
|
<p>The caller must ensure that the slice outlives the pointer this
|
|||
|
function returns, or else it will end up pointing to garbage.</p>
|
|||
|
<p>Modifying the container referenced by this slice may cause its buffer
|
|||
|
to be reallocated, which would also make any pointers to it invalid.</p>
|
|||
|
<h1 id="examples-32" class="section-header"><a href="#examples-32">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&</span><span class="kw-2">mut</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_mut_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="kw-2">*</span><span class="ident">x_ptr</span>.<span class="ident">offset</span>(<span class="ident">i</span> <span class="kw">as</span> <span class="ident">isize</span>) <span class="op">+=</span> <span class="number">2</span>;
|
|||
|
}
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>, <span class="kw-2">&</span>[<span class="number">3</span>, <span class="number">4</span>, <span class="number">6</span>]);</pre>
|
|||
|
</div><h4 id='method.swap' class="method"><span id='swap.v' class='invisible'><code>pub fn <a href='#method.swap' class='fnname'>swap</a>(&mut self, a: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, b: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#524-526' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Swaps two elements in the slice.</p>
|
|||
|
<h1 id="arguments" class="section-header"><a href="#arguments">Arguments</a></h1>
|
|||
|
<ul>
|
|||
|
<li>a - The index of the first element</li>
|
|||
|
<li>b - The index of the second element</li>
|
|||
|
</ul>
|
|||
|
<h1 id="panics-5" class="section-header"><a href="#panics-5">Panics</a></h1>
|
|||
|
<p>Panics if <code>a</code> or <code>b</code> are out of bounds.</p>
|
|||
|
<h1 id="examples-33" class="section-header"><a href="#examples-33">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> [<span class="string">"a"</span>, <span class="string">"b"</span>, <span class="string">"c"</span>, <span class="string">"d"</span>];
|
|||
|
<span class="ident">v</span>.<span class="ident">swap</span>(<span class="number">1</span>, <span class="number">3</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span> <span class="op">==</span> [<span class="string">"a"</span>, <span class="string">"d"</span>, <span class="string">"c"</span>, <span class="string">"b"</span>]);</pre>
|
|||
|
</div><h4 id='method.reverse' class="method"><span id='reverse.v' class='invisible'><code>pub fn <a href='#method.reverse' class='fnname'>reverse</a>(&mut self)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#539-541' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Reverses the order of elements in the slice, in place.</p>
|
|||
|
<h1 id="examples-34" class="section-header"><a href="#examples-34">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</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="ident">v</span>.<span class="ident">reverse</span>();
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span> <span class="op">==</span> [<span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>]);</pre>
|
|||
|
</div><h4 id='method.iter' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Iter.html" title="struct core::slice::Iter">Iter</a><'a, T></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Iter.html" title="struct core::slice::Iter">Iter</a><'a, T></h3><code class="content"><span class="where fmt-newline">impl<'a, T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Iter.html" title="struct core::slice::Iter">Iter</a><'a, T></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a </a>T;</span></code></div></div><span id='iter.v' class='invisible'><code>pub fn <a href='#method.iter' class='fnname'>iter</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Iter.html" title="struct core::slice::Iter">Iter</a><T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#558-560' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns an iterator over the slice.</p>
|
|||
|
<h1 id="examples-35" class="section-header"><a href="#examples-35">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <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">&</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">&</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">&</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><h4 id='method.iter_mut' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.IterMut.html" title="struct core::slice::IterMut">IterMut</a><'a, T></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.IterMut.html" title="struct core::slice::IterMut">IterMut</a><'a, T></h3><code class="content"><span class="where fmt-newline">impl<'a, T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.IterMut.html" title="struct core::slice::IterMut">IterMut</a><'a, T></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut </a>T;</span></code></div></div><span id='iter_mut.v' class='invisible'><code>pub fn <a href='#method.iter_mut' class='fnname'>iter_mut</a>(&mut self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.IterMut.html" title="struct core::slice::IterMut">IterMut</a><T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#575-577' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns an iterator that allows modifying each value.</p>
|
|||
|
<h1 id="examples-36" class="section-header"><a href="#examples-36">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">x</span> <span class="op">=</span> <span class="kw-2">&</span><span class="kw-2">mut</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>];
|
|||
|
<span class="kw">for</span> <span class="ident">elem</span> <span class="kw">in</span> <span class="ident">x</span>.<span class="ident">iter_mut</span>() {
|
|||
|
<span class="kw-2">*</span><span class="ident">elem</span> <span class="op">+=</span> <span class="number">2</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">x</span>, <span class="kw-2">&</span>[<span class="number">3</span>, <span class="number">4</span>, <span class="number">6</span>]);</pre>
|
|||
|
</div><h4 id='method.windows' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Windows.html" title="struct core::slice::Windows">Windows</a><'a, T></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Windows.html" title="struct core::slice::Windows">Windows</a><'a, T></h3><code class="content"><span class="where fmt-newline">impl<'a, T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Windows.html" title="struct core::slice::Windows">Windows</a><'a, T></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a [T]</a>;</span></code></div></div><span id='windows.v' class='invisible'><code>pub fn <a href='#method.windows' class='fnname'>windows</a>(&self, size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Windows.html" title="struct core::slice::Windows">Windows</a><T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#607-609' title='goto source code'>[src]</a></span></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-6" class="section-header"><a href="#panics-6">Panics</a></h1>
|
|||
|
<p>Panics if <code>size</code> is 0.</p>
|
|||
|
<h1 id="examples-37" class="section-header"><a href="#examples-37">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="string">'r'</span>, <span class="string">'u'</span>, <span class="string">'s'</span>, <span class="string">'t'</span>];
|
|||
|
<span class="kw">let</span> <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">&</span>[<span class="string">'r'</span>, <span class="string">'u'</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">&</span>[<span class="string">'u'</span>, <span class="string">'s'</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">&</span>[<span class="string">'s'</span>, <span class="string">'t'</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>
|
|||
|
<p>If the slice is shorter than <code>size</code>:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="string">'f'</span>, <span class="string">'o'</span>, <span class="string">'o'</span>];
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <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><h4 id='method.chunks' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Chunks.html" title="struct core::slice::Chunks">Chunks</a><'a, T></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Chunks.html" title="struct core::slice::Chunks">Chunks</a><'a, T></h3><code class="content"><span class="where fmt-newline">impl<'a, T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Chunks.html" title="struct core::slice::Chunks">Chunks</a><'a, T></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a [T]</a>;</span></code></div></div><span id='chunks.v' class='invisible'><code>pub fn <a href='#method.chunks' class='fnname'>chunks</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Chunks.html" title="struct core::slice::Chunks">Chunks</a><T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#637-639' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a
|
|||
|
time. 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.exact_chunks"><code>exact_chunks</code></a> for a variant of this iterator that returns chunks
|
|||
|
of always exactly <code>chunk_size</code> elements.</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-38" class="section-header"><a href="#examples-38">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>];
|
|||
|
<span class="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">&</span>[<span class="string">'l'</span>, <span class="string">'o'</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">&</span>[<span class="string">'r'</span>, <span class="string">'e'</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">&</span>[<span class="string">'m'</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><h4 id='method.exact_chunks' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.ExactChunks.html" title="struct core::slice::ExactChunks">ExactChunks</a><'a, T></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.ExactChunks.html" title="struct core::slice::ExactChunks">ExactChunks</a><'a, T></h3><code class="content"><span class="where fmt-newline">impl<'a, T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.ExactChunks.html" title="struct core::slice::ExactChunks">ExactChunks</a><'a, T></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a [T]</a>;</span></code></div></div><span id='exact_chunks.v' class='invisible'><code>pub fn <a href='#method.exact_chunks' class='fnname'>exact_chunks</a>(&self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.ExactChunks.html" title="struct core::slice::ExactChunks">ExactChunks</a><T></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#669-671' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>exact_chunks</code>)</div></div><div class='docblock'><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a
|
|||
|
time. 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.</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>
|
|||
|
<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-39" class="section-header"><a href="#examples-39">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">exact_chunks</span>)]</span>
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">slice</span> <span class="op">=</span> [<span class="string">'l'</span>, <span class="string">'o'</span>, <span class="string">'r'</span>, <span class="string">'e'</span>, <span class="string">'m'</span>];
|
|||
|
<span class="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">exact_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">&</span>[<span class="string">'l'</span>, <span class="string">'o'</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">&</span>[<span class="string">'r'</span>, <span class="string">'e'</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><h4 id='method.chunks_mut' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.ChunksMut.html" title="struct core::slice::ChunksMut">ChunksMut</a><'a, T></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.ChunksMut.html" title="struct core::slice::ChunksMut">ChunksMut</a><'a, T></h3><code class="content"><span class="where fmt-newline">impl<'a, T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.ChunksMut.html" title="struct core::slice::ChunksMut">ChunksMut</a><'a, T></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a mut [T]</a>;</span></code></div></div><span id='chunks_mut.v' class='invisible'><code>pub fn <a href='#method.chunks_mut' class='fnname'>chunks_mut</a>(&mut self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.ChunksMut.html" title="struct core::slice::ChunksMut">ChunksMut</a><T></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#703-705' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time.
|
|||
|
The chunks are mutable slices, and do not overlap. If <code>chunk_size</code> does
|
|||
|
not divide the length of the slice, then the last chunk will not
|
|||
|
have length <code>chunk_size</code>.</p>
|
|||
|
<p>See <a href="#method.exact_chunks_mut"><code>exact_chunks_mut</code></a> for a variant of this iterator that returns chunks
|
|||
|
of always exactly <code>chunk_size</code> elements.</p>
|
|||
|
<h1 id="panics-9" class="section-header"><a href="#panics-9">Panics</a></h1>
|
|||
|
<p>Panics if <code>chunk_size</code> is 0.</p>
|
|||
|
<h1 id="examples-40" class="section-header"><a href="#examples-40">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> <span class="kw-2">&</span><span class="kw-2">mut</span> [<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>];
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">count</span> <span class="op">=</span> <span class="number">1</span>;
|
|||
|
|
|||
|
<span class="kw">for</span> <span class="ident">chunk</span> <span class="kw">in</span> <span class="ident">v</span>.<span class="ident">chunks_mut</span>(<span class="number">2</span>) {
|
|||
|
<span class="kw">for</span> <span class="ident">elem</span> <span class="kw">in</span> <span class="ident">chunk</span>.<span class="ident">iter_mut</span>() {
|
|||
|
<span class="kw-2">*</span><span class="ident">elem</span> <span class="op">+=</span> <span class="ident">count</span>;
|
|||
|
}
|
|||
|
<span class="ident">count</span> <span class="op">+=</span> <span class="number">1</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>, <span class="kw-2">&</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>]);</pre>
|
|||
|
</div><h4 id='method.exact_chunks_mut' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.ExactChunksMut.html" title="struct core::slice::ExactChunksMut">ExactChunksMut</a><'a, T></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.ExactChunksMut.html" title="struct core::slice::ExactChunksMut">ExactChunksMut</a><'a, T></h3><code class="content"><span class="where fmt-newline">impl<'a, T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.ExactChunksMut.html" title="struct core::slice::ExactChunksMut">ExactChunksMut</a><'a, T></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a mut [T]</a>;</span></code></div></div><span id='exact_chunks_mut.v' class='invisible'><code>pub fn <a href='#method.exact_chunks_mut' class='fnname'>exact_chunks_mut</a>(&mut self, chunk_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.ExactChunksMut.html" title="struct core::slice::ExactChunksMut">ExactChunksMut</a><T></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#741-743' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>exact_chunks</code>)</div></div><div class='docblock'><p>Returns an iterator over <code>chunk_size</code> elements of the slice at a time.
|
|||
|
The chunks are mutable slices, and do not overlap. If <code>chunk_size</code> does
|
|||
|
not divide the length of the slice, then the last up to <code>chunk_size-1</code>
|
|||
|
elements will be omitted.</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_mut"><code>chunks_mut</code></a>.</p>
|
|||
|
<h1 id="panics-10" class="section-header"><a href="#panics-10">Panics</a></h1>
|
|||
|
<p>Panics if <code>chunk_size</code> is 0.</p>
|
|||
|
<h1 id="examples-41" class="section-header"><a href="#examples-41">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">exact_chunks</span>)]</span>
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> <span class="kw-2">&</span><span class="kw-2">mut</span> [<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>];
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">count</span> <span class="op">=</span> <span class="number">1</span>;
|
|||
|
|
|||
|
<span class="kw">for</span> <span class="ident">chunk</span> <span class="kw">in</span> <span class="ident">v</span>.<span class="ident">exact_chunks_mut</span>(<span class="number">2</span>) {
|
|||
|
<span class="kw">for</span> <span class="ident">elem</span> <span class="kw">in</span> <span class="ident">chunk</span>.<span class="ident">iter_mut</span>() {
|
|||
|
<span class="kw-2">*</span><span class="ident">elem</span> <span class="op">+=</span> <span class="ident">count</span>;
|
|||
|
}
|
|||
|
<span class="ident">count</span> <span class="op">+=</span> <span class="number">1</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>, <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">0</span>]);</pre>
|
|||
|
</div><h4 id='method.split_at' class="method"><span id='split_at.v' class='invisible'><code>pub fn <a href='#method.split_at' class='fnname'>split_at</a>(&self, mid: <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.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[T]</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[T]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#780-782' title='goto source code'>[src]</a></span></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-11" class="section-header"><a href="#panics-11">Panics</a></h1>
|
|||
|
<p>Panics if <code>mid > len</code>.</p>
|
|||
|
<h1 id="examples-42" class="section-header"><a href="#examples-42">Examples</a></h1>
|
|||
|
<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</span><span class="macro">!</span>(<span class="ident">left</span> <span class="op">==</span> []);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">right</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">2</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">left</span> <span class="op">==</span> [<span class="number">1</span>, <span class="number">2</span>]);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">right</span> <span class="op">==</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</span><span class="macro">!</span>(<span class="ident">left</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="macro">assert</span><span class="macro">!</span>(<span class="ident">right</span> <span class="op">==</span> []);
|
|||
|
}</pre>
|
|||
|
</div><h4 id='method.split_at_mut' class="method"><span id='split_at_mut.v' class='invisible'><code>pub fn <a href='#method.split_at_mut' class='fnname'>split_at_mut</a>(&mut self, mid: <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.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [T]</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [T]</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#810-812' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Divides one mutable slice into two at an index.</p>
|
|||
|
<p>The first will contain all indices from <code>[0, mid)</code> (excluding
|
|||
|
the index <code>mid</code> itself) and the second will contain all
|
|||
|
indices from <code>[mid, len)</code> (excluding the index <code>len</code> itself).</p>
|
|||
|
<h1 id="panics-12" class="section-header"><a href="#panics-12">Panics</a></h1>
|
|||
|
<p>Panics if <code>mid > len</code>.</p>
|
|||
|
<h1 id="examples-43" class="section-header"><a href="#examples-43">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">1</span>, <span class="number">0</span>, <span class="number">3</span>, <span class="number">0</span>, <span class="number">5</span>, <span class="number">6</span>];
|
|||
|
<span class="comment">// scoped to restrict the lifetime of the borrows</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_mut</span>(<span class="number">2</span>);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">left</span> <span class="op">==</span> [<span class="number">1</span>, <span class="number">0</span>]);
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">right</span> <span class="op">==</span> [<span class="number">3</span>, <span class="number">0</span>, <span class="number">5</span>, <span class="number">6</span>]);
|
|||
|
<span class="ident">left</span>[<span class="number">1</span>] <span class="op">=</span> <span class="number">2</span>;
|
|||
|
<span class="ident">right</span>[<span class="number">1</span>] <span class="op">=</span> <span class="number">4</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert</span><span class="macro">!</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>]);</pre>
|
|||
|
</div><h4 id='method.split' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Split.html" title="struct core::slice::Split">Split</a><'a, T, P></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Split.html" title="struct core::slice::Split">Split</a><'a, T, P></h3><code class="content"><span class="where fmt-newline">impl<'a, T, P> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Split.html" title="struct core::slice::Split">Split</a><'a, T, P> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a [T]</a>;</span></code></div></div><span id='split.v' class='invisible'><code>pub fn <a href='#method.split' class='fnname'>split</a><F>(&self, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.Split.html" title="struct core::slice::Split">Split</a><T, F> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#856-860' title='goto source code'>[src]</a></span></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-44" class="section-header"><a href="#examples-44">Examples</a></h1>
|
|||
|
<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="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">&</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">&</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>
|
|||
|
<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>
|
|||
|
|
|||
|
<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="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">&</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">&</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>
|
|||
|
<p>If two matched elements are directly adjacent, an empty slice will be
|
|||
|
present between them:</p>
|
|||
|
|
|||
|
<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="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">&</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">&</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">&</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><h4 id='method.split_mut' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.SplitMut.html" title="struct core::slice::SplitMut">SplitMut</a><'a, T, P></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.SplitMut.html" title="struct core::slice::SplitMut">SplitMut</a><'a, T, P></h3><code class="content"><span class="where fmt-newline">impl<'a, T, P> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.SplitMut.html" title="struct core::slice::SplitMut">SplitMut</a><'a, T, P> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a mut [T]</a>;</span></code></div></div><span id='split_mut.v' class='invisible'><code>pub fn <a href='#method.split_mut' class='fnname'>split_mut</a><F>(&mut self, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.SplitMut.html" title="struct core::slice::SplitMut">SplitMut</a><T, F> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#877-881' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns an iterator over mutable subslices separated by elements that
|
|||
|
match <code>pred</code>. The matched element is not contained in the subslices.</p>
|
|||
|
<h1 id="examples-45" class="section-header"><a href="#examples-45">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</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">split_mut</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="number">0</span>) {
|
|||
|
<span class="ident">group</span>[<span class="number">0</span>] <span class="op">=</span> <span class="number">1</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>, [<span class="number">1</span>, <span class="number">40</span>, <span class="number">30</span>, <span class="number">1</span>, <span class="number">60</span>, <span class="number">1</span>]);</pre>
|
|||
|
</div><h4 id='method.rsplit' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplit.html" title="struct core::slice::RSplit">RSplit</a><'a, T, P></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplit.html" title="struct core::slice::RSplit">RSplit</a><'a, T, P></h3><code class="content"><span class="where fmt-newline">impl<'a, T, P> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplit.html" title="struct core::slice::RSplit">RSplit</a><'a, T, P> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a [T]</a>;</span></code></div></div><span id='rsplit.v' class='invisible'><code>pub fn <a href='#method.rsplit' class='fnname'>rsplit</a><F>(&self, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplit.html" title="struct core::slice::RSplit">RSplit</a><T, F> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#916-920' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>slice_rsplit</code>)</div></div><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-46" class="section-header"><a href="#examples-46">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">slice_rsplit</span>)]</span>
|
|||
|
|
|||
|
<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="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">&</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">&</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>
|
|||
|
<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>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">slice_rsplit</span>)]</span>
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> <span class="kw-2">&</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">8</span>];
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <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="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">&</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">&</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">&</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">&</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><h4 id='method.rsplit_mut' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplitMut.html" title="struct core::slice::RSplitMut">RSplitMut</a><'a, T, P></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplitMut.html" title="struct core::slice::RSplitMut">RSplitMut</a><'a, T, P></h3><code class="content"><span class="where fmt-newline">impl<'a, T, P> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplitMut.html" title="struct core::slice::RSplitMut">RSplitMut</a><'a, T, P> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a mut [T]</a>;</span></code></div></div><span id='rsplit_mut.v' class='invisible'><code>pub fn <a href='#method.rsplit_mut' class='fnname'>rsplit_mut</a><F>(&mut self, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplitMut.html" title="struct core::slice::RSplitMut">RSplitMut</a><T, F> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#943-947' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>slice_rsplit</code>)</div></div><div class='docblock'><p>Returns an iterator over mutable subslices separated by elements that
|
|||
|
match <code>pred</code>, starting at the end of the slice and working
|
|||
|
backwards. The matched element is not contained in the subslices.</p>
|
|||
|
<h1 id="examples-47" class="section-header"><a href="#examples-47">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">slice_rsplit</span>)]</span>
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">100</span>, <span class="number">400</span>, <span class="number">300</span>, <span class="number">200</span>, <span class="number">600</span>, <span class="number">500</span>];
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">count</span> <span class="op">=</span> <span class="number">0</span>;
|
|||
|
<span class="kw">for</span> <span class="ident">group</span> <span class="kw">in</span> <span class="ident">v</span>.<span class="ident">rsplit_mut</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="number">0</span>) {
|
|||
|
<span class="ident">count</span> <span class="op">+=</span> <span class="number">1</span>;
|
|||
|
<span class="ident">group</span>[<span class="number">0</span>] <span class="op">=</span> <span class="ident">count</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>, [<span class="number">3</span>, <span class="number">400</span>, <span class="number">300</span>, <span class="number">2</span>, <span class="number">600</span>, <span class="number">1</span>]);</pre>
|
|||
|
</div><h4 id='method.splitn' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.SplitN.html" title="struct core::slice::SplitN">SplitN</a><'a, T, P></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.SplitN.html" title="struct core::slice::SplitN">SplitN</a><'a, T, P></h3><code class="content"><span class="where fmt-newline">impl<'a, T, P> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.SplitN.html" title="struct core::slice::SplitN">SplitN</a><'a, T, P> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a [T]</a>;</span></code></div></div><span id='splitn.v' class='invisible'><code>pub fn <a href='#method.splitn' class='fnname'>splitn</a><F>(&self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.SplitN.html" title="struct core::slice::SplitN">SplitN</a><T, F> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#970-974' title='goto source code'>[src]</a></span></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-48" class="section-header"><a href="#examples-48">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>
|
|||
|
|
|||
|
<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="number">0</span>) {
|
|||
|
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"{:?}"</span>, <span class="ident">group</span>);
|
|||
|
}</pre>
|
|||
|
</div><h4 id='method.splitn_mut' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.SplitNMut.html" title="struct core::slice::SplitNMut">SplitNMut</a><'a, T, P></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.SplitNMut.html" title="struct core::slice::SplitNMut">SplitNMut</a><'a, T, P></h3><code class="content"><span class="where fmt-newline">impl<'a, T, P> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.SplitNMut.html" title="struct core::slice::SplitNMut">SplitNMut</a><'a, T, P> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a mut [T]</a>;</span></code></div></div><span id='splitn_mut.v' class='invisible'><code>pub fn <a href='#method.splitn_mut' class='fnname'>splitn_mut</a><F>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.SplitNMut.html" title="struct core::slice::SplitNMut">SplitNMut</a><T, F> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#995-999' title='goto source code'>[src]</a></span></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-49" class="section-header"><a href="#examples-49">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</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_mut</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="number">0</span>) {
|
|||
|
<span class="ident">group</span>[<span class="number">0</span>] <span class="op">=</span> <span class="number">1</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">v</span>, [<span class="number">1</span>, <span class="number">40</span>, <span class="number">30</span>, <span class="number">1</span>, <span class="number">60</span>, <span class="number">50</span>]);</pre>
|
|||
|
</div><h4 id='method.rsplitn' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplitN.html" title="struct core::slice::RSplitN">RSplitN</a><'a, T, P></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplitN.html" title="struct core::slice::RSplitN">RSplitN</a><'a, T, P></h3><code class="content"><span class="where fmt-newline">impl<'a, T, P> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplitN.html" title="struct core::slice::RSplitN">RSplitN</a><'a, T, P> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a [T]</a>;</span></code></div></div><span id='rsplitn.v' class='invisible'><code>pub fn <a href='#method.rsplitn' class='fnname'>rsplitn</a><F>(&self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplitN.html" title="struct core::slice::RSplitN">RSplitN</a><T, F> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1023-1027' title='goto source code'>[src]</a></span></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-50" class="section-header"><a href="#examples-50">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>
|
|||
|
|
|||
|
<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="number">0</span>) {
|
|||
|
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"{:?}"</span>, <span class="ident">group</span>);
|
|||
|
}</pre>
|
|||
|
</div><h4 id='method.rsplitn_mut' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplitNMut.html" title="struct core::slice::RSplitNMut">RSplitNMut</a><'a, T, P></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplitNMut.html" title="struct core::slice::RSplitNMut">RSplitNMut</a><'a, T, P></h3><code class="content"><span class="where fmt-newline">impl<'a, T, P> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplitNMut.html" title="struct core::slice::RSplitNMut">RSplitNMut</a><'a, T, P> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'a mut [T]</a>;</span></code></div></div><span id='rsplitn_mut.v' class='invisible'><code>pub fn <a href='#method.rsplitn_mut' class='fnname'>rsplitn_mut</a><F>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, pred: F) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/slice/struct.RSplitNMut.html" title="struct core::slice::RSplitNMut">RSplitNMut</a><T, F> <span class="where fmt-newline">where<br> 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">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1049-1053' title='goto source code'>[src]</a></span></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-51" class="section-header"><a href="#examples-51">Examples</a></h1>
|
|||
|
<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="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">s</span>.<span class="ident">rsplitn_mut</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="number">0</span>) {
|
|||
|
<span class="ident">group</span>[<span class="number">0</span>] <span class="op">=</span> <span class="number">1</span>;
|
|||
|
}
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">s</span>, [<span class="number">1</span>, <span class="number">40</span>, <span class="number">30</span>, <span class="number">20</span>, <span class="number">60</span>, <span class="number">1</span>]);</pre>
|
|||
|
</div><h4 id='method.contains' class="method"><span id='contains.v' class='invisible'><code>pub fn <a href='#method.contains' class='fnname'>contains</a>(&self, x: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><T>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1065-1069' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if the slice contains an element with the given value.</p>
|
|||
|
<h1 id="examples-52" class="section-header"><a href="#examples-52">Examples</a></h1>
|
|||
|
<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">&</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">&</span><span class="number">50</span>));</pre>
|
|||
|
</div><h4 id='method.starts_with' class="method"><span id='starts_with.v' class='invisible'><code>pub fn <a href='#method.starts_with' class='fnname'>starts_with</a>(&self, needle: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[T]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><T>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1092-1096' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if <code>needle</code> is a prefix of the slice.</p>
|
|||
|
<h1 id="examples-53" class="section-header"><a href="#examples-53">Examples</a></h1>
|
|||
|
<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">&</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">&</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">&</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">&</span>[<span class="number">10</span>, <span class="number">50</span>]));</pre>
|
|||
|
<p>Always returns <code>true</code> if <code>needle</code> is an empty slice:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">starts_with</span>(<span class="kw-2">&</span>[]));
|
|||
|
<span class="kw">let</span> <span class="ident">v</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>] <span class="op">=</span> <span class="kw-2">&</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">&</span>[]));</pre>
|
|||
|
</div><h4 id='method.ends_with' class="method"><span id='ends_with.v' class='invisible'><code>pub fn <a href='#method.ends_with' class='fnname'>ends_with</a>(&self, needle: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[T]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><T>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1119-1123' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns <code>true</code> if <code>needle</code> is a suffix of the slice.</p>
|
|||
|
<h1 id="examples-54" class="section-header"><a href="#examples-54">Examples</a></h1>
|
|||
|
<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">&</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">&</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">&</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">&</span>[<span class="number">50</span>, <span class="number">30</span>]));</pre>
|
|||
|
<p>Always returns <code>true</code> if <code>needle</code> is an empty slice:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">v</span> <span class="op">=</span> <span class="kw-2">&</span>[<span class="number">10</span>, <span class="number">40</span>, <span class="number">30</span>];
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span>.<span class="ident">ends_with</span>(<span class="kw-2">&</span>[]));
|
|||
|
<span class="kw">let</span> <span class="ident">v</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>] <span class="op">=</span> <span class="kw-2">&</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">&</span>[]));</pre>
|
|||
|
</div><h4 id='method.binary_search' class="method"><span id='binary_search.v' class='invisible'><code>pub fn <a href='#method.binary_search' class='fnname'>binary_search</a>(&self, x: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<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>> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1148-1152' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Binary searches this sorted slice for a given element.</p>
|
|||
|
<p>If the value is found then <code>Ok</code> is returned, containing the
|
|||
|
index of the matching element; if the value is not found then
|
|||
|
<code>Err</code> is returned, containing the index where a matching
|
|||
|
element could be inserted while maintaining sorted order.</p>
|
|||
|
<h1 id="examples-55" class="section-header"><a href="#examples-55">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>
|
|||
|
|
|||
|
<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">&</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">&</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">&</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">&</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="number">4</span>) <span class="op">=></span> <span class="bool-val">true</span>, _ <span class="op">=></span> <span class="bool-val">false</span>, });</pre>
|
|||
|
</div><h4 id='method.binary_search_by' class="method"><span id='binary_search_by.v' class='invisible'><code>pub fn <a href='#method.binary_search_by' class='fnname'>binary_search_by</a><'a, F>(&'a self, f: F) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<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>> <span class="where fmt-newline">where<br> 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">&'a </a>T) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1187-1191' title='goto source code'>[src]</a></span></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 a matching value is found then returns <code>Ok</code>, containing
|
|||
|
the index for the matched element; if no match is found then
|
|||
|
<code>Err</code> is returned, containing the index where a matching
|
|||
|
element could be inserted while maintaining sorted order.</p>
|
|||
|
<h1 id="examples-56" class="section-header"><a href="#examples-56">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>
|
|||
|
|
|||
|
<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">&</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">&</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">&</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">&</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="number">4</span>) <span class="op">=></span> <span class="bool-val">true</span>, _ <span class="op">=></span> <span class="bool-val">false</span>, });</pre>
|
|||
|
</div><h4 id='method.binary_search_by_key' class="method"><span id='binary_search_by_key.v' class='invisible'><code>pub fn <a href='#method.binary_search_by_key' class='fnname'>binary_search_by_key</a><'a, B, F>(<br> &'a self, <br> b: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>B, <br> f: F<br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<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>> <span class="where fmt-newline">where<br> B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,<br> 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">&'a </a>T) -> B, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.10.0'>1.10.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1225-1230' title='goto source code'>[src]</a></span></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 a matching value is found then returns <code>Ok</code>, containing the
|
|||
|
index for the matched element; if no match is found then <code>Err</code>
|
|||
|
is returned, containing the index where a matching element could
|
|||
|
be inserted while maintaining sorted order.</p>
|
|||
|
<h1 id="examples-57" class="section-header"><a href="#examples-57">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>
|
|||
|
|
|||
|
<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">&</span><span class="number">13</span>, <span class="op">|</span><span class="kw-2">&</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">&</span><span class="number">4</span>, <span class="op">|</span><span class="kw-2">&</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">&</span><span class="number">100</span>, <span class="op">|</span><span class="kw-2">&</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">&</span><span class="number">1</span>, <span class="op">|</span><span class="kw-2">&</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="number">4</span>) <span class="op">=></span> <span class="bool-val">true</span>, _ <span class="op">=></span> <span class="bool-val">false</span>, });</pre>
|
|||
|
</div><h4 id='method.sort' class="method"><span id='sort.v' class='invisible'><code>pub fn <a href='#method.sort' class='fnname'>sort</a>(&mut self) <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1260-1264' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Sorts the slice.</p>
|
|||
|
<p>This sort is stable (i.e. does not reorder equal elements) and <code>O(n log n)</code> worst-case.</p>
|
|||
|
<p>When applicable, unstable sorting is preferred because it is generally faster than stable
|
|||
|
sorting and it doesn't allocate auxiliary memory.
|
|||
|
See <a href="#method.sort_unstable"><code>sort_unstable</code></a>.</p>
|
|||
|
<h1 id="current-implementation" class="section-header"><a href="#current-implementation">Current implementation</a></h1>
|
|||
|
<p>The current algorithm is an adaptive, iterative merge sort inspired by
|
|||
|
<a href="https://en.wikipedia.org/wiki/Timsort">timsort</a>.
|
|||
|
It is designed to be very fast in cases where the slice is nearly sorted, or consists of
|
|||
|
two or more sorted sequences concatenated one after another.</p>
|
|||
|
<p>Also, it allocates temporary storage half the size of <code>self</code>, but for short slices a
|
|||
|
non-allocating insertion sort is used instead.</p>
|
|||
|
<h1 id="examples-58" class="section-header"><a href="#examples-58">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> [<span class="op">-</span><span class="number">5</span>, <span class="number">4</span>, <span class="number">1</span>, <span class="op">-</span><span class="number">3</span>, <span class="number">2</span>];
|
|||
|
|
|||
|
<span class="ident">v</span>.<span class="ident">sort</span>();
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span> <span class="op">==</span> [<span class="op">-</span><span class="number">5</span>, <span class="op">-</span><span class="number">3</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>]);</pre>
|
|||
|
</div><h4 id='method.sort_by' class="method"><span id='sort_by.v' class='invisible'><code>pub fn <a href='#method.sort_by' class='fnname'>sort_by</a><F>(&mut self, compare: F) <span class="where fmt-newline">where<br> 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">&</a>T, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1297-1301' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Sorts the slice with a comparator function.</p>
|
|||
|
<p>This sort is stable (i.e. does not reorder equal elements) and <code>O(n log n)</code> worst-case.</p>
|
|||
|
<p>When applicable, unstable sorting is preferred because it is generally faster than stable
|
|||
|
sorting and it doesn't allocate auxiliary memory.
|
|||
|
See <a href="#method.sort_unstable_by"><code>sort_unstable_by</code></a>.</p>
|
|||
|
<h1 id="current-implementation-1" class="section-header"><a href="#current-implementation-1">Current implementation</a></h1>
|
|||
|
<p>The current algorithm is an adaptive, iterative merge sort inspired by
|
|||
|
<a href="https://en.wikipedia.org/wiki/Timsort">timsort</a>.
|
|||
|
It is designed to be very fast in cases where the slice is nearly sorted, or consists of
|
|||
|
two or more sorted sequences concatenated one after another.</p>
|
|||
|
<p>Also, it allocates temporary storage half the size of <code>self</code>, but for short slices a
|
|||
|
non-allocating insertion sort is used instead.</p>
|
|||
|
<h1 id="examples-59" class="section-header"><a href="#examples-59">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">5</span>, <span class="number">4</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">2</span>];
|
|||
|
<span class="ident">v</span>.<span class="ident">sort_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="ident">cmp</span>(<span class="ident">b</span>));
|
|||
|
<span class="macro">assert</span><span class="macro">!</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="comment">// reverse sorting</span>
|
|||
|
<span class="ident">v</span>.<span class="ident">sort_by</span>(<span class="op">|</span><span class="ident">a</span>, <span class="ident">b</span><span class="op">|</span> <span class="ident">b</span>.<span class="ident">cmp</span>(<span class="ident">a</span>));
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span> <span class="op">==</span> [<span class="number">5</span>, <span class="number">4</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>]);</pre>
|
|||
|
</div><h4 id='method.sort_by_key' class="method"><span id='sort_by_key.v' class='invisible'><code>pub fn <a href='#method.sort_by_key' class='fnname'>sort_by_key</a><B, F>(&mut self, f: F) <span class="where fmt-newline">where<br> B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,<br> 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">&</a>T) -> B, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1331-1335' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Sorts the slice with a key extraction function.</p>
|
|||
|
<p>This sort is stable (i.e. does not reorder equal elements) and <code>O(n log n)</code> worst-case.</p>
|
|||
|
<p>When applicable, unstable sorting is preferred because it is generally faster than stable
|
|||
|
sorting and it doesn't allocate auxiliary memory.
|
|||
|
See <a href="#method.sort_unstable_by_key"><code>sort_unstable_by_key</code></a>.</p>
|
|||
|
<h1 id="current-implementation-2" class="section-header"><a href="#current-implementation-2">Current implementation</a></h1>
|
|||
|
<p>The current algorithm is an adaptive, iterative merge sort inspired by
|
|||
|
<a href="https://en.wikipedia.org/wiki/Timsort">timsort</a>.
|
|||
|
It is designed to be very fast in cases where the slice is nearly sorted, or consists of
|
|||
|
two or more sorted sequences concatenated one after another.</p>
|
|||
|
<p>Also, it allocates temporary storage half the size of <code>self</code>, but for short slices a
|
|||
|
non-allocating insertion sort is used instead.</p>
|
|||
|
<h1 id="examples-60" class="section-header"><a href="#examples-60">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> [<span class="op">-</span><span class="number">5i32</span>, <span class="number">4</span>, <span class="number">1</span>, <span class="op">-</span><span class="number">3</span>, <span class="number">2</span>];
|
|||
|
|
|||
|
<span class="ident">v</span>.<span class="ident">sort_by_key</span>(<span class="op">|</span><span class="ident">k</span><span class="op">|</span> <span class="ident">k</span>.<span class="ident">abs</span>());
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span> <span class="op">==</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="op">-</span><span class="number">3</span>, <span class="number">4</span>, <span class="op">-</span><span class="number">5</span>]);</pre>
|
|||
|
</div><h4 id='method.sort_unstable' class="method"><span id='sort_unstable.v' class='invisible'><code>pub fn <a href='#method.sort_unstable' class='fnname'>sort_unstable</a>(&mut self) <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.20.0'>1.20.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1365-1369' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Sorts the slice, but may not preserve the order of equal elements.</p>
|
|||
|
<p>This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate),
|
|||
|
and <code>O(n log n)</code> worst-case.</p>
|
|||
|
<h1 id="current-implementation-3" class="section-header"><a href="#current-implementation-3">Current implementation</a></h1>
|
|||
|
<p>The current algorithm is based on <a href="https://github.com/orlp/pdqsort">pattern-defeating quicksort</a> by Orson Peters,
|
|||
|
which combines the fast average case of randomized quicksort with the fast worst case of
|
|||
|
heapsort, while achieving linear time on slices with certain patterns. It uses some
|
|||
|
randomization to avoid degenerate cases, but with a fixed seed to always provide
|
|||
|
deterministic behavior.</p>
|
|||
|
<p>It is typically faster than stable sorting, except in a few special cases, e.g. when the
|
|||
|
slice consists of several concatenated sorted sequences.</p>
|
|||
|
<h1 id="examples-61" class="section-header"><a href="#examples-61">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> [<span class="op">-</span><span class="number">5</span>, <span class="number">4</span>, <span class="number">1</span>, <span class="op">-</span><span class="number">3</span>, <span class="number">2</span>];
|
|||
|
|
|||
|
<span class="ident">v</span>.<span class="ident">sort_unstable</span>();
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span> <span class="op">==</span> [<span class="op">-</span><span class="number">5</span>, <span class="op">-</span><span class="number">3</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">4</span>]);</pre>
|
|||
|
</div><h4 id='method.sort_unstable_by' class="method"><span id='sort_unstable_by.v' class='invisible'><code>pub fn <a href='#method.sort_unstable_by' class='fnname'>sort_unstable_by</a><F>(&mut self, compare: F) <span class="where fmt-newline">where<br> 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">&</a>T, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.20.0'>1.20.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1403-1407' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Sorts the slice with a comparator function, but may not preserve the order of equal
|
|||
|
elements.</p>
|
|||
|
<p>This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate),
|
|||
|
and <code>O(n log n)</code> worst-case.</p>
|
|||
|
<h1 id="current-implementation-4" class="section-header"><a href="#current-implementation-4">Current implementation</a></h1>
|
|||
|
<p>The current algorithm is based on <a href="https://github.com/orlp/pdqsort">pattern-defeating quicksort</a> by Orson Peters,
|
|||
|
which combines the fast average case of randomized quicksort with the fast worst case of
|
|||
|
heapsort, while achieving linear time on slices with certain patterns. It uses some
|
|||
|
randomization to avoid degenerate cases, but with a fixed seed to always provide
|
|||
|
deterministic behavior.</p>
|
|||
|
<p>It is typically faster than stable sorting, except in a few special cases, e.g. when the
|
|||
|
slice consists of several concatenated sorted sequences.</p>
|
|||
|
<h1 id="examples-62" class="section-header"><a href="#examples-62">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> [<span class="number">5</span>, <span class="number">4</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">2</span>];
|
|||
|
<span class="ident">v</span>.<span class="ident">sort_unstable_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="ident">cmp</span>(<span class="ident">b</span>));
|
|||
|
<span class="macro">assert</span><span class="macro">!</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="comment">// reverse sorting</span>
|
|||
|
<span class="ident">v</span>.<span class="ident">sort_unstable_by</span>(<span class="op">|</span><span class="ident">a</span>, <span class="ident">b</span><span class="op">|</span> <span class="ident">b</span>.<span class="ident">cmp</span>(<span class="ident">a</span>));
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span> <span class="op">==</span> [<span class="number">5</span>, <span class="number">4</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>]);</pre>
|
|||
|
</div><h4 id='method.sort_unstable_by_key' class="method"><span id='sort_unstable_by_key.v' class='invisible'><code>pub fn <a href='#method.sort_unstable_by_key' class='fnname'>sort_unstable_by_key</a><B, F>(&mut self, f: F) <span class="where fmt-newline">where<br> B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a>,<br> 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">&</a>T) -> B, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.20.0'>1.20.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1438-1443' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Sorts the slice with a key extraction function, but may not preserve the order of equal
|
|||
|
elements.</p>
|
|||
|
<p>This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate),
|
|||
|
and <code>O(n log n)</code> worst-case.</p>
|
|||
|
<h1 id="current-implementation-5" class="section-header"><a href="#current-implementation-5">Current implementation</a></h1>
|
|||
|
<p>The current algorithm is based on <a href="https://github.com/orlp/pdqsort">pattern-defeating quicksort</a> by Orson Peters,
|
|||
|
which combines the fast average case of randomized quicksort with the fast worst case of
|
|||
|
heapsort, while achieving linear time on slices with certain patterns. It uses some
|
|||
|
randomization to avoid degenerate cases, but with a fixed seed to always provide
|
|||
|
deterministic behavior.</p>
|
|||
|
<p>It is typically faster than stable sorting, except in a few special cases, e.g. when the
|
|||
|
slice consists of several concatenated sorted sequences.</p>
|
|||
|
<h1 id="examples-63" class="section-header"><a href="#examples-63">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">v</span> <span class="op">=</span> [<span class="op">-</span><span class="number">5i32</span>, <span class="number">4</span>, <span class="number">1</span>, <span class="op">-</span><span class="number">3</span>, <span class="number">2</span>];
|
|||
|
|
|||
|
<span class="ident">v</span>.<span class="ident">sort_unstable_by_key</span>(<span class="op">|</span><span class="ident">k</span><span class="op">|</span> <span class="ident">k</span>.<span class="ident">abs</span>());
|
|||
|
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">v</span> <span class="op">==</span> [<span class="number">1</span>, <span class="number">2</span>, <span class="op">-</span><span class="number">3</span>, <span class="number">4</span>, <span class="op">-</span><span class="number">5</span>]);</pre>
|
|||
|
</div><h4 id='method.rotate_left' class="method"><span id='rotate_left.v' class='invisible'><code>pub fn <a href='#method.rotate_left' class='fnname'>rotate_left</a>(&mut self, mid: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1480-1482' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>slice_rotate</code>)</div></div><div class='docblock'><p>Rotates the slice in-place such that the first <code>mid</code> elements of the
|
|||
|
slice move to the end while the last <code>self.len() - mid</code> elements move to
|
|||
|
the front. After calling <code>rotate_left</code>, the element previously at index
|
|||
|
<code>mid</code> will become the first element in the slice.</p>
|
|||
|
<h1 id="panics-13" class="section-header"><a href="#panics-13">Panics</a></h1>
|
|||
|
<p>This function will panic if <code>mid</code> is greater than the length of the
|
|||
|
slice. Note that <code>mid == self.len()</code> does <em>not</em> panic and is a no-op
|
|||
|
rotation.</p>
|
|||
|
<h1 id="complexity" class="section-header"><a href="#complexity">Complexity</a></h1>
|
|||
|
<p>Takes linear (in <code>self.len()</code>) time.</p>
|
|||
|
<h1 id="examples-64" class="section-header"><a href="#examples-64">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">slice_rotate</span>)]</span>
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">a</span> <span class="op">=</span> [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'e'</span>, <span class="string">'f'</span>];
|
|||
|
<span class="ident">a</span>.<span class="ident">rotate_left</span>(<span class="number">2</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">a</span>, [<span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'e'</span>, <span class="string">'f'</span>, <span class="string">'a'</span>, <span class="string">'b'</span>]);</pre>
|
|||
|
<p>Rotating a subslice:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">slice_rotate</span>)]</span>
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">a</span> <span class="op">=</span> [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'e'</span>, <span class="string">'f'</span>];
|
|||
|
<span class="ident">a</span>[<span class="number">1</span>..<span class="number">5</span>].<span class="ident">rotate_left</span>(<span class="number">1</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">a</span>, [<span class="string">'a'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'e'</span>, <span class="string">'b'</span>, <span class="string">'f'</span>]);</pre>
|
|||
|
</div><h4 id='method.rotate' class="method"><span id='rotate.v' class='invisible'><code>pub fn <a href='#method.rotate' class='fnname'>rotate</a>(&mut self, mid: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1486-1488' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>slice_rotate</code>)</div></div><h4 id='method.rotate_right' class="method"><span id='rotate_right.v' class='invisible'><code>pub fn <a href='#method.rotate_right' class='fnname'>rotate_right</a>(&mut self, k: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1525-1527' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>slice_rotate</code>)</div></div><div class='docblock'><p>Rotates the slice in-place such that the first <code>self.len() - k</code>
|
|||
|
elements of the slice move to the end while the last <code>k</code> elements move
|
|||
|
to the front. After calling <code>rotate_right</code>, the element previously at
|
|||
|
index <code>self.len() - k</code> will become the first element in the slice.</p>
|
|||
|
<h1 id="panics-14" class="section-header"><a href="#panics-14">Panics</a></h1>
|
|||
|
<p>This function will panic if <code>k</code> is greater than the length of the
|
|||
|
slice. Note that <code>k == self.len()</code> does <em>not</em> panic and is a no-op
|
|||
|
rotation.</p>
|
|||
|
<h1 id="complexity-1" class="section-header"><a href="#complexity-1">Complexity</a></h1>
|
|||
|
<p>Takes linear (in <code>self.len()</code>) time.</p>
|
|||
|
<h1 id="examples-65" class="section-header"><a href="#examples-65">Examples</a></h1>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">slice_rotate</span>)]</span>
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">a</span> <span class="op">=</span> [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'e'</span>, <span class="string">'f'</span>];
|
|||
|
<span class="ident">a</span>.<span class="ident">rotate_right</span>(<span class="number">2</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">a</span>, [<span class="string">'e'</span>, <span class="string">'f'</span>, <span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>]);</pre>
|
|||
|
<p>Rotate a subslice:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">slice_rotate</span>)]</span>
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">a</span> <span class="op">=</span> [<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'e'</span>, <span class="string">'f'</span>];
|
|||
|
<span class="ident">a</span>[<span class="number">1</span>..<span class="number">5</span>].<span class="ident">rotate_right</span>(<span class="number">1</span>);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">a</span>, [<span class="string">'a'</span>, <span class="string">'e'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>, <span class="string">'d'</span>, <span class="string">'f'</span>]);</pre>
|
|||
|
</div><h4 id='method.clone_from_slice' class="method"><span id='clone_from_slice.v' class='invisible'><code>pub fn <a href='#method.clone_from_slice' class='fnname'>clone_from_slice</a>(&mut self, src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[T]</a>) <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1582-1584' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Copies the elements from <code>src</code> into <code>self</code>.</p>
|
|||
|
<p>The length of <code>src</code> must be the same as <code>self</code>.</p>
|
|||
|
<p>If <code>src</code> implements <code>Copy</code>, it can be more performant to use
|
|||
|
<a href="#method.copy_from_slice"><code>copy_from_slice</code></a>.</p>
|
|||
|
<h1 id="panics-15" class="section-header"><a href="#panics-15">Panics</a></h1>
|
|||
|
<p>This function will panic if the two slices have different lengths.</p>
|
|||
|
<h1 id="examples-66" class="section-header"><a href="#examples-66">Examples</a></h1>
|
|||
|
<p>Cloning two elements from a slice into another:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">src</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="kw">let</span> <span class="kw-2">mut</span> <span class="ident">dst</span> <span class="op">=</span> [<span class="number">0</span>, <span class="number">0</span>];
|
|||
|
|
|||
|
<span class="ident">dst</span>.<span class="ident">clone_from_slice</span>(<span class="kw-2">&</span><span class="ident">src</span>[<span class="number">2</span>..]);
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">src</span>, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">dst</span>, [<span class="number">3</span>, <span class="number">4</span>]);</pre>
|
|||
|
<p>Rust enforces that there can only be one mutable reference with no
|
|||
|
immutable references to a particular piece of data in a particular
|
|||
|
scope. Because of this, attempting to use <code>clone_from_slice</code> on a
|
|||
|
single slice will result in a compile failure:</p>
|
|||
|
|
|||
|
<div class='information'><div class='tooltip compile_fail'>ⓘ<span class='tooltiptext'>This example deliberately fails to compile</span></div></div><pre class="rust rust-example-rendered compile_fail">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">slice</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="ident">slice</span>[..<span class="number">2</span>].<span class="ident">clone_from_slice</span>(<span class="kw-2">&</span><span class="ident">slice</span>[<span class="number">3</span>..]); <span class="comment">// compile fail!</span></pre>
|
|||
|
<p>To work around this, we can use <a href="#method.split_at_mut"><code>split_at_mut</code></a> to create two distinct
|
|||
|
sub-slices from a slice:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">slice</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="kw">let</span> (<span class="ident">left</span>, <span class="ident">right</span>) <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">split_at_mut</span>(<span class="number">2</span>);
|
|||
|
<span class="ident">left</span>.<span class="ident">clone_from_slice</span>(<span class="kw-2">&</span><span class="ident">right</span>[<span class="number">1</span>..]);
|
|||
|
}
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">slice</span>, [<span class="number">4</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]);</pre>
|
|||
|
</div><h4 id='method.copy_from_slice' class="method"><span id='copy_from_slice.v' class='invisible'><code>pub fn <a href='#method.copy_from_slice' class='fnname'>copy_from_slice</a>(&mut self, src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[T]</a>) <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.9.0'>1.9.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1638-1640' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Copies all elements from <code>src</code> into <code>self</code>, using a memcpy.</p>
|
|||
|
<p>The length of <code>src</code> must be the same as <code>self</code>.</p>
|
|||
|
<p>If <code>src</code> does not implement <code>Copy</code>, use <a href="#method.clone_from_slice"><code>clone_from_slice</code></a>.</p>
|
|||
|
<h1 id="panics-16" class="section-header"><a href="#panics-16">Panics</a></h1>
|
|||
|
<p>This function will panic if the two slices have different lengths.</p>
|
|||
|
<h1 id="examples-67" class="section-header"><a href="#examples-67">Examples</a></h1>
|
|||
|
<p>Copying two elements from a slice into another:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="ident">src</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="kw">let</span> <span class="kw-2">mut</span> <span class="ident">dst</span> <span class="op">=</span> [<span class="number">0</span>, <span class="number">0</span>];
|
|||
|
|
|||
|
<span class="ident">dst</span>.<span class="ident">copy_from_slice</span>(<span class="kw-2">&</span><span class="ident">src</span>[<span class="number">2</span>..]);
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">src</span>, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">dst</span>, [<span class="number">3</span>, <span class="number">4</span>]);</pre>
|
|||
|
<p>Rust enforces that there can only be one mutable reference with no
|
|||
|
immutable references to a particular piece of data in a particular
|
|||
|
scope. Because of this, attempting to use <code>copy_from_slice</code> on a
|
|||
|
single slice will result in a compile failure:</p>
|
|||
|
|
|||
|
<div class='information'><div class='tooltip compile_fail'>ⓘ<span class='tooltiptext'>This example deliberately fails to compile</span></div></div><pre class="rust rust-example-rendered compile_fail">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">slice</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="ident">slice</span>[..<span class="number">2</span>].<span class="ident">copy_from_slice</span>(<span class="kw-2">&</span><span class="ident">slice</span>[<span class="number">3</span>..]); <span class="comment">// compile fail!</span></pre>
|
|||
|
<p>To work around this, we can use <a href="#method.split_at_mut"><code>split_at_mut</code></a> to create two distinct
|
|||
|
sub-slices from a slice:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">slice</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="kw">let</span> (<span class="ident">left</span>, <span class="ident">right</span>) <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">split_at_mut</span>(<span class="number">2</span>);
|
|||
|
<span class="ident">left</span>.<span class="ident">copy_from_slice</span>(<span class="kw-2">&</span><span class="ident">right</span>[<span class="number">1</span>..]);
|
|||
|
}
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">slice</span>, [<span class="number">4</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]);</pre>
|
|||
|
</div><h4 id='method.swap_with_slice' class="method"><span id='swap_with_slice.v' class='invisible'><code>pub fn <a href='#method.swap_with_slice' class='fnname'>swap_with_slice</a>(&mut self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [T]</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1696-1698' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='stability'><div class='stab unstable'><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>swap_with_slice</code>)</div></div><div class='docblock'><p>Swaps all elements in <code>self</code> with those in <code>other</code>.</p>
|
|||
|
<p>The length of <code>other</code> must be the same as <code>self</code>.</p>
|
|||
|
<h1 id="panics-17" class="section-header"><a href="#panics-17">Panics</a></h1>
|
|||
|
<p>This function will panic if the two slices have different lengths.</p>
|
|||
|
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
|
|||
|
<p>Swapping two elements across slices:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">swap_with_slice</span>)]</span>
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">slice1</span> <span class="op">=</span> [<span class="number">0</span>, <span class="number">0</span>];
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">slice2</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="ident">slice1</span>.<span class="ident">swap_with_slice</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">slice2</span>[<span class="number">2</span>..]);
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">slice1</span>, [<span class="number">3</span>, <span class="number">4</span>]);
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">slice2</span>, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">0</span>]);</pre>
|
|||
|
<p>Rust enforces that there can only be one mutable reference to a
|
|||
|
particular piece of data in a particular scope. Because of this,
|
|||
|
attempting to use <code>swap_with_slice</code> on a single slice will result in
|
|||
|
a compile failure:</p>
|
|||
|
|
|||
|
<div class='information'><div class='tooltip compile_fail'>ⓘ<span class='tooltiptext'>This example deliberately fails to compile</span></div></div><pre class="rust rust-example-rendered compile_fail">
|
|||
|
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">swap_with_slice</span>)]</span>
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">slice</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="ident">slice</span>[..<span class="number">2</span>].<span class="ident">swap_with_slice</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">slice</span>[<span class="number">3</span>..]); <span class="comment">// compile fail!</span></pre>
|
|||
|
<p>To work around this, we can use <a href="#method.split_at_mut"><code>split_at_mut</code></a> to create two distinct
|
|||
|
mutable sub-slices from a slice:</p>
|
|||
|
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="attribute">#![<span class="ident">feature</span>(<span class="ident">swap_with_slice</span>)]</span>
|
|||
|
|
|||
|
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">slice</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="kw">let</span> (<span class="ident">left</span>, <span class="ident">right</span>) <span class="op">=</span> <span class="ident">slice</span>.<span class="ident">split_at_mut</span>(<span class="number">2</span>);
|
|||
|
<span class="ident">left</span>.<span class="ident">swap_with_slice</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">right</span>[<span class="number">1</span>..]);
|
|||
|
}
|
|||
|
|
|||
|
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">slice</span>, [<span class="number">4</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">1</span>, <span class="number">2</span>]);</pre>
|
|||
|
</div><h4 id='method.to_vec' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></h3><code class="content"><span class="where fmt-newline">impl <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="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></span></code></div></div><span id='to_vec.v' class='invisible'><code>pub fn <a href='#method.to_vec' class='fnname'>to_vec</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1712-1717' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Copies <code>self</code> into a new <code>Vec</code>.</p>
|
|||
|
<h1 id="examples-68" class="section-header"><a href="#examples-68">Examples</a></h1>
|
|||
|
<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><div class='impl-items'><h4 id='method.is_ascii' class="method"><span id='is_ascii.v' class='invisible'><code>pub fn <a href='#method.is_ascii' class='fnname'>is_ascii</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.23.0'>1.23.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1747-1749' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Checks if all bytes in this slice are within the ASCII range.</p>
|
|||
|
</div><h4 id='method.to_ascii_uppercase' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></h3><code class="content"><span class="where fmt-newline">impl <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="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></span></code></div></div><span id='to_ascii_uppercase.v' class='invisible'><code>pub fn <a href='#method.to_ascii_uppercase' class='fnname'>to_ascii_uppercase</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.23.0'>1.23.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1762-1766' title='goto source code'>[src]</a></span></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="#method.make_ascii_uppercase"><code>make_ascii_uppercase</code></a>.</p>
|
|||
|
</div><h4 id='method.to_ascii_lowercase' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></h3><code class="content"><span class="where fmt-newline">impl <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="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></span></code></div></div><span id='to_ascii_lowercase.v' class='invisible'><code>pub fn <a href='#method.to_ascii_lowercase' class='fnname'>to_ascii_lowercase</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.23.0'>1.23.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1779-1783' title='goto source code'>[src]</a></span></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="#method.make_ascii_lowercase"><code>make_ascii_lowercase</code></a>.</p>
|
|||
|
</div><h4 id='method.eq_ignore_ascii_case' class="method"><span id='eq_ignore_ascii_case.v' class='invisible'><code>pub fn <a href='#method.eq_ignore_ascii_case' class='fnname'>eq_ignore_ascii_case</a>(&self, other: <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>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.23.0'>1.23.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1791-1796' title='goto source code'>[src]</a></span></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><h4 id='method.make_ascii_uppercase' class="method"><span id='make_ascii_uppercase.v' class='invisible'><code>pub fn <a href='#method.make_ascii_uppercase' class='fnname'>make_ascii_uppercase</a>(&mut self)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.23.0'>1.23.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1809-1813' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Converts this slice to its ASCII upper case equivalent in-place.</p>
|
|||
|
<p>ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
|
|||
|
but non-ASCII letters are unchanged.</p>
|
|||
|
<p>To return a new uppercased value without modifying the existing one, use
|
|||
|
<a href="#method.to_ascii_uppercase"><code>to_ascii_uppercase</code></a>.</p>
|
|||
|
</div><h4 id='method.make_ascii_lowercase' class="method"><span id='make_ascii_lowercase.v' class='invisible'><code>pub fn <a href='#method.make_ascii_lowercase' class='fnname'>make_ascii_lowercase</a>(&mut self)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.23.0'>1.23.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/alloc/slice.rs.html#1826-1830' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Converts this slice to its ASCII lower case equivalent in-place.</p>
|
|||
|
<p>ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
|
|||
|
but non-ASCII letters are unchanged.</p>
|
|||
|
<p>To return a new lowercased value without modifying the existing one, use
|
|||
|
<a href="#method.to_ascii_lowercase"><code>to_ascii_lowercase</code></a>.</p>
|
|||
|
</div></div>
|
|||
|
<h2 id='implementations' class='small-section-header'>
|
|||
|
Trait Implementations<a href='#implementations' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<h3 id='impl-FromBuf' class='impl'><span class='in-band'><code>impl <a class="trait" href="../bytes/buf/trait.FromBuf.html" title="trait bytes::buf::FromBuf">FromBuf</a> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-FromBuf' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/from_buf.rs.html#108-117' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.from_buf' class="method"><span id='from_buf.v' class='invisible'><code>fn <a href='../bytes/buf/trait.FromBuf.html#tymethod.from_buf' class='fnname'>from_buf</a><T>(buf: T) -> Self <span class="where fmt-newline">where<br> T: <a class="trait" href="../bytes/buf/trait.IntoBuf.html" title="trait bytes::buf::IntoBuf">IntoBuf</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/from_buf.rs.html#109-116' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Creates a value from a buffer. <a href="../bytes/buf/trait.FromBuf.html#tymethod.from_buf">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-From%3CBytesMut%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for <a class="struct" href="../bytes/struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></code><a href='#impl-From%3CBytesMut%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#837-841' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.from' class="method"><span id='from.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(src: <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="struct" href="../bytes/struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#838-840' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Performs the conversion.</p>
|
|||
|
</div></div><h3 id='impl-FromIterator%3Cu8%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.FromIterator.html" title="trait core::iter::traits::FromIterator">FromIterator</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-FromIterator%3Cu8%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#867-881' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.from_iter' class="method"><span id='from_iter.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.FromIterator.html#tymethod.from_iter' class='fnname'>from_iter</a><T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>>(into_iter: T) -> Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#868-880' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Creates a value from an iterator. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.FromIterator.html#tymethod.from_iter">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-BufMut' class='impl'><span class='in-band'><code>impl <a class="trait" href="../bytes/buf/trait.BufMut.html" title="trait bytes::buf::BufMut">BufMut</a> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-BufMut' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1466-1509' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.remaining_mut' class="method"><span id='remaining_mut.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#tymethod.remaining_mut' class='fnname'>remaining_mut</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1468-1470' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns the number of bytes that can be written from the current position until the end of the buffer is reached. <a href="../bytes/buf/trait.BufMut.html#tymethod.remaining_mut">Read more</a></p>
|
|||
|
</div><h4 id='method.advance_mut' class="method"><span id='advance_mut.v' class='invisible'><code>unsafe fn <a href='../bytes/buf/trait.BufMut.html#tymethod.advance_mut' class='fnname'>advance_mut</a>(&mut self, cnt: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1473-1478' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Advance the internal cursor of the BufMut <a href="../bytes/buf/trait.BufMut.html#tymethod.advance_mut">Read more</a></p>
|
|||
|
</div><h4 id='method.bytes_mut' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></h3><code class="content"><span class="where fmt-newline">impl<'a> <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">&'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><span class="where fmt-newline">impl<'a> <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">&'a 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></div></div><span id='bytes_mut.v' class='invisible'><code>unsafe fn <a href='../bytes/buf/trait.BufMut.html#tymethod.bytes_mut' class='fnname'>bytes_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&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></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1481-1486' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns a mutable slice starting at the current BufMut position and of length between 0 and <code>BufMut::remaining_mut()</code>. <a href="../bytes/buf/trait.BufMut.html#tymethod.bytes_mut">Read more</a></p>
|
|||
|
</div><h4 id='method.put_slice' class="method"><span id='put_slice.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_slice' class='fnname'>put_slice</a>(&mut self, src: <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></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1489-1498' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Transfer bytes into <code>self</code> from <code>src</code> and advance the cursor by the number of bytes written. <a href="../bytes/buf/trait.BufMut.html#method.put_slice">Read more</a></p>
|
|||
|
</div><h4 id='method.put_u8' class="method"><span id='put_u8.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_u8' class='fnname'>put_u8</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1501-1503' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes an unsigned 8 bit integer to <code>self</code>. <a href="../bytes/buf/trait.BufMut.html#method.put_u8">Read more</a></p>
|
|||
|
</div><h4 id='method.put_i8' class="method"><span id='put_i8.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_i8' class='fnname'>put_i8</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1506-1508' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes a signed 8 bit integer to <code>self</code>. <a href="../bytes/buf/trait.BufMut.html#method.put_i8">Read more</a></p>
|
|||
|
</div><h4 id='method.has_remaining_mut' class="method"><span id='has_remaining_mut.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.has_remaining_mut' class='fnname'>has_remaining_mut</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#119-121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns true if there is space in <code>self</code> for more bytes. <a href="../bytes/buf/trait.BufMut.html#method.has_remaining_mut">Read more</a></p>
|
|||
|
</div><h4 id='method.bytes_vec_mut' class="method"><span id='bytes_vec_mut.v' class='invisible'><code>unsafe fn <a href='../bytes/buf/trait.BufMut.html#method.bytes_vec_mut' class='fnname'>bytes_vec_mut</a><'a>(&'a mut self, dst: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a>&'a mut <a class="struct" href="../iovec/struct.IoVec.html" title="struct iovec::IoVec">IoVec</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.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#191-202' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Fills <code>dst</code> with potentially multiple mutable slices starting at <code>self</code>'s current position. <a href="../bytes/buf/trait.BufMut.html#method.bytes_vec_mut">Read more</a></p>
|
|||
|
</div><h4 id='method.put' class="method"><span id='put.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put' class='fnname'>put</a><T: <a class="trait" href="../bytes/buf/trait.IntoBuf.html" title="trait bytes::buf::IntoBuf">IntoBuf</a>>(&mut self, src: T) <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#224-248' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Transfer bytes into <code>self</code> from <code>src</code> and advance the cursor by the number of bytes written. <a href="../bytes/buf/trait.BufMut.html#method.put">Read more</a></p>
|
|||
|
</div><h4 id='method.put_u16_be' class="method"><span id='put_u16_be.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_u16_be' class='fnname'>put_u16_be</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#367-371' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes an unsigned 16 bit integer to <code>self</code> in big-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_u16_be">Read more</a></p>
|
|||
|
</div><h4 id='method.put_u16_le' class="method"><span id='put_u16_le.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_u16_le' class='fnname'>put_u16_le</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#391-395' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes an unsigned 16 bit integer to <code>self</code> in little-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_u16_le">Read more</a></p>
|
|||
|
</div><h4 id='method.put_i16_be' class="method"><span id='put_i16_be.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_i16_be' class='fnname'>put_i16_be</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#423-427' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes a signed 16 bit integer to <code>self</code> in big-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_i16_be">Read more</a></p>
|
|||
|
</div><h4 id='method.put_i16_le' class="method"><span id='put_i16_le.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_i16_le' class='fnname'>put_i16_le</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#447-451' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes a signed 16 bit integer to <code>self</code> in little-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_i16_le">Read more</a></p>
|
|||
|
</div><h4 id='method.put_u32_be' class="method"><span id='put_u32_be.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_u32_be' class='fnname'>put_u32_be</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#479-483' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes an unsigned 32 bit integer to <code>self</code> in big-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_u32_be">Read more</a></p>
|
|||
|
</div><h4 id='method.put_u32_le' class="method"><span id='put_u32_le.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_u32_le' class='fnname'>put_u32_le</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#503-507' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes an unsigned 32 bit integer to <code>self</code> in little-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_u32_le">Read more</a></p>
|
|||
|
</div><h4 id='method.put_i32_be' class="method"><span id='put_i32_be.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_i32_be' class='fnname'>put_i32_be</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#535-539' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes a signed 32 bit integer to <code>self</code> in big-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_i32_be">Read more</a></p>
|
|||
|
</div><h4 id='method.put_i32_le' class="method"><span id='put_i32_le.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_i32_le' class='fnname'>put_i32_le</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#559-563' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes a signed 32 bit integer to <code>self</code> in little-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_i32_le">Read more</a></p>
|
|||
|
</div><h4 id='method.put_u64_be' class="method"><span id='put_u64_be.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_u64_be' class='fnname'>put_u64_be</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#591-595' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes an unsigned 64 bit integer to <code>self</code> in the big-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_u64_be">Read more</a></p>
|
|||
|
</div><h4 id='method.put_u64_le' class="method"><span id='put_u64_le.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_u64_le' class='fnname'>put_u64_le</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#615-619' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes an unsigned 64 bit integer to <code>self</code> in little-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_u64_le">Read more</a></p>
|
|||
|
</div><h4 id='method.put_i64_be' class="method"><span id='put_i64_be.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_i64_be' class='fnname'>put_i64_be</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#647-651' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes a signed 64 bit integer to <code>self</code> in the big-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_i64_be">Read more</a></p>
|
|||
|
</div><h4 id='method.put_i64_le' class="method"><span id='put_i64_le.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_i64_le' class='fnname'>put_i64_le</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#671-675' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes a signed 64 bit integer to <code>self</code> in little-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_i64_le">Read more</a></p>
|
|||
|
</div><h4 id='method.put_uint_be' class="method"><span id='put_uint_be.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_uint_be' class='fnname'>put_uint_be</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#807-811' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes an unsigned n-byte integer to <code>self</code> in big-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_uint_be">Read more</a></p>
|
|||
|
</div><h4 id='method.put_uint_le' class="method"><span id='put_uint_le.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_uint_le' class='fnname'>put_uint_le</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#831-835' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes an unsigned n-byte integer to <code>self</code> in the little-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_uint_le">Read more</a></p>
|
|||
|
</div><h4 id='method.put_int_be' class="method"><span id='put_int_be.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_int_be' class='fnname'>put_int_be</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#863-867' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes a signed n-byte integer to <code>self</code> in big-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_int_be">Read more</a></p>
|
|||
|
</div><h4 id='method.put_int_le' class="method"><span id='put_int_le.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_int_le' class='fnname'>put_int_le</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, nbytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#887-891' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes a signed n-byte integer to <code>self</code> in little-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_int_le">Read more</a></p>
|
|||
|
</div><h4 id='method.put_f32_be' class="method"><span id='put_f32_be.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_f32_be' class='fnname'>put_f32_be</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#920-924' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes an IEEE754 single-precision (4 bytes) floating point number to <code>self</code> in big-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_f32_be">Read more</a></p>
|
|||
|
</div><h4 id='method.put_f32_le' class="method"><span id='put_f32_le.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_f32_le' class='fnname'>put_f32_le</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#945-949' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes an IEEE754 single-precision (4 bytes) floating point number to <code>self</code> in little-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_f32_le">Read more</a></p>
|
|||
|
</div><h4 id='method.put_f64_be' class="method"><span id='put_f64_be.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_f64_be' class='fnname'>put_f64_be</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#978-982' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes an IEEE754 double-precision (8 bytes) floating point number to <code>self</code> in big-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_f64_be">Read more</a></p>
|
|||
|
</div><h4 id='method.put_f64_le' class="method"><span id='put_f64_le.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.put_f64_le' class='fnname'>put_f64_le</a>(&mut self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#1003-1007' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes an IEEE754 double-precision (8 bytes) floating point number to <code>self</code> in little-endian byte order. <a href="../bytes/buf/trait.BufMut.html#method.put_f64_le">Read more</a></p>
|
|||
|
</div><h4 id='method.by_ref' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut </a>R</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut </a>R</h3><code class="content"><span class="where fmt-newline">impl<'a, R> <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.reference.html">&'a mut </a>R <span class="where fmt-newline">where<br> R: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></span><span class="where fmt-newline">impl<'a, W> <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.reference.html">&'a mut </a>W <span class="where fmt-newline">where<br> W: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></span><span class="where fmt-newline">impl<'a, I> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut </a>I <span class="where fmt-newline">where<br> I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></span><span class="where fmt-newline"> type <a href='https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item' class="type">Item</a> = <I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html" title="trait core::iter::iterator::Iterator">Iterator</a>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/iterator/trait.Iterator.html#associatedtype.Item" title="type core::iter::iterator::Iterator::Item">Item</a>;</span></code></div></div><span id='by_ref.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.by_ref' class='fnname'>by_ref</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#1034-1036' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Creates a "by reference" adaptor for this instance of <code>BufMut</code>. <a href="../bytes/buf/trait.BufMut.html#method.by_ref">Read more</a></p>
|
|||
|
</div><h4 id='method.writer' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="../bytes/buf/struct.Writer.html" title="struct bytes::buf::Writer">Writer</a><B></span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="../bytes/buf/struct.Writer.html" title="struct bytes::buf::Writer">Writer</a><B></h3><code class="content"><span class="where fmt-newline">impl<B: <a class="trait" href="../bytes/buf/trait.BufMut.html" title="trait bytes::buf::BufMut">BufMut</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>> <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="struct" href="../bytes/buf/struct.Writer.html" title="struct bytes::buf::Writer">Writer</a><B></span></code></div></div><span id='writer.v' class='invisible'><code>fn <a href='../bytes/buf/trait.BufMut.html#method.writer' class='fnname'>writer</a>(self) -> <a class="struct" href="../bytes/buf/struct.Writer.html" title="struct bytes::buf::Writer">Writer</a><Self> <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/buf/buf_mut.rs.html#1060-1062' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Creates an adaptor which implements the <code>Write</code> trait for <code>self</code>. <a href="../bytes/buf/trait.BufMut.html#method.writer">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-IntoBuf' class='impl'><span class='in-band'><code>impl <a class="trait" href="../bytes/buf/trait.IntoBuf.html" title="trait bytes::buf::IntoBuf">IntoBuf</a> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-IntoBuf' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1511-1517' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='associatedtype.Buf' class="type"><span id='Buf.t' class='invisible'><code>type <a href='../bytes/buf/trait.IntoBuf.html#associatedtype.Buf' class="type">Buf</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/cursor/struct.Cursor.html" title="struct std::io::cursor::Cursor">Cursor</a><Self></code></span></h4>
|
|||
|
<div class='docblock'><p>The <code>Buf</code> type that <code>self</code> is being converted into</p>
|
|||
|
</div><h4 id='method.into_buf' class="method"><span id='into_buf.v' class='invisible'><code>fn <a href='../bytes/buf/trait.IntoBuf.html#tymethod.into_buf' class='fnname'>into_buf</a>(self) -> Self::<a class="type" href="../bytes/buf/trait.IntoBuf.html#associatedtype.Buf" title="type bytes::buf::IntoBuf::Buf">Buf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1514-1516' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Creates a <code>Buf</code> from a value. <a href="../bytes/buf/trait.IntoBuf.html#tymethod.into_buf">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-IntoBuf-1' class='impl'><span class='in-band'><code>impl<'a> <a class="trait" href="../bytes/buf/trait.IntoBuf.html" title="trait bytes::buf::IntoBuf">IntoBuf</a> for &'a <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-IntoBuf-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1519-1525' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='associatedtype.Buf-1' class="type"><span id='Buf.t-1' class='invisible'><code>type <a href='../bytes/buf/trait.IntoBuf.html#associatedtype.Buf' class="type">Buf</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/cursor/struct.Cursor.html" title="struct std::io::cursor::Cursor">Cursor</a><&'a <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>></code></span></h4>
|
|||
|
<div class='docblock'><p>The <code>Buf</code> type that <code>self</code> is being converted into</p>
|
|||
|
</div><h4 id='method.into_buf-1' class="method"><span id='into_buf.v-1' class='invisible'><code>fn <a href='../bytes/buf/trait.IntoBuf.html#tymethod.into_buf' class='fnname'>into_buf</a>(self) -> Self::<a class="type" href="../bytes/buf/trait.IntoBuf.html#associatedtype.Buf" title="type bytes::buf::IntoBuf::Buf">Buf</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1522-1524' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Creates a <code>Buf</code> from a value. <a href="../bytes/buf/trait.IntoBuf.html#tymethod.into_buf">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-AsRef%3C%5Bu8%5D%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</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>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-AsRef%3C%5Bu8%5D%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1527-1532' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.as_ref' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></h3><code class="content"><span class="where fmt-newline">impl<'a> <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">&'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><span class="where fmt-newline">impl<'a> <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">&'a 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></div></div><span id='as_ref.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html#tymethod.as_ref' class='fnname'>as_ref</a>(&self) -> <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></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1529-1531' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Performs the conversion.</p>
|
|||
|
</div></div><h3 id='impl-Deref' class='impl'><span class='in-band'><code>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="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-Deref' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1534-1541' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='associatedtype.Target' class="type"><span id='Target.t' class='invisible'><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></span></h4>
|
|||
|
<div class='docblock'><p>The resulting type after dereferencing.</p>
|
|||
|
</div><h4 id='method.deref' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></h3><code class="content"><span class="where fmt-newline">impl<'a> <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">&'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><span class="where fmt-newline">impl<'a> <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">&'a 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></div></div><span id='deref.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#tymethod.deref' class='fnname'>deref</a>(&self) -> <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></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1538-1540' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Dereferences the value.</p>
|
|||
|
</div></div><h3 id='impl-AsMut%3C%5Bu8%5D%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</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>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-AsMut%3C%5Bu8%5D%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1543-1547' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.as_mut' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></h3><code class="content"><span class="where fmt-newline">impl<'a> <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">&'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><span class="where fmt-newline">impl<'a> <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">&'a 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></div></div><span id='as_mut.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html#tymethod.as_mut' class='fnname'>as_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&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></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1544-1546' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Performs the conversion.</p>
|
|||
|
</div></div><h3 id='impl-DerefMut' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-DerefMut' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1549-1554' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.deref_mut' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></h3><code class="content"><span class="where fmt-newline">impl<'a> <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">&'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><span class="where fmt-newline">impl<'a> <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">&'a 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></div></div><span id='deref_mut.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html#tymethod.deref_mut' class='fnname'>deref_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&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></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1551-1553' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Mutably dereferences the value.</p>
|
|||
|
</div></div><h3 id='impl-From%3CVec%3Cu8%3E%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-From%3CVec%3Cu8%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1556-1562' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.from-1' class="method"><span id='from.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(src: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>) -> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1557-1561' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Performs the conversion.</p>
|
|||
|
</div></div><h3 id='impl-From%3CString%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-From%3CString%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1564-1568' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.from-2' class="method"><span id='from.v-2' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(src: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>) -> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1565-1567' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Performs the conversion.</p>
|
|||
|
</div></div><h3 id='impl-From%3C%26%27a%20%5Bu8%5D%3E' class='impl'><span class='in-band'><code>impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-From%3C%26%27a%20%5Bu8%5D%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1570-1593' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.from-3' class="method"><span id='from.v-3' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(src: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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>) -> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1571-1592' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Performs the conversion.</p>
|
|||
|
</div></div><h3 id='impl-From%3C%26%27a%20str%3E' class='impl'><span class='in-band'><code>impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><&'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-From%3C%26%27a%20str%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1595-1599' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.from-4' class="method"><span id='from.v-4' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(src: &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1596-1598' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Performs the conversion.</p>
|
|||
|
</div></div><h3 id='impl-From%3CBytes%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="../bytes/struct.Bytes.html" title="struct bytes::Bytes">Bytes</a>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-From%3CBytes%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1601-1606' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.from-5' class="method"><span id='from.v-5' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(src: <a class="struct" href="../bytes/struct.Bytes.html" title="struct bytes::Bytes">Bytes</a>) -> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1602-1605' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Performs the conversion.</p>
|
|||
|
</div></div><h3 id='impl-PartialEq' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-PartialEq' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1608-1612' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq' class="method"><span id='eq.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1609-1611' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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"><span id='ne.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div><h3 id='impl-PartialOrd' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-PartialOrd' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1614-1618' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.partial_cmp' class="method"><span id='partial_cmp.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1615-1617' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
|||
|
</div><h4 id='method.lt' class="method"><span id='lt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#644-649' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
|||
|
</div><h4 id='method.le' class="method"><span id='le.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#666-671' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
|||
|
</div><h4 id='method.gt' class="method"><span id='gt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#687-692' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
|||
|
</div><h4 id='method.ge' class="method"><span id='ge.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#709-714' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-Ord' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-Ord' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1620-1624' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.cmp' class="method"><span id='cmp.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp' class='fnname'>cmp</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1621-1623' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method returns an <code>Ordering</code> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></p>
|
|||
|
</div><h4 id='method.max' class="method"><span id='max.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max' class='fnname'>max</a>(self, other: Self) -> Self</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.21.0'>1.21.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#460-463' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max">Read more</a></p>
|
|||
|
</div><h4 id='method.min' class="method"><span id='min.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min' class='fnname'>min</a>(self, other: Self) -> Self</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.21.0'>1.21.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#476-479' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-Eq' class='impl'><span class='in-band'><code>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="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-Eq' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1626-1627' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'></div><h3 id='impl-Default' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-Default' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1629-1634' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.default' class="method"><span id='default.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default' class='fnname'>default</a>() -> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1631-1633' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Returns the "default value" for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-Debug' class='impl'><span class='in-band'><code>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="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1636-1640' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, fmt: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1637-1639' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-Hash' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-Hash' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1642-1647' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.hash' class="method"><span id='hash.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash' class='fnname'>hash</a><H>(&self, state: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>H) <span class="where fmt-newline">where<br> H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1643-1646' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Feeds this value into the given [<code>Hasher</code>]. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash">Read more</a></p>
|
|||
|
</div><h4 id='method.hash_slice' class="method"><span id='hash_slice.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice' class='fnname'>hash_slice</a><H>(data: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[Self]</a>, state: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>H) <span class="where fmt-newline">where<br> H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>, </span></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/hash/mod.rs.html#202-208' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Feeds a slice of this type into the given [<code>Hasher</code>]. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-Borrow%3C%5Bu8%5D%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</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>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-Borrow%3C%5Bu8%5D%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1649-1653' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.borrow' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></h3><code class="content"><span class="where fmt-newline">impl<'a> <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">&'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><span class="where fmt-newline">impl<'a> <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">&'a 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></div></div><span id='borrow.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&self) -> <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></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1650-1652' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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%3C%5Bu8%5D%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</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>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-BorrowMut%3C%5Bu8%5D%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1655-1659' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.borrow_mut' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></div><div class="content hidden"><h3 class="important">Important traits for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></h3><code class="content"><span class="where fmt-newline">impl<'a> <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">&'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><span class="where fmt-newline">impl<'a> <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">&'a 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></div></div><span id='borrow_mut.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&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></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1656-1658' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-Write' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Write.html" title="trait core::fmt::Write">Write</a> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-Write' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1661-1676' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.write_str' class="method"><span id='write_str.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Write.html#tymethod.write_str' class='fnname'>write_str</a>(&mut self, s: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1663-1670' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes a slice of bytes into this writer, returning whether the write succeeded. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Write.html#tymethod.write_str">Read more</a></p>
|
|||
|
</div><h4 id='method.write_fmt' class="method"><span id='write_fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Write.html#method.write_fmt' class='fnname'>write_fmt</a>(&mut self, args: <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Arguments.html" title="struct core::fmt::Arguments">Arguments</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1673-1675' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Glue for usage of the [<code>write!</code>] macro with implementors of this trait. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Write.html#method.write_fmt">Read more</a></p>
|
|||
|
</div><h4 id='method.write_char' class="method"><span id='write_char.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Write.html#method.write_char' class='fnname'>write_char</a>(&mut self, c: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.char.html">char</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.1.0'>1.1.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/fmt/mod.rs.html#179-181' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Writes a [<code>char</code>] into this writer, returning whether the write succeeded. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Write.html#method.write_char">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-Clone' class='impl'><span class='in-band'><code>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="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-Clone' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1678-1682' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&self) -> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1679-1681' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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"><span id='clone_from.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#112-114' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-IntoIterator' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-IntoIterator' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1684-1691' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='associatedtype.Item' class="type"><span id='Item.t' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code></span></h4>
|
|||
|
<div class='docblock'><p>The type of the elements being iterated over.</p>
|
|||
|
</div><h4 id='associatedtype.IntoIter' class="type"><span id='IntoIter.t' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.IntoIter' class="type">IntoIter</a> = <a class="struct" href="../bytes/buf/struct.Iter.html" title="struct bytes::buf::Iter">Iter</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/cursor/struct.Cursor.html" title="struct std::io::cursor::Cursor">Cursor</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>>></code></span></h4>
|
|||
|
<div class='docblock'><p>Which kind of iterator are we turning this into?</p>
|
|||
|
</div><h4 id='method.into_iter' class="method"><span id='into_iter.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#tymethod.into_iter' class='fnname'>into_iter</a>(self) -> Self::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::IntoIterator::IntoIter">IntoIter</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1688-1690' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Creates an iterator from a value. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#tymethod.into_iter">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-IntoIterator-1' class='impl'><span class='in-band'><code>impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a> for &'a <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-IntoIterator-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1693-1700' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='associatedtype.Item-1' class="type"><span id='Item.t-1' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.Item' class="type">Item</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code></span></h4>
|
|||
|
<div class='docblock'><p>The type of the elements being iterated over.</p>
|
|||
|
</div><h4 id='associatedtype.IntoIter-1' class="type"><span id='IntoIter.t-1' class='invisible'><code>type <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.IntoIter' class="type">IntoIter</a> = <a class="struct" href="../bytes/buf/struct.Iter.html" title="struct bytes::buf::Iter">Iter</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/cursor/struct.Cursor.html" title="struct std::io::cursor::Cursor">Cursor</a><&'a <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>>></code></span></h4>
|
|||
|
<div class='docblock'><p>Which kind of iterator are we turning this into?</p>
|
|||
|
</div><h4 id='method.into_iter-1' class="method"><span id='into_iter.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#tymethod.into_iter' class='fnname'>into_iter</a>(self) -> Self::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::IntoIterator::IntoIter">IntoIter</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1697-1699' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Creates an iterator from a value. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html#tymethod.into_iter">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-Extend%3Cu8%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.Extend.html" title="trait core::iter::traits::Extend">Extend</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-Extend%3Cu8%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1702-1716' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.extend' class="method"><span id='extend.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.Extend.html#tymethod.extend' class='fnname'>extend</a><T>(&mut self, iter: T) <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1703-1715' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Extends a collection with the contents of an iterator. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.Extend.html#tymethod.extend">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-Extend%3C%26%27a%20u8%3E' class='impl'><span class='in-band'><code>impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.Extend.html" title="trait core::iter::traits::Extend">Extend</a><&'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-Extend%3C%26%27a%20u8%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1718-1722' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.extend-1' class="method"><span id='extend.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/iter/traits/trait.Extend.html#tymethod.extend' class='fnname'>extend</a><T>(&mut self, iter: T) <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.IntoIterator.html" title="trait core::iter::traits::IntoIterator">IntoIterator</a><Item = &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>, </span></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#1719-1721' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>Extends a collection with the contents of an iterator. <a href="https://doc.rust-lang.org/nightly/core/iter/traits/trait.Extend.html#tymethod.extend">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-PartialEq%3C%5Bu8%5D%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</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>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-PartialEq%3C%5Bu8%5D%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2573-2577' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq-1' class="method"><span id='eq.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: <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>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2574-2576' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-1' class="method"><span id='ne.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div><h3 id='impl-PartialOrd%3C%5Bu8%5D%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</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>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-PartialOrd%3C%5Bu8%5D%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2579-2583' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.partial_cmp-1' class="method"><span id='partial_cmp.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: <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>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2580-2582' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
|||
|
</div><h4 id='method.lt-1' class="method"><span id='lt.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#644-649' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
|||
|
</div><h4 id='method.le-1' class="method"><span id='le.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#666-671' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
|||
|
</div><h4 id='method.gt-1' class="method"><span id='gt.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#687-692' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
|||
|
</div><h4 id='method.ge-1' class="method"><span id='ge.v-1' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#709-714' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-PartialEq%3CBytesMut%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for <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><a href='#impl-PartialEq%3CBytesMut%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2585-2589' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq-2' class="method"><span id='eq.v-2' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2586-2588' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-2' class="method"><span id='ne.v-2' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div><h3 id='impl-PartialOrd%3CBytesMut%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for <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><a href='#impl-PartialOrd%3CBytesMut%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2591-2595' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.partial_cmp-2' class="method"><span id='partial_cmp.v-2' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2592-2594' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
|||
|
</div><h4 id='method.lt-2' class="method"><span id='lt.v-2' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#644-649' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
|||
|
</div><h4 id='method.le-2' class="method"><span id='le.v-2' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#666-671' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
|||
|
</div><h4 id='method.gt-2' class="method"><span id='gt.v-2' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#687-692' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
|||
|
</div><h4 id='method.ge-2' class="method"><span id='ge.v-2' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#709-714' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-PartialEq%3Cstr%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-PartialEq%3Cstr%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2597-2601' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq-3' class="method"><span id='eq.v-3' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2598-2600' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-3' class="method"><span id='ne.v-3' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div><h3 id='impl-PartialOrd%3Cstr%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-PartialOrd%3Cstr%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2603-2607' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.partial_cmp-3' class="method"><span id='partial_cmp.v-3' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2604-2606' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
|||
|
</div><h4 id='method.lt-3' class="method"><span id='lt.v-3' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#644-649' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
|||
|
</div><h4 id='method.le-3' class="method"><span id='le.v-3' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#666-671' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
|||
|
</div><h4 id='method.gt-3' class="method"><span id='gt.v-3' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#687-692' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
|||
|
</div><h4 id='method.ge-3' class="method"><span id='ge.v-3' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#709-714' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-PartialEq%3CBytesMut%3E-1' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><a href='#impl-PartialEq%3CBytesMut%3E-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2609-2613' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq-4' class="method"><span id='eq.v-4' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2610-2612' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-4' class="method"><span id='ne.v-4' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div><h3 id='impl-PartialOrd%3CBytesMut%3E-1' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><a href='#impl-PartialOrd%3CBytesMut%3E-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2615-2619' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.partial_cmp-4' class="method"><span id='partial_cmp.v-4' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2616-2618' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
|||
|
</div><h4 id='method.lt-4' class="method"><span id='lt.v-4' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#644-649' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
|||
|
</div><h4 id='method.le-4' class="method"><span id='le.v-4' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#666-671' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
|||
|
</div><h4 id='method.gt-4' class="method"><span id='gt.v-4' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#687-692' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
|||
|
</div><h4 id='method.ge-4' class="method"><span id='ge.v-4' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#709-714' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-PartialEq%3CVec%3Cu8%3E%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-PartialEq%3CVec%3Cu8%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2621-2625' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq-5' class="method"><span id='eq.v-5' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</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.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2622-2624' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-5' class="method"><span id='ne.v-5' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div><h3 id='impl-PartialOrd%3CVec%3Cu8%3E%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-PartialOrd%3CVec%3Cu8%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2627-2631' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.partial_cmp-5' class="method"><span id='partial_cmp.v-5' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2628-2630' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
|||
|
</div><h4 id='method.lt-5' class="method"><span id='lt.v-5' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#644-649' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
|||
|
</div><h4 id='method.le-5' class="method"><span id='le.v-5' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#666-671' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
|||
|
</div><h4 id='method.gt-5' class="method"><span id='gt.v-5' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#687-692' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
|||
|
</div><h4 id='method.ge-5' class="method"><span id='ge.v-5' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#709-714' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-PartialEq%3CBytesMut%3E-2' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></code><a href='#impl-PartialEq%3CBytesMut%3E-2' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2633-2637' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq-6' class="method"><span id='eq.v-6' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2634-2636' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-6' class="method"><span id='ne.v-6' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div><h3 id='impl-PartialOrd%3CBytesMut%3E-2' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>></code><a href='#impl-PartialOrd%3CBytesMut%3E-2' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2639-2643' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.partial_cmp-6' class="method"><span id='partial_cmp.v-6' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2640-2642' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
|||
|
</div><h4 id='method.lt-6' class="method"><span id='lt.v-6' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#644-649' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
|||
|
</div><h4 id='method.le-6' class="method"><span id='le.v-6' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#666-671' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
|||
|
</div><h4 id='method.gt-6' class="method"><span id='gt.v-6' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#687-692' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
|||
|
</div><h4 id='method.ge-6' class="method"><span id='ge.v-6' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#709-714' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-PartialEq%3CString%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-PartialEq%3CString%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2645-2649' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq-7' class="method"><span id='eq.v-7' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2646-2648' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-7' class="method"><span id='ne.v-7' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div><h3 id='impl-PartialOrd%3CString%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-PartialOrd%3CString%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2651-2655' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.partial_cmp-7' class="method"><span id='partial_cmp.v-7' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2652-2654' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
|||
|
</div><h4 id='method.lt-7' class="method"><span id='lt.v-7' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#644-649' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
|||
|
</div><h4 id='method.le-7' class="method"><span id='le.v-7' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#666-671' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
|||
|
</div><h4 id='method.gt-7' class="method"><span id='gt.v-7' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#687-692' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
|||
|
</div><h4 id='method.ge-7' class="method"><span id='ge.v-7' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#709-714' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-PartialEq%3CBytesMut%3E-3' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code><a href='#impl-PartialEq%3CBytesMut%3E-3' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2657-2661' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq-8' class="method"><span id='eq.v-8' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2658-2660' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-8' class="method"><span id='ne.v-8' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div><h3 id='impl-PartialOrd%3CBytesMut%3E-3' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code><a href='#impl-PartialOrd%3CBytesMut%3E-3' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2663-2667' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.partial_cmp-8' class="method"><span id='partial_cmp.v-8' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2664-2666' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
|||
|
</div><h4 id='method.lt-8' class="method"><span id='lt.v-8' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#644-649' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
|||
|
</div><h4 id='method.le-8' class="method"><span id='le.v-8' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#666-671' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
|||
|
</div><h4 id='method.gt-8' class="method"><span id='gt.v-8' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#687-692' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
|||
|
</div><h4 id='method.ge-8' class="method"><span id='ge.v-8' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#709-714' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-PartialEq%3C%26%27a%20T%3E' class='impl'><span class='in-band'><code>impl<'a, T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a </a>T> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a> <span class="where fmt-newline">where<br> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><T>, </span></code><a href='#impl-PartialEq%3C%26%27a%20T%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2669-2675' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq-9' class="method"><span id='eq.v-9' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a </a>T) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2672-2674' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-9' class="method"><span id='ne.v-9' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div><h3 id='impl-PartialOrd%3C%26%27a%20T%3E' class='impl'><span class='in-band'><code>impl<'a, T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a </a>T> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a> <span class="where fmt-newline">where<br> <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><T>, </span></code><a href='#impl-PartialOrd%3C%26%27a%20T%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2677-2683' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.partial_cmp-9' class="method"><span id='partial_cmp.v-9' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a </a>T) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2680-2682' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
|||
|
</div><h4 id='method.lt-9' class="method"><span id='lt.v-9' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#644-649' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
|||
|
</div><h4 id='method.le-9' class="method"><span id='le.v-9' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#666-671' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
|||
|
</div><h4 id='method.gt-9' class="method"><span id='gt.v-9' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#687-692' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
|||
|
</div><h4 id='method.ge-9' class="method"><span id='ge.v-9' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#709-714' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-PartialEq%3CBytesMut%3E-4' class='impl'><span class='in-band'><code>impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></code><a href='#impl-PartialEq%3CBytesMut%3E-4' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2685-2689' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq-10' class="method"><span id='eq.v-10' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2686-2688' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-10' class="method"><span id='ne.v-10' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div><h3 id='impl-PartialOrd%3CBytesMut%3E-4' class='impl'><span class='in-band'><code>impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'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></code><a href='#impl-PartialOrd%3CBytesMut%3E-4' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2691-2695' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.partial_cmp-10' class="method"><span id='partial_cmp.v-10' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2692-2694' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
|||
|
</div><h4 id='method.lt-10' class="method"><span id='lt.v-10' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#644-649' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
|||
|
</div><h4 id='method.le-10' class="method"><span id='le.v-10' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#666-671' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
|||
|
</div><h4 id='method.gt-10' class="method"><span id='gt.v-10' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#687-692' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
|||
|
</div><h4 id='method.ge-10' class="method"><span id='ge.v-10' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#709-714' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-PartialEq%3CBytesMut%3E-5' class='impl'><span class='in-band'><code>impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><a href='#impl-PartialEq%3CBytesMut%3E-5' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2697-2701' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq-11' class="method"><span id='eq.v-11' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2698-2700' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-11' class="method"><span id='ne.v-11' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div><h3 id='impl-PartialOrd%3CBytesMut%3E-5' class='impl'><span class='in-band'><code>impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for &'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><a href='#impl-PartialOrd%3CBytesMut%3E-5' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2703-2707' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.partial_cmp-11' class="method"><span id='partial_cmp.v-11' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2704-2706' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
|||
|
</div><h4 id='method.lt-11' class="method"><span id='lt.v-11' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#644-649' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
|||
|
</div><h4 id='method.le-11' class="method"><span id='le.v-11' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#666-671' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
|||
|
</div><h4 id='method.gt-11' class="method"><span id='gt.v-11' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#687-692' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
|||
|
</div><h4 id='method.ge-11' class="method"><span id='ge.v-11' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#709-714' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
|||
|
</div></div><h3 id='impl-PartialEq%3CBytesMut%3E-6' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>> for <a class="struct" href="../bytes/struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></code><a href='#impl-PartialEq%3CBytesMut%3E-6' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2845-2850' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq-12' class="method"><span id='eq.v-12' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2847-2849' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-12' class="method"><span id='ne.v-12' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div><h3 id='impl-PartialEq%3CBytes%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="../bytes/struct.Bytes.html" title="struct bytes::Bytes">Bytes</a>> for <a class="struct" href="../bytes/struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></code><a href='#impl-PartialEq%3CBytes%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2852-2857' title='goto source code'>[src]</a></span></h3>
|
|||
|
<div class='impl-items'><h4 id='method.eq-13' class="method"><span id='eq.v-13' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="struct" href="../bytes/struct.Bytes.html" title="struct bytes::Bytes">Bytes</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/bytes/bytes.rs.html#2854-2856' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><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-13' class="method"><span id='ne.v-13' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#121' title='goto source code'>[src]</a></span></h4>
|
|||
|
<div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
|||
|
</div></div></section>
|
|||
|
<section id='search' class="content hidden"></section>
|
|||
|
|
|||
|
<section class="footer"></section>
|
|||
|
|
|||
|
<aside id="help" class="hidden">
|
|||
|
<div>
|
|||
|
<h1 class="hidden">Help</h1>
|
|||
|
|
|||
|
<div class="shortcuts">
|
|||
|
<h2>Keyboard Shortcuts</h2>
|
|||
|
|
|||
|
<dl>
|
|||
|
<dt><kbd>?</kbd></dt>
|
|||
|
<dd>Show this help dialog</dd>
|
|||
|
<dt><kbd>S</kbd></dt>
|
|||
|
<dd>Focus the search field</dd>
|
|||
|
<dt><kbd>↑</kbd></dt>
|
|||
|
<dd>Move up in search results</dd>
|
|||
|
<dt><kbd>↓</kbd></dt>
|
|||
|
<dd>Move down in search results</dd>
|
|||
|
<dt><kbd>↹</kbd></dt>
|
|||
|
<dd>Switch tab</dd>
|
|||
|
<dt><kbd>⏎</kbd></dt>
|
|||
|
<dd>Go to active search result</dd>
|
|||
|
<dt><kbd>+</kbd></dt>
|
|||
|
<dd>Expand all sections</dd>
|
|||
|
<dt><kbd>-</kbd></dt>
|
|||
|
<dd>Collapse all sections</dd>
|
|||
|
</dl>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="infos">
|
|||
|
<h2>Search Tricks</h2>
|
|||
|
|
|||
|
<p>
|
|||
|
Prefix searches with a type followed by a colon (e.g.
|
|||
|
<code>fn:</code>) to restrict the search to a given type.
|
|||
|
</p>
|
|||
|
|
|||
|
<p>
|
|||
|
Accepted types are: <code>fn</code>, <code>mod</code>,
|
|||
|
<code>struct</code>, <code>enum</code>,
|
|||
|
<code>trait</code>, <code>type</code>, <code>macro</code>,
|
|||
|
and <code>const</code>.
|
|||
|
</p>
|
|||
|
|
|||
|
<p>
|
|||
|
Search functions by type signature (e.g.
|
|||
|
<code>vec -> usize</code> or <code>* -> vec</code>)
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</aside>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<script>
|
|||
|
window.rootPath = "../";
|
|||
|
window.currentCrate = "bytes";
|
|||
|
</script>
|
|||
|
<script src="../main.js"></script>
|
|||
|
<script defer src="../search-index.js"></script>
|
|||
|
</body>
|
|||
|
</html>
|