blob: 84539d2477c6a3aff0956bf9374ccfd0ce6ac8a1 [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Read bytes from a buffer."><meta name="keywords" content="rust, rustlang, rust-lang, Buf"><title>Buf in bytes - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../bytes/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Buf</a></h2><div class="sidebar-elems"><section><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.advance">advance</a></li><li><a href="#tymethod.chunk">chunk</a></li><li><a href="#tymethod.remaining">remaining</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.chain">chain</a></li><li><a href="#method.chunks_vectored">chunks_vectored</a></li><li><a href="#method.copy_to_bytes">copy_to_bytes</a></li><li><a href="#method.copy_to_slice">copy_to_slice</a></li><li><a href="#method.get_f32">get_f32</a></li><li><a href="#method.get_f32_le">get_f32_le</a></li><li><a href="#method.get_f32_ne">get_f32_ne</a></li><li><a href="#method.get_f64">get_f64</a></li><li><a href="#method.get_f64_le">get_f64_le</a></li><li><a href="#method.get_f64_ne">get_f64_ne</a></li><li><a href="#method.get_i128">get_i128</a></li><li><a href="#method.get_i128_le">get_i128_le</a></li><li><a href="#method.get_i128_ne">get_i128_ne</a></li><li><a href="#method.get_i16">get_i16</a></li><li><a href="#method.get_i16_le">get_i16_le</a></li><li><a href="#method.get_i16_ne">get_i16_ne</a></li><li><a href="#method.get_i32">get_i32</a></li><li><a href="#method.get_i32_le">get_i32_le</a></li><li><a href="#method.get_i32_ne">get_i32_ne</a></li><li><a href="#method.get_i64">get_i64</a></li><li><a href="#method.get_i64_le">get_i64_le</a></li><li><a href="#method.get_i64_ne">get_i64_ne</a></li><li><a href="#method.get_i8">get_i8</a></li><li><a href="#method.get_int">get_int</a></li><li><a href="#method.get_int_le">get_int_le</a></li><li><a href="#method.get_int_ne">get_int_ne</a></li><li><a href="#method.get_u128">get_u128</a></li><li><a href="#method.get_u128_le">get_u128_le</a></li><li><a href="#method.get_u128_ne">get_u128_ne</a></li><li><a href="#method.get_u16">get_u16</a></li><li><a href="#method.get_u16_le">get_u16_le</a></li><li><a href="#method.get_u16_ne">get_u16_ne</a></li><li><a href="#method.get_u32">get_u32</a></li><li><a href="#method.get_u32_le">get_u32_le</a></li><li><a href="#method.get_u32_ne">get_u32_ne</a></li><li><a href="#method.get_u64">get_u64</a></li><li><a href="#method.get_u64_le">get_u64_le</a></li><li><a href="#method.get_u64_ne">get_u64_ne</a></li><li><a href="#method.get_u8">get_u8</a></li><li><a href="#method.get_uint">get_uint</a></li><li><a href="#method.get_uint_le">get_uint_le</a></li><li><a href="#method.get_uint_ne">get_uint_ne</a></li><li><a href="#method.has_remaining">has_remaining</a></li><li><a href="#method.reader">reader</a></li><li><a href="#method.take">take</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-Buf-for-%26%5Bu8%5D">&amp;[u8]</a></li><li><a href="#impl-Buf-for-%26mut%20T">&amp;mut T</a></li><li><a href="#impl-Buf-for-Box%3CT%3E">Box&lt;T&gt;</a></li><li><a href="#impl-Buf-for-Cursor%3CT%3E">Cursor&lt;T&gt;</a></li><li><a href="#impl-Buf-for-VecDeque%3Cu8%3E">VecDeque&lt;u8&gt;</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In bytes</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Trait <a href="index.html">bytes</a>::<wbr><a class="trait" href="#">Buf</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/bytes/buf/buf_impl.rs.html#76-1194">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust trait"><code>pub trait Buf {
<details class="rustdoc-toggle type-contents-toggle"><summary class="hideme"><span>Show 48 methods</span></summary> fn <a href="#tymethod.remaining" class="fnname">remaining</a>(&amp;self) -&gt; usize;
<span class="item-spacer"></span> fn <a href="#tymethod.chunk" class="fnname">chunk</a>(&amp;self) -&gt; &amp;[u8];
<span class="item-spacer"></span> fn <a href="#tymethod.advance" class="fnname">advance</a>(&amp;mut self, cnt: usize);
fn <a href="#method.chunks_vectored" class="fnname">chunks_vectored</a>&lt;'a&gt;(&amp;'a self, dst: &amp;mut [IoSlice&lt;'a&gt;]) -&gt; usize { ... }
<span class="item-spacer"></span> fn <a href="#method.has_remaining" class="fnname">has_remaining</a>(&amp;self) -&gt; bool { ... }
<span class="item-spacer"></span> fn <a href="#method.copy_to_slice" class="fnname">copy_to_slice</a>(&amp;mut self, dst: &amp;mut [u8]) { ... }
<span class="item-spacer"></span> fn <a href="#method.get_u8" class="fnname">get_u8</a>(&amp;mut self) -&gt; u8 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_i8" class="fnname">get_i8</a>(&amp;mut self) -&gt; i8 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_u16" class="fnname">get_u16</a>(&amp;mut self) -&gt; u16 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_u16_le" class="fnname">get_u16_le</a>(&amp;mut self) -&gt; u16 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_u16_ne" class="fnname">get_u16_ne</a>(&amp;mut self) -&gt; u16 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_i16" class="fnname">get_i16</a>(&amp;mut self) -&gt; i16 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_i16_le" class="fnname">get_i16_le</a>(&amp;mut self) -&gt; i16 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_i16_ne" class="fnname">get_i16_ne</a>(&amp;mut self) -&gt; i16 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_u32" class="fnname">get_u32</a>(&amp;mut self) -&gt; u32 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_u32_le" class="fnname">get_u32_le</a>(&amp;mut self) -&gt; u32 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_u32_ne" class="fnname">get_u32_ne</a>(&amp;mut self) -&gt; u32 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_i32" class="fnname">get_i32</a>(&amp;mut self) -&gt; i32 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_i32_le" class="fnname">get_i32_le</a>(&amp;mut self) -&gt; i32 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_i32_ne" class="fnname">get_i32_ne</a>(&amp;mut self) -&gt; i32 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_u64" class="fnname">get_u64</a>(&amp;mut self) -&gt; u64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_u64_le" class="fnname">get_u64_le</a>(&amp;mut self) -&gt; u64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_u64_ne" class="fnname">get_u64_ne</a>(&amp;mut self) -&gt; u64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_i64" class="fnname">get_i64</a>(&amp;mut self) -&gt; i64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_i64_le" class="fnname">get_i64_le</a>(&amp;mut self) -&gt; i64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_i64_ne" class="fnname">get_i64_ne</a>(&amp;mut self) -&gt; i64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_u128" class="fnname">get_u128</a>(&amp;mut self) -&gt; u128 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_u128_le" class="fnname">get_u128_le</a>(&amp;mut self) -&gt; u128 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_u128_ne" class="fnname">get_u128_ne</a>(&amp;mut self) -&gt; u128 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_i128" class="fnname">get_i128</a>(&amp;mut self) -&gt; i128 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_i128_le" class="fnname">get_i128_le</a>(&amp;mut self) -&gt; i128 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_i128_ne" class="fnname">get_i128_ne</a>(&amp;mut self) -&gt; i128 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_uint" class="fnname">get_uint</a>(&amp;mut self, nbytes: usize) -&gt; u64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_uint_le" class="fnname">get_uint_le</a>(&amp;mut self, nbytes: usize) -&gt; u64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_uint_ne" class="fnname">get_uint_ne</a>(&amp;mut self, nbytes: usize) -&gt; u64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_int" class="fnname">get_int</a>(&amp;mut self, nbytes: usize) -&gt; i64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_int_le" class="fnname">get_int_le</a>(&amp;mut self, nbytes: usize) -&gt; i64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_int_ne" class="fnname">get_int_ne</a>(&amp;mut self, nbytes: usize) -&gt; i64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_f32" class="fnname">get_f32</a>(&amp;mut self) -&gt; f32 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_f32_le" class="fnname">get_f32_le</a>(&amp;mut self) -&gt; f32 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_f32_ne" class="fnname">get_f32_ne</a>(&amp;mut self) -&gt; f32 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_f64" class="fnname">get_f64</a>(&amp;mut self) -&gt; f64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_f64_le" class="fnname">get_f64_le</a>(&amp;mut self) -&gt; f64 { ... }
<span class="item-spacer"></span> fn <a href="#method.get_f64_ne" class="fnname">get_f64_ne</a>(&amp;mut self) -&gt; f64 { ... }
<span class="item-spacer"></span> fn <a href="#method.copy_to_bytes" class="fnname">copy_to_bytes</a>(&amp;mut self, len: usize) -&gt; <a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a> { ... }
<span class="item-spacer"></span> fn <a href="#method.take" class="fnname">take</a>(self, limit: usize) -&gt; <a class="struct" href="buf/struct.Take.html" title="struct bytes::buf::Take">Take</a>&lt;Self&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: Sized</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.chain" class="fnname">chain</a>&lt;U:&nbsp;<a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a>&gt;(self, next: U) -&gt; <a class="struct" href="buf/struct.Chain.html" title="struct bytes::buf::Chain">Chain</a>&lt;Self, U&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: Sized</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.reader" class="fnname">reader</a>(self) -&gt; <a class="struct" href="buf/struct.Reader.html" title="struct bytes::buf::Reader">Reader</a>&lt;Self&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: Sized</span>,
{ ... }
</details>}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Read bytes from a buffer.</p>
<p>A buffer stores bytes in memory such that read operations are infallible.
The underlying storage may or may not be in contiguous memory. A <code>Buf</code> value
is a cursor into the buffer. Reading from <code>Buf</code> advances the cursor
position. It can be thought of as an efficient <code>Iterator</code> for collections of
bytes.</p>
<p>The simplest <code>Buf</code> is a <code>&amp;[u8]</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;hello world&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="string">b&#39;h&#39;</span>, buf.get_u8());
<span class="macro">assert_eq!</span>(<span class="string">b&#39;e&#39;</span>, buf.get_u8());
<span class="macro">assert_eq!</span>(<span class="string">b&#39;l&#39;</span>, buf.get_u8());
<span class="kw">let </span><span class="kw-2">mut </span>rest = [<span class="number">0</span>; <span class="number">8</span>];
buf.copy_to_slice(<span class="kw-2">&amp;mut </span>rest);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>rest[..], <span class="kw-2">&amp;</span><span class="string">b&quot;lo world&quot;</span>[..]);</code></pre></div>
</div></details><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.remaining" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#102">source</a><h4 class="code-header">fn <a href="#tymethod.remaining" class="fnname">remaining</a>(&amp;self) -&gt; usize</h4></section></summary><div class="docblock"><p>Returns the number of bytes between the current position and the end of
the buffer.</p>
<p>This value is greater than or equal to the length of the slice returned
by <code>chunk()</code>.</p>
<h5 id="examples"><a href="#examples">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;hello world&quot;</span>[..];
<span class="macro">assert_eq!</span>(buf.remaining(), <span class="number">11</span>);
buf.get_u8();
<span class="macro">assert_eq!</span>(buf.remaining(), <span class="number">10</span>);</code></pre></div>
<h5 id="implementer-notes"><a href="#implementer-notes">Implementer notes</a></h5>
<p>Implementations of <code>remaining</code> should ensure that the return value does
not change unless a call is made to <code>advance</code> or any other function that
is documented to change the <code>Buf</code>’s current position.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.chunk" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#133">source</a><h4 class="code-header">fn <a href="#tymethod.chunk" class="fnname">chunk</a>(&amp;self) -&gt; &amp;[u8]</h4></section></summary><div class="docblock"><p>Returns a slice starting at the current position and of length between 0
and <code>Buf::remaining()</code>. Note that this <em>can</em> return shorter slice (this allows
non-continuous internal representation).</p>
<p>This is a lower level function. Most operations are done with other
functions.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;hello world&quot;</span>[..];
<span class="macro">assert_eq!</span>(buf.chunk(), <span class="kw-2">&amp;</span><span class="string">b&quot;hello world&quot;</span>[..]);
buf.advance(<span class="number">6</span>);
<span class="macro">assert_eq!</span>(buf.chunk(), <span class="kw-2">&amp;</span><span class="string">b&quot;world&quot;</span>[..]);</code></pre></div>
<h5 id="implementer-notes-1"><a href="#implementer-notes-1">Implementer notes</a></h5>
<p>This function should never panic. Once the end of the buffer is reached,
i.e., <code>Buf::remaining</code> returns 0, calls to <code>chunk()</code> should return an
empty slice.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.advance" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#207">source</a><h4 class="code-header">fn <a href="#tymethod.advance" class="fnname">advance</a>(&amp;mut self, cnt: usize)</h4></section></summary><div class="docblock"><p>Advance the internal cursor of the Buf</p>
<p>The next call to <code>chunk()</code> will return a slice starting <code>cnt</code> bytes
further into the underlying buffer.</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;hello world&quot;</span>[..];
<span class="macro">assert_eq!</span>(buf.chunk(), <span class="kw-2">&amp;</span><span class="string">b&quot;hello world&quot;</span>[..]);
buf.advance(<span class="number">6</span>);
<span class="macro">assert_eq!</span>(buf.chunk(), <span class="kw-2">&amp;</span><span class="string">b&quot;world&quot;</span>[..]);</code></pre></div>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>This function <strong>may</strong> panic if <code>cnt &gt; self.remaining()</code>.</p>
<h5 id="implementer-notes-2"><a href="#implementer-notes-2">Implementer notes</a></h5>
<p>It is recommended for implementations of <code>advance</code> to panic if <code>cnt &gt; self.remaining()</code>. If the implementation does not panic, the call must
behave as if <code>cnt == self.remaining()</code>.</p>
<p>A call with <code>cnt == 0</code> should never panic and be a no-op.</p>
</div></details></div><h2 id="provided-methods" class="small-section-header">Provided Methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.chunks_vectored" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#164-175">source</a><h4 class="code-header">fn <a href="#method.chunks_vectored" class="fnname">chunks_vectored</a>&lt;'a&gt;(&amp;'a self, dst: &amp;mut [IoSlice&lt;'a&gt;]) -&gt; usize</h4></section></summary><div class="docblock"><p>Fills <code>dst</code> with potentially multiple slices starting at <code>self</code>’s
current position.</p>
<p>If the <code>Buf</code> is backed by disjoint slices of bytes, <code>chunk_vectored</code> enables
fetching more than one slice at once. <code>dst</code> is a slice of <code>IoSlice</code>
references, enabling the slice to be directly used with <a href="http://man7.org/linux/man-pages/man2/readv.2.html"><code>writev</code></a>
without any further conversion. The sum of the lengths of all the
buffers in <code>dst</code> will be less than or equal to <code>Buf::remaining()</code>.</p>
<p>The entries in <code>dst</code> will be overwritten, but the data <strong>contained</strong> by
the slices <strong>will not</strong> be modified. If <code>chunk_vectored</code> does not fill every
entry in <code>dst</code>, then <code>dst</code> is guaranteed to contain all remaining slices
in `self.</p>
<p>This is a lower level function. Most operations are done with other
functions.</p>
<h5 id="implementer-notes-3"><a href="#implementer-notes-3">Implementer notes</a></h5>
<p>This function should never panic. Once the end of the buffer is reached,
i.e., <code>Buf::remaining</code> returns 0, calls to <code>chunk_vectored</code> must return 0
without mutating <code>dst</code>.</p>
<p>Implementations should also take care to properly handle being called
with <code>dst</code> being a zero length slice.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.has_remaining" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#226-228">source</a><h4 class="code-header">fn <a href="#method.has_remaining" class="fnname">has_remaining</a>(&amp;self) -&gt; bool</h4></section></summary><div class="docblock"><p>Returns true if there are any more bytes to consume</p>
<p>This is equivalent to <code>self.remaining() != 0</code>.</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;a&quot;</span>[..];
<span class="macro">assert!</span>(buf.has_remaining());
buf.get_u8();
<span class="macro">assert!</span>(!buf.has_remaining());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.copy_to_slice" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#251-270">source</a><h4 class="code-header">fn <a href="#method.copy_to_slice" class="fnname">copy_to_slice</a>(&amp;mut self, dst: &amp;mut [u8])</h4></section></summary><div class="docblock"><p>Copies bytes from <code>self</code> into <code>dst</code>.</p>
<p>The cursor is advanced by the number of bytes copied. <code>self</code> must have
enough remaining bytes to fill <code>dst</code>.</p>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;hello world&quot;</span>[..];
<span class="kw">let </span><span class="kw-2">mut </span>dst = [<span class="number">0</span>; <span class="number">5</span>];
buf.copy_to_slice(<span class="kw-2">&amp;mut </span>dst);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span><span class="string">b&quot;hello&quot;</span>[..], <span class="kw-2">&amp;</span>dst);
<span class="macro">assert_eq!</span>(<span class="number">6</span>, buf.remaining());</code></pre></div>
<h5 id="panics-1"><a href="#panics-1">Panics</a></h5>
<p>This function panics if <code>self.remaining() &lt; dst.len()</code></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_u8" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#288-293">source</a><h4 class="code-header">fn <a href="#method.get_u8" class="fnname">get_u8</a>(&amp;mut self) -&gt; u8</h4></section></summary><div class="docblock"><p>Gets an unsigned 8 bit integer from <code>self</code>.</p>
<p>The current position is advanced by 1.</p>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x08 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">8</span>, buf.get_u8());</code></pre></div>
<h5 id="panics-2"><a href="#panics-2">Panics</a></h5>
<p>This function panics if there is no more remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_i8" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#311-316">source</a><h4 class="code-header">fn <a href="#method.get_i8" class="fnname">get_i8</a>(&amp;mut self) -&gt; i8</h4></section></summary><div class="docblock"><p>Gets a signed 8 bit integer from <code>self</code>.</p>
<p>The current position is advanced by 1.</p>
<h5 id="examples-6"><a href="#examples-6">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x08 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">8</span>, buf.get_i8());</code></pre></div>
<h5 id="panics-3"><a href="#panics-3">Panics</a></h5>
<p>This function panics if there is no more remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_u16" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#334-336">source</a><h4 class="code-header">fn <a href="#method.get_u16" class="fnname">get_u16</a>(&amp;mut self) -&gt; u16</h4></section></summary><div class="docblock"><p>Gets an unsigned 16 bit integer from <code>self</code> in big-endian byte order.</p>
<p>The current position is advanced by 2.</p>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x08\x09 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x0809</span>, buf.get_u16());</code></pre></div>
<h5 id="panics-4"><a href="#panics-4">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_u16_le" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#354-356">source</a><h4 class="code-header">fn <a href="#method.get_u16_le" class="fnname">get_u16_le</a>(&amp;mut self) -&gt; u16</h4></section></summary><div class="docblock"><p>Gets an unsigned 16 bit integer from <code>self</code> in little-endian byte order.</p>
<p>The current position is advanced by 2.</p>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x09\x08 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x0809</span>, buf.get_u16_le());</code></pre></div>
<h5 id="panics-5"><a href="#panics-5">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_u16_ne" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#377-379">source</a><h4 class="code-header">fn <a href="#method.get_u16_ne" class="fnname">get_u16_ne</a>(&amp;mut self) -&gt; u16</h4></section></summary><div class="docblock"><p>Gets an unsigned 16 bit integer from <code>self</code> in native-endian byte order.</p>
<p>The current position is advanced by 2.</p>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf: <span class="kw-2">&amp;</span>[u8] = <span class="kw">match </span><span class="macro">cfg!</span>(target_endian = <span class="string">&quot;big&quot;</span>) {
<span class="bool-val">true </span>=&gt; <span class="string">b&quot;\x08\x09 hello&quot;</span>,
<span class="bool-val">false </span>=&gt; <span class="string">b&quot;\x09\x08 hello&quot;</span>,
};
<span class="macro">assert_eq!</span>(<span class="number">0x0809</span>, buf.get_u16_ne());</code></pre></div>
<h5 id="panics-6"><a href="#panics-6">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_i16" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#397-399">source</a><h4 class="code-header">fn <a href="#method.get_i16" class="fnname">get_i16</a>(&amp;mut self) -&gt; i16</h4></section></summary><div class="docblock"><p>Gets a signed 16 bit integer from <code>self</code> in big-endian byte order.</p>
<p>The current position is advanced by 2.</p>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x08\x09 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x0809</span>, buf.get_i16());</code></pre></div>
<h5 id="panics-7"><a href="#panics-7">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_i16_le" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#417-419">source</a><h4 class="code-header">fn <a href="#method.get_i16_le" class="fnname">get_i16_le</a>(&amp;mut self) -&gt; i16</h4></section></summary><div class="docblock"><p>Gets a signed 16 bit integer from <code>self</code> in little-endian byte order.</p>
<p>The current position is advanced by 2.</p>
<h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x09\x08 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x0809</span>, buf.get_i16_le());</code></pre></div>
<h5 id="panics-8"><a href="#panics-8">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_i16_ne" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#440-442">source</a><h4 class="code-header">fn <a href="#method.get_i16_ne" class="fnname">get_i16_ne</a>(&amp;mut self) -&gt; i16</h4></section></summary><div class="docblock"><p>Gets a signed 16 bit integer from <code>self</code> in native-endian byte order.</p>
<p>The current position is advanced by 2.</p>
<h5 id="examples-12"><a href="#examples-12">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf: <span class="kw-2">&amp;</span>[u8] = <span class="kw">match </span><span class="macro">cfg!</span>(target_endian = <span class="string">&quot;big&quot;</span>) {
<span class="bool-val">true </span>=&gt; <span class="string">b&quot;\x08\x09 hello&quot;</span>,
<span class="bool-val">false </span>=&gt; <span class="string">b&quot;\x09\x08 hello&quot;</span>,
};
<span class="macro">assert_eq!</span>(<span class="number">0x0809</span>, buf.get_i16_ne());</code></pre></div>
<h5 id="panics-9"><a href="#panics-9">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_u32" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#460-462">source</a><h4 class="code-header">fn <a href="#method.get_u32" class="fnname">get_u32</a>(&amp;mut self) -&gt; u32</h4></section></summary><div class="docblock"><p>Gets an unsigned 32 bit integer from <code>self</code> in the big-endian byte order.</p>
<p>The current position is advanced by 4.</p>
<h5 id="examples-13"><a href="#examples-13">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x08\x09\xA0\xA1 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x0809A0A1</span>, buf.get_u32());</code></pre></div>
<h5 id="panics-10"><a href="#panics-10">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_u32_le" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#480-482">source</a><h4 class="code-header">fn <a href="#method.get_u32_le" class="fnname">get_u32_le</a>(&amp;mut self) -&gt; u32</h4></section></summary><div class="docblock"><p>Gets an unsigned 32 bit integer from <code>self</code> in the little-endian byte order.</p>
<p>The current position is advanced by 4.</p>
<h5 id="examples-14"><a href="#examples-14">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\xA1\xA0\x09\x08 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x0809A0A1</span>, buf.get_u32_le());</code></pre></div>
<h5 id="panics-11"><a href="#panics-11">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_u32_ne" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#503-505">source</a><h4 class="code-header">fn <a href="#method.get_u32_ne" class="fnname">get_u32_ne</a>(&amp;mut self) -&gt; u32</h4></section></summary><div class="docblock"><p>Gets an unsigned 32 bit integer from <code>self</code> in native-endian byte order.</p>
<p>The current position is advanced by 4.</p>
<h5 id="examples-15"><a href="#examples-15">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf: <span class="kw-2">&amp;</span>[u8] = <span class="kw">match </span><span class="macro">cfg!</span>(target_endian = <span class="string">&quot;big&quot;</span>) {
<span class="bool-val">true </span>=&gt; <span class="string">b&quot;\x08\x09\xA0\xA1 hello&quot;</span>,
<span class="bool-val">false </span>=&gt; <span class="string">b&quot;\xA1\xA0\x09\x08 hello&quot;</span>,
};
<span class="macro">assert_eq!</span>(<span class="number">0x0809A0A1</span>, buf.get_u32_ne());</code></pre></div>
<h5 id="panics-12"><a href="#panics-12">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_i32" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#523-525">source</a><h4 class="code-header">fn <a href="#method.get_i32" class="fnname">get_i32</a>(&amp;mut self) -&gt; i32</h4></section></summary><div class="docblock"><p>Gets a signed 32 bit integer from <code>self</code> in big-endian byte order.</p>
<p>The current position is advanced by 4.</p>
<h5 id="examples-16"><a href="#examples-16">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x08\x09\xA0\xA1 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x0809A0A1</span>, buf.get_i32());</code></pre></div>
<h5 id="panics-13"><a href="#panics-13">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_i32_le" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#543-545">source</a><h4 class="code-header">fn <a href="#method.get_i32_le" class="fnname">get_i32_le</a>(&amp;mut self) -&gt; i32</h4></section></summary><div class="docblock"><p>Gets a signed 32 bit integer from <code>self</code> in little-endian byte order.</p>
<p>The current position is advanced by 4.</p>
<h5 id="examples-17"><a href="#examples-17">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\xA1\xA0\x09\x08 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x0809A0A1</span>, buf.get_i32_le());</code></pre></div>
<h5 id="panics-14"><a href="#panics-14">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_i32_ne" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#566-568">source</a><h4 class="code-header">fn <a href="#method.get_i32_ne" class="fnname">get_i32_ne</a>(&amp;mut self) -&gt; i32</h4></section></summary><div class="docblock"><p>Gets a signed 32 bit integer from <code>self</code> in native-endian byte order.</p>
<p>The current position is advanced by 4.</p>
<h5 id="examples-18"><a href="#examples-18">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf: <span class="kw-2">&amp;</span>[u8] = <span class="kw">match </span><span class="macro">cfg!</span>(target_endian = <span class="string">&quot;big&quot;</span>) {
<span class="bool-val">true </span>=&gt; <span class="string">b&quot;\x08\x09\xA0\xA1 hello&quot;</span>,
<span class="bool-val">false </span>=&gt; <span class="string">b&quot;\xA1\xA0\x09\x08 hello&quot;</span>,
};
<span class="macro">assert_eq!</span>(<span class="number">0x0809A0A1</span>, buf.get_i32_ne());</code></pre></div>
<h5 id="panics-15"><a href="#panics-15">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_u64" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#586-588">source</a><h4 class="code-header">fn <a href="#method.get_u64" class="fnname">get_u64</a>(&amp;mut self) -&gt; u64</h4></section></summary><div class="docblock"><p>Gets an unsigned 64 bit integer from <code>self</code> in big-endian byte order.</p>
<p>The current position is advanced by 8.</p>
<h5 id="examples-19"><a href="#examples-19">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x01\x02\x03\x04\x05\x06\x07\x08 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x0102030405060708</span>, buf.get_u64());</code></pre></div>
<h5 id="panics-16"><a href="#panics-16">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_u64_le" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#606-608">source</a><h4 class="code-header">fn <a href="#method.get_u64_le" class="fnname">get_u64_le</a>(&amp;mut self) -&gt; u64</h4></section></summary><div class="docblock"><p>Gets an unsigned 64 bit integer from <code>self</code> in little-endian byte order.</p>
<p>The current position is advanced by 8.</p>
<h5 id="examples-20"><a href="#examples-20">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x08\x07\x06\x05\x04\x03\x02\x01 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x0102030405060708</span>, buf.get_u64_le());</code></pre></div>
<h5 id="panics-17"><a href="#panics-17">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_u64_ne" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#629-631">source</a><h4 class="code-header">fn <a href="#method.get_u64_ne" class="fnname">get_u64_ne</a>(&amp;mut self) -&gt; u64</h4></section></summary><div class="docblock"><p>Gets an unsigned 64 bit integer from <code>self</code> in native-endian byte order.</p>
<p>The current position is advanced by 8.</p>
<h5 id="examples-21"><a href="#examples-21">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf: <span class="kw-2">&amp;</span>[u8] = <span class="kw">match </span><span class="macro">cfg!</span>(target_endian = <span class="string">&quot;big&quot;</span>) {
<span class="bool-val">true </span>=&gt; <span class="string">b&quot;\x01\x02\x03\x04\x05\x06\x07\x08 hello&quot;</span>,
<span class="bool-val">false </span>=&gt; <span class="string">b&quot;\x08\x07\x06\x05\x04\x03\x02\x01 hello&quot;</span>,
};
<span class="macro">assert_eq!</span>(<span class="number">0x0102030405060708</span>, buf.get_u64_ne());</code></pre></div>
<h5 id="panics-18"><a href="#panics-18">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_i64" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#649-651">source</a><h4 class="code-header">fn <a href="#method.get_i64" class="fnname">get_i64</a>(&amp;mut self) -&gt; i64</h4></section></summary><div class="docblock"><p>Gets a signed 64 bit integer from <code>self</code> in big-endian byte order.</p>
<p>The current position is advanced by 8.</p>
<h5 id="examples-22"><a href="#examples-22">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x01\x02\x03\x04\x05\x06\x07\x08 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x0102030405060708</span>, buf.get_i64());</code></pre></div>
<h5 id="panics-19"><a href="#panics-19">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_i64_le" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#669-671">source</a><h4 class="code-header">fn <a href="#method.get_i64_le" class="fnname">get_i64_le</a>(&amp;mut self) -&gt; i64</h4></section></summary><div class="docblock"><p>Gets a signed 64 bit integer from <code>self</code> in little-endian byte order.</p>
<p>The current position is advanced by 8.</p>
<h5 id="examples-23"><a href="#examples-23">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x08\x07\x06\x05\x04\x03\x02\x01 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x0102030405060708</span>, buf.get_i64_le());</code></pre></div>
<h5 id="panics-20"><a href="#panics-20">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_i64_ne" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#692-694">source</a><h4 class="code-header">fn <a href="#method.get_i64_ne" class="fnname">get_i64_ne</a>(&amp;mut self) -&gt; i64</h4></section></summary><div class="docblock"><p>Gets a signed 64 bit integer from <code>self</code> in native-endian byte order.</p>
<p>The current position is advanced by 8.</p>
<h5 id="examples-24"><a href="#examples-24">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf: <span class="kw-2">&amp;</span>[u8] = <span class="kw">match </span><span class="macro">cfg!</span>(target_endian = <span class="string">&quot;big&quot;</span>) {
<span class="bool-val">true </span>=&gt; <span class="string">b&quot;\x01\x02\x03\x04\x05\x06\x07\x08 hello&quot;</span>,
<span class="bool-val">false </span>=&gt; <span class="string">b&quot;\x08\x07\x06\x05\x04\x03\x02\x01 hello&quot;</span>,
};
<span class="macro">assert_eq!</span>(<span class="number">0x0102030405060708</span>, buf.get_i64_ne());</code></pre></div>
<h5 id="panics-21"><a href="#panics-21">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_u128" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#712-714">source</a><h4 class="code-header">fn <a href="#method.get_u128" class="fnname">get_u128</a>(&amp;mut self) -&gt; u128</h4></section></summary><div class="docblock"><p>Gets an unsigned 128 bit integer from <code>self</code> in big-endian byte order.</p>
<p>The current position is advanced by 16.</p>
<h5 id="examples-25"><a href="#examples-25">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x01020304050607080910111213141516</span>, buf.get_u128());</code></pre></div>
<h5 id="panics-22"><a href="#panics-22">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_u128_le" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#732-734">source</a><h4 class="code-header">fn <a href="#method.get_u128_le" class="fnname">get_u128_le</a>(&amp;mut self) -&gt; u128</h4></section></summary><div class="docblock"><p>Gets an unsigned 128 bit integer from <code>self</code> in little-endian byte order.</p>
<p>The current position is advanced by 16.</p>
<h5 id="examples-26"><a href="#examples-26">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x01020304050607080910111213141516</span>, buf.get_u128_le());</code></pre></div>
<h5 id="panics-23"><a href="#panics-23">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_u128_ne" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#755-757">source</a><h4 class="code-header">fn <a href="#method.get_u128_ne" class="fnname">get_u128_ne</a>(&amp;mut self) -&gt; u128</h4></section></summary><div class="docblock"><p>Gets an unsigned 128 bit integer from <code>self</code> in native-endian byte order.</p>
<p>The current position is advanced by 16.</p>
<h5 id="examples-27"><a href="#examples-27">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf: <span class="kw-2">&amp;</span>[u8] = <span class="kw">match </span><span class="macro">cfg!</span>(target_endian = <span class="string">&quot;big&quot;</span>) {
<span class="bool-val">true </span>=&gt; <span class="string">b&quot;\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello&quot;</span>,
<span class="bool-val">false </span>=&gt; <span class="string">b&quot;\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01 hello&quot;</span>,
};
<span class="macro">assert_eq!</span>(<span class="number">0x01020304050607080910111213141516</span>, buf.get_u128_ne());</code></pre></div>
<h5 id="panics-24"><a href="#panics-24">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_i128" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#775-777">source</a><h4 class="code-header">fn <a href="#method.get_i128" class="fnname">get_i128</a>(&amp;mut self) -&gt; i128</h4></section></summary><div class="docblock"><p>Gets a signed 128 bit integer from <code>self</code> in big-endian byte order.</p>
<p>The current position is advanced by 16.</p>
<h5 id="examples-28"><a href="#examples-28">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x01020304050607080910111213141516</span>, buf.get_i128());</code></pre></div>
<h5 id="panics-25"><a href="#panics-25">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_i128_le" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#795-797">source</a><h4 class="code-header">fn <a href="#method.get_i128_le" class="fnname">get_i128_le</a>(&amp;mut self) -&gt; i128</h4></section></summary><div class="docblock"><p>Gets a signed 128 bit integer from <code>self</code> in little-endian byte order.</p>
<p>The current position is advanced by 16.</p>
<h5 id="examples-29"><a href="#examples-29">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x01020304050607080910111213141516</span>, buf.get_i128_le());</code></pre></div>
<h5 id="panics-26"><a href="#panics-26">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_i128_ne" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#818-820">source</a><h4 class="code-header">fn <a href="#method.get_i128_ne" class="fnname">get_i128_ne</a>(&amp;mut self) -&gt; i128</h4></section></summary><div class="docblock"><p>Gets a signed 128 bit integer from <code>self</code> in native-endian byte order.</p>
<p>The current position is advanced by 16.</p>
<h5 id="examples-30"><a href="#examples-30">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf: <span class="kw-2">&amp;</span>[u8] = <span class="kw">match </span><span class="macro">cfg!</span>(target_endian = <span class="string">&quot;big&quot;</span>) {
<span class="bool-val">true </span>=&gt; <span class="string">b&quot;\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello&quot;</span>,
<span class="bool-val">false </span>=&gt; <span class="string">b&quot;\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01 hello&quot;</span>,
};
<span class="macro">assert_eq!</span>(<span class="number">0x01020304050607080910111213141516</span>, buf.get_i128_ne());</code></pre></div>
<h5 id="panics-27"><a href="#panics-27">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_uint" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#838-840">source</a><h4 class="code-header">fn <a href="#method.get_uint" class="fnname">get_uint</a>(&amp;mut self, nbytes: usize) -&gt; u64</h4></section></summary><div class="docblock"><p>Gets an unsigned n-byte integer from <code>self</code> in big-endian byte order.</p>
<p>The current position is advanced by <code>nbytes</code>.</p>
<h5 id="examples-31"><a href="#examples-31">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x01\x02\x03 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x010203</span>, buf.get_uint(<span class="number">3</span>));</code></pre></div>
<h5 id="panics-28"><a href="#panics-28">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_uint_le" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#858-860">source</a><h4 class="code-header">fn <a href="#method.get_uint_le" class="fnname">get_uint_le</a>(&amp;mut self, nbytes: usize) -&gt; u64</h4></section></summary><div class="docblock"><p>Gets an unsigned n-byte integer from <code>self</code> in little-endian byte order.</p>
<p>The current position is advanced by <code>nbytes</code>.</p>
<h5 id="examples-32"><a href="#examples-32">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x03\x02\x01 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x010203</span>, buf.get_uint_le(<span class="number">3</span>));</code></pre></div>
<h5 id="panics-29"><a href="#panics-29">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_uint_ne" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#881-887">source</a><h4 class="code-header">fn <a href="#method.get_uint_ne" class="fnname">get_uint_ne</a>(&amp;mut self, nbytes: usize) -&gt; u64</h4></section></summary><div class="docblock"><p>Gets an unsigned n-byte integer from <code>self</code> in native-endian byte order.</p>
<p>The current position is advanced by <code>nbytes</code>.</p>
<h5 id="examples-33"><a href="#examples-33">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf: <span class="kw-2">&amp;</span>[u8] = <span class="kw">match </span><span class="macro">cfg!</span>(target_endian = <span class="string">&quot;big&quot;</span>) {
<span class="bool-val">true </span>=&gt; <span class="string">b&quot;\x01\x02\x03 hello&quot;</span>,
<span class="bool-val">false </span>=&gt; <span class="string">b&quot;\x03\x02\x01 hello&quot;</span>,
};
<span class="macro">assert_eq!</span>(<span class="number">0x010203</span>, buf.get_uint_ne(<span class="number">3</span>));</code></pre></div>
<h5 id="panics-30"><a href="#panics-30">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_int" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#905-907">source</a><h4 class="code-header">fn <a href="#method.get_int" class="fnname">get_int</a>(&amp;mut self, nbytes: usize) -&gt; i64</h4></section></summary><div class="docblock"><p>Gets a signed n-byte integer from <code>self</code> in big-endian byte order.</p>
<p>The current position is advanced by <code>nbytes</code>.</p>
<h5 id="examples-34"><a href="#examples-34">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x01\x02\x03 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x010203</span>, buf.get_int(<span class="number">3</span>));</code></pre></div>
<h5 id="panics-31"><a href="#panics-31">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_int_le" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#925-927">source</a><h4 class="code-header">fn <a href="#method.get_int_le" class="fnname">get_int_le</a>(&amp;mut self, nbytes: usize) -&gt; i64</h4></section></summary><div class="docblock"><p>Gets a signed n-byte integer from <code>self</code> in little-endian byte order.</p>
<p>The current position is advanced by <code>nbytes</code>.</p>
<h5 id="examples-35"><a href="#examples-35">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x03\x02\x01 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">0x010203</span>, buf.get_int_le(<span class="number">3</span>));</code></pre></div>
<h5 id="panics-32"><a href="#panics-32">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_int_ne" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#948-954">source</a><h4 class="code-header">fn <a href="#method.get_int_ne" class="fnname">get_int_ne</a>(&amp;mut self, nbytes: usize) -&gt; i64</h4></section></summary><div class="docblock"><p>Gets a signed n-byte integer from <code>self</code> in native-endian byte order.</p>
<p>The current position is advanced by <code>nbytes</code>.</p>
<h5 id="examples-36"><a href="#examples-36">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf: <span class="kw-2">&amp;</span>[u8] = <span class="kw">match </span><span class="macro">cfg!</span>(target_endian = <span class="string">&quot;big&quot;</span>) {
<span class="bool-val">true </span>=&gt; <span class="string">b&quot;\x01\x02\x03 hello&quot;</span>,
<span class="bool-val">false </span>=&gt; <span class="string">b&quot;\x03\x02\x01 hello&quot;</span>,
};
<span class="macro">assert_eq!</span>(<span class="number">0x010203</span>, buf.get_int_ne(<span class="number">3</span>));</code></pre></div>
<h5 id="panics-33"><a href="#panics-33">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_f32" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#973-975">source</a><h4 class="code-header">fn <a href="#method.get_f32" class="fnname">get_f32</a>(&amp;mut self) -&gt; f32</h4></section></summary><div class="docblock"><p>Gets an IEEE754 single-precision (4 bytes) floating point number from
<code>self</code> in big-endian byte order.</p>
<p>The current position is advanced by 4.</p>
<h5 id="examples-37"><a href="#examples-37">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x3F\x99\x99\x9A hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">1.2f32</span>, buf.get_f32());</code></pre></div>
<h5 id="panics-34"><a href="#panics-34">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_f32_le" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#994-996">source</a><h4 class="code-header">fn <a href="#method.get_f32_le" class="fnname">get_f32_le</a>(&amp;mut self) -&gt; f32</h4></section></summary><div class="docblock"><p>Gets an IEEE754 single-precision (4 bytes) floating point number from
<code>self</code> in little-endian byte order.</p>
<p>The current position is advanced by 4.</p>
<h5 id="examples-38"><a href="#examples-38">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x9A\x99\x99\x3F hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">1.2f32</span>, buf.get_f32_le());</code></pre></div>
<h5 id="panics-35"><a href="#panics-35">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_f32_ne" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1018-1020">source</a><h4 class="code-header">fn <a href="#method.get_f32_ne" class="fnname">get_f32_ne</a>(&amp;mut self) -&gt; f32</h4></section></summary><div class="docblock"><p>Gets an IEEE754 single-precision (4 bytes) floating point number from
<code>self</code> in native-endian byte order.</p>
<p>The current position is advanced by 4.</p>
<h5 id="examples-39"><a href="#examples-39">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf: <span class="kw-2">&amp;</span>[u8] = <span class="kw">match </span><span class="macro">cfg!</span>(target_endian = <span class="string">&quot;big&quot;</span>) {
<span class="bool-val">true </span>=&gt; <span class="string">b&quot;\x3F\x99\x99\x9A hello&quot;</span>,
<span class="bool-val">false </span>=&gt; <span class="string">b&quot;\x9A\x99\x99\x3F hello&quot;</span>,
};
<span class="macro">assert_eq!</span>(<span class="number">1.2f32</span>, buf.get_f32_ne());</code></pre></div>
<h5 id="panics-36"><a href="#panics-36">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_f64" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1039-1041">source</a><h4 class="code-header">fn <a href="#method.get_f64" class="fnname">get_f64</a>(&amp;mut self) -&gt; f64</h4></section></summary><div class="docblock"><p>Gets an IEEE754 double-precision (8 bytes) floating point number from
<code>self</code> in big-endian byte order.</p>
<p>The current position is advanced by 8.</p>
<h5 id="examples-40"><a href="#examples-40">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x3F\xF3\x33\x33\x33\x33\x33\x33 hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">1.2f64</span>, buf.get_f64());</code></pre></div>
<h5 id="panics-37"><a href="#panics-37">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_f64_le" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1060-1062">source</a><h4 class="code-header">fn <a href="#method.get_f64_le" class="fnname">get_f64_le</a>(&amp;mut self) -&gt; f64</h4></section></summary><div class="docblock"><p>Gets an IEEE754 double-precision (8 bytes) floating point number from
<code>self</code> in little-endian byte order.</p>
<p>The current position is advanced by 8.</p>
<h5 id="examples-41"><a href="#examples-41">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="kw-2">&amp;</span><span class="string">b&quot;\x33\x33\x33\x33\x33\x33\xF3\x3F hello&quot;</span>[..];
<span class="macro">assert_eq!</span>(<span class="number">1.2f64</span>, buf.get_f64_le());</code></pre></div>
<h5 id="panics-38"><a href="#panics-38">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_f64_ne" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1084-1086">source</a><h4 class="code-header">fn <a href="#method.get_f64_ne" class="fnname">get_f64_ne</a>(&amp;mut self) -&gt; f64</h4></section></summary><div class="docblock"><p>Gets an IEEE754 double-precision (8 bytes) floating point number from
<code>self</code> in native-endian byte order.</p>
<p>The current position is advanced by 8.</p>
<h5 id="examples-42"><a href="#examples-42">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>buf: <span class="kw-2">&amp;</span>[u8] = <span class="kw">match </span><span class="macro">cfg!</span>(target_endian = <span class="string">&quot;big&quot;</span>) {
<span class="bool-val">true </span>=&gt; <span class="string">b&quot;\x3F\xF3\x33\x33\x33\x33\x33\x33 hello&quot;</span>,
<span class="bool-val">false </span>=&gt; <span class="string">b&quot;\x33\x33\x33\x33\x33\x33\xF3\x3F hello&quot;</span>,
};
<span class="macro">assert_eq!</span>(<span class="number">1.2f64</span>, buf.get_f64_ne());</code></pre></div>
<h5 id="panics-39"><a href="#panics-39">Panics</a></h5>
<p>This function panics if there is not enough remaining data in <code>self</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.copy_to_bytes" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1103-1111">source</a><h4 class="code-header">fn <a href="#method.copy_to_bytes" class="fnname">copy_to_bytes</a>(&amp;mut self, len: usize) -&gt; <a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></h4></section></summary><div class="docblock"><p>Consumes <code>len</code> bytes inside self and returns new instance of <code>Bytes</code>
with this data.</p>
<p>This function may be optimized by the underlying type to avoid actual
copies. For example, <code>Bytes</code> implementation will do a shallow copy
(ref-count increment).</p>
<h5 id="examples-43"><a href="#examples-43">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span>bytes = (<span class="kw-2">&amp;</span><span class="string">b&quot;hello world&quot;</span>[..]).copy_to_bytes(<span class="number">5</span>);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>bytes[..], <span class="kw-2">&amp;</span><span class="string">b&quot;hello&quot;</span>[..]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.take" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1134-1139">source</a><h4 class="code-header">fn <a href="#method.take" class="fnname">take</a>(self, limit: usize) -&gt; <a class="struct" href="buf/struct.Take.html" title="struct bytes::buf::Take">Take</a>&lt;Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: Sized,</span></h4></section></summary><div class="docblock"><p>Creates an adaptor which will read at most <code>limit</code> bytes from <code>self</code>.</p>
<p>This function returns a new instance of <code>Buf</code> which will read at most
<code>limit</code> bytes.</p>
<h5 id="examples-44"><a href="#examples-44">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::{Buf, BufMut};
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="string">b&quot;hello world&quot;</span>[..].take(<span class="number">5</span>);
<span class="kw">let </span><span class="kw-2">mut </span>dst = <span class="macro">vec!</span>[];
dst.put(<span class="kw-2">&amp;mut </span>buf);
<span class="macro">assert_eq!</span>(dst, <span class="string">b&quot;hello&quot;</span>);
<span class="kw">let </span><span class="kw-2">mut </span>buf = buf.into_inner();
dst.clear();
dst.put(<span class="kw-2">&amp;mut </span>buf);
<span class="macro">assert_eq!</span>(dst, <span class="string">b&quot; world&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.chain" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1156-1161">source</a><h4 class="code-header">fn <a href="#method.chain" class="fnname">chain</a>&lt;U:&nbsp;<a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a>&gt;(self, next: U) -&gt; <a class="struct" href="buf/struct.Chain.html" title="struct bytes::buf::Chain">Chain</a>&lt;Self, U&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: Sized,</span></h4></section></summary><div class="docblock"><p>Creates an adaptor which will chain this buffer with another.</p>
<p>The returned <code>Buf</code> instance will first consume all bytes from <code>self</code>.
Afterwards the output is equivalent to the output of next.</p>
<h5 id="examples-45"><a href="#examples-45">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::Buf;
<span class="kw">let </span><span class="kw-2">mut </span>chain = <span class="string">b&quot;hello &quot;</span>[..].chain(<span class="kw-2">&amp;</span><span class="string">b&quot;world&quot;</span>[..]);
<span class="kw">let </span>full = chain.copy_to_bytes(<span class="number">11</span>);
<span class="macro">assert_eq!</span>(full.chunk(), <span class="string">b&quot;hello world&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.reader" class="method has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1188-1193">source</a><h4 class="code-header">fn <a href="#method.reader" class="fnname">reader</a>(self) -&gt; <a class="struct" href="buf/struct.Reader.html" title="struct bytes::buf::Reader">Reader</a>&lt;Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: Sized,</span></h4></section></summary><div class="docblock"><p>Creates an adaptor which implements the <code>Read</code> trait for <code>self</code>.</p>
<p>This function returns a new value which implements <code>Read</code> by adapting
the <code>Read</code> trait functions to the <code>Buf</code> trait functions. Given that
<code>Buf</code> operations are infallible, none of the <code>Read</code> functions will
return with <code>Err</code>.</p>
<h5 id="examples-46"><a href="#examples-46">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::{Bytes, Buf};
<span class="kw">use </span>std::io::Read;
<span class="kw">let </span>buf = Bytes::from(<span class="string">&quot;hello world&quot;</span>);
<span class="kw">let </span><span class="kw-2">mut </span>reader = buf.reader();
<span class="kw">let </span><span class="kw-2">mut </span>dst = [<span class="number">0</span>; <span class="number">1024</span>];
<span class="kw">let </span>num = reader.read(<span class="kw-2">&amp;mut </span>dst).unwrap();
<span class="macro">assert_eq!</span>(<span class="number">11</span>, num);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>dst[..<span class="number">11</span>], <span class="kw-2">&amp;</span><span class="string">b&quot;hello world&quot;</span>[..]);</code></pre></div>
</div></details></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Buf-for-%26mut%20T" class="impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1333-1335">source</a><a href="#impl-Buf-for-%26mut%20T" class="anchor"></a><h3 class="code-header">impl&lt;T:&nbsp;<a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a> + ?Sized&gt; <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a> for &amp;mut T</h3></section></summary><div class="impl-items"><section id="method.remaining" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.remaining" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.remaining" class="fnname">remaining</a>(&amp;self) -&gt; usize</h4></section><section id="method.chunk" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.chunk" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.chunk" class="fnname">chunk</a>(&amp;self) -&gt; &amp;[u8]</h4></section><section id="method.chunks_vectored-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.chunks_vectored-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.chunks_vectored" class="fnname">chunks_vectored</a>&lt;'b&gt;(&amp;'b self, dst: &amp;mut [IoSlice&lt;'b&gt;]) -&gt; usize</h4></section><section id="method.advance" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.advance" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.advance" class="fnname">advance</a>(&amp;mut self, cnt: usize)</h4></section><section id="method.has_remaining-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.has_remaining-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.has_remaining" class="fnname">has_remaining</a>(&amp;self) -&gt; bool</h4></section><section id="method.copy_to_slice-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.copy_to_slice-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.copy_to_slice" class="fnname">copy_to_slice</a>(&amp;mut self, dst: &amp;mut [u8])</h4></section><section id="method.get_u8-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_u8-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u8" class="fnname">get_u8</a>(&amp;mut self) -&gt; u8</h4></section><section id="method.get_i8-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_i8-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i8" class="fnname">get_i8</a>(&amp;mut self) -&gt; i8</h4></section><section id="method.get_u16-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_u16-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u16" class="fnname">get_u16</a>(&amp;mut self) -&gt; u16</h4></section><section id="method.get_u16_le-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_u16_le-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u16_le" class="fnname">get_u16_le</a>(&amp;mut self) -&gt; u16</h4></section><section id="method.get_u16_ne-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_u16_ne-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u16_ne" class="fnname">get_u16_ne</a>(&amp;mut self) -&gt; u16</h4></section><section id="method.get_i16-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_i16-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i16" class="fnname">get_i16</a>(&amp;mut self) -&gt; i16</h4></section><section id="method.get_i16_le-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_i16_le-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i16_le" class="fnname">get_i16_le</a>(&amp;mut self) -&gt; i16</h4></section><section id="method.get_i16_ne-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_i16_ne-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i16_ne" class="fnname">get_i16_ne</a>(&amp;mut self) -&gt; i16</h4></section><section id="method.get_u32-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_u32-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u32" class="fnname">get_u32</a>(&amp;mut self) -&gt; u32</h4></section><section id="method.get_u32_le-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_u32_le-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u32_le" class="fnname">get_u32_le</a>(&amp;mut self) -&gt; u32</h4></section><section id="method.get_u32_ne-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_u32_ne-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u32_ne" class="fnname">get_u32_ne</a>(&amp;mut self) -&gt; u32</h4></section><section id="method.get_i32-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_i32-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i32" class="fnname">get_i32</a>(&amp;mut self) -&gt; i32</h4></section><section id="method.get_i32_le-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_i32_le-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i32_le" class="fnname">get_i32_le</a>(&amp;mut self) -&gt; i32</h4></section><section id="method.get_i32_ne-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_i32_ne-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i32_ne" class="fnname">get_i32_ne</a>(&amp;mut self) -&gt; i32</h4></section><section id="method.get_u64-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_u64-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u64" class="fnname">get_u64</a>(&amp;mut self) -&gt; u64</h4></section><section id="method.get_u64_le-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_u64_le-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u64_le" class="fnname">get_u64_le</a>(&amp;mut self) -&gt; u64</h4></section><section id="method.get_u64_ne-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_u64_ne-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u64_ne" class="fnname">get_u64_ne</a>(&amp;mut self) -&gt; u64</h4></section><section id="method.get_i64-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_i64-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i64" class="fnname">get_i64</a>(&amp;mut self) -&gt; i64</h4></section><section id="method.get_i64_le-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_i64_le-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i64_le" class="fnname">get_i64_le</a>(&amp;mut self) -&gt; i64</h4></section><section id="method.get_i64_ne-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_i64_ne-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i64_ne" class="fnname">get_i64_ne</a>(&amp;mut self) -&gt; i64</h4></section><section id="method.get_uint-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_uint-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_uint" class="fnname">get_uint</a>(&amp;mut self, nbytes: usize) -&gt; u64</h4></section><section id="method.get_uint_le-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_uint_le-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_uint_le" class="fnname">get_uint_le</a>(&amp;mut self, nbytes: usize) -&gt; u64</h4></section><section id="method.get_uint_ne-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_uint_ne-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_uint_ne" class="fnname">get_uint_ne</a>(&amp;mut self, nbytes: usize) -&gt; u64</h4></section><section id="method.get_int-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_int-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_int" class="fnname">get_int</a>(&amp;mut self, nbytes: usize) -&gt; i64</h4></section><section id="method.get_int_le-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_int_le-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_int_le" class="fnname">get_int_le</a>(&amp;mut self, nbytes: usize) -&gt; i64</h4></section><section id="method.get_int_ne-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.get_int_ne-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_int_ne" class="fnname">get_int_ne</a>(&amp;mut self, nbytes: usize) -&gt; i64</h4></section><section id="method.copy_to_bytes-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1334">source</a><a href="#method.copy_to_bytes-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.copy_to_bytes" class="fnname">copy_to_bytes</a>(&amp;mut self, len: usize) -&gt; <a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Buf-for-Box%3CT%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1337-1339">source</a><a href="#impl-Buf-for-Box%3CT%3E" class="anchor"></a><h3 class="code-header">impl&lt;T:&nbsp;<a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a> + ?Sized&gt; <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a> for Box&lt;T&gt;</h3></section></summary><div class="impl-items"><section id="method.remaining-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.remaining-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.remaining" class="fnname">remaining</a>(&amp;self) -&gt; usize</h4></section><section id="method.chunk-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.chunk-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.chunk" class="fnname">chunk</a>(&amp;self) -&gt; &amp;[u8]</h4></section><section id="method.chunks_vectored-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.chunks_vectored-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.chunks_vectored" class="fnname">chunks_vectored</a>&lt;'b&gt;(&amp;'b self, dst: &amp;mut [IoSlice&lt;'b&gt;]) -&gt; usize</h4></section><section id="method.advance-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.advance-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.advance" class="fnname">advance</a>(&amp;mut self, cnt: usize)</h4></section><section id="method.has_remaining-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.has_remaining-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.has_remaining" class="fnname">has_remaining</a>(&amp;self) -&gt; bool</h4></section><section id="method.copy_to_slice-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.copy_to_slice-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.copy_to_slice" class="fnname">copy_to_slice</a>(&amp;mut self, dst: &amp;mut [u8])</h4></section><section id="method.get_u8-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_u8-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u8" class="fnname">get_u8</a>(&amp;mut self) -&gt; u8</h4></section><section id="method.get_i8-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_i8-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i8" class="fnname">get_i8</a>(&amp;mut self) -&gt; i8</h4></section><section id="method.get_u16-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_u16-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u16" class="fnname">get_u16</a>(&amp;mut self) -&gt; u16</h4></section><section id="method.get_u16_le-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_u16_le-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u16_le" class="fnname">get_u16_le</a>(&amp;mut self) -&gt; u16</h4></section><section id="method.get_u16_ne-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_u16_ne-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u16_ne" class="fnname">get_u16_ne</a>(&amp;mut self) -&gt; u16</h4></section><section id="method.get_i16-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_i16-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i16" class="fnname">get_i16</a>(&amp;mut self) -&gt; i16</h4></section><section id="method.get_i16_le-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_i16_le-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i16_le" class="fnname">get_i16_le</a>(&amp;mut self) -&gt; i16</h4></section><section id="method.get_i16_ne-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_i16_ne-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i16_ne" class="fnname">get_i16_ne</a>(&amp;mut self) -&gt; i16</h4></section><section id="method.get_u32-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_u32-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u32" class="fnname">get_u32</a>(&amp;mut self) -&gt; u32</h4></section><section id="method.get_u32_le-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_u32_le-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u32_le" class="fnname">get_u32_le</a>(&amp;mut self) -&gt; u32</h4></section><section id="method.get_u32_ne-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_u32_ne-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u32_ne" class="fnname">get_u32_ne</a>(&amp;mut self) -&gt; u32</h4></section><section id="method.get_i32-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_i32-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i32" class="fnname">get_i32</a>(&amp;mut self) -&gt; i32</h4></section><section id="method.get_i32_le-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_i32_le-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i32_le" class="fnname">get_i32_le</a>(&amp;mut self) -&gt; i32</h4></section><section id="method.get_i32_ne-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_i32_ne-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i32_ne" class="fnname">get_i32_ne</a>(&amp;mut self) -&gt; i32</h4></section><section id="method.get_u64-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_u64-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u64" class="fnname">get_u64</a>(&amp;mut self) -&gt; u64</h4></section><section id="method.get_u64_le-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_u64_le-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u64_le" class="fnname">get_u64_le</a>(&amp;mut self) -&gt; u64</h4></section><section id="method.get_u64_ne-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_u64_ne-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_u64_ne" class="fnname">get_u64_ne</a>(&amp;mut self) -&gt; u64</h4></section><section id="method.get_i64-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_i64-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i64" class="fnname">get_i64</a>(&amp;mut self) -&gt; i64</h4></section><section id="method.get_i64_le-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_i64_le-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i64_le" class="fnname">get_i64_le</a>(&amp;mut self) -&gt; i64</h4></section><section id="method.get_i64_ne-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_i64_ne-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_i64_ne" class="fnname">get_i64_ne</a>(&amp;mut self) -&gt; i64</h4></section><section id="method.get_uint-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_uint-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_uint" class="fnname">get_uint</a>(&amp;mut self, nbytes: usize) -&gt; u64</h4></section><section id="method.get_uint_le-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_uint_le-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_uint_le" class="fnname">get_uint_le</a>(&amp;mut self, nbytes: usize) -&gt; u64</h4></section><section id="method.get_uint_ne-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_uint_ne-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_uint_ne" class="fnname">get_uint_ne</a>(&amp;mut self, nbytes: usize) -&gt; u64</h4></section><section id="method.get_int-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_int-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_int" class="fnname">get_int</a>(&amp;mut self, nbytes: usize) -&gt; i64</h4></section><section id="method.get_int_le-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_int_le-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_int_le" class="fnname">get_int_le</a>(&amp;mut self, nbytes: usize) -&gt; i64</h4></section><section id="method.get_int_ne-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.get_int_ne-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.get_int_ne" class="fnname">get_int_ne</a>(&amp;mut self, nbytes: usize) -&gt; i64</h4></section><section id="method.copy_to_bytes-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1338">source</a><a href="#method.copy_to_bytes-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.copy_to_bytes" class="fnname">copy_to_bytes</a>(&amp;mut self, len: usize) -&gt; <a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Buf-for-%26%5Bu8%5D" class="impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1341-1356">source</a><a href="#impl-Buf-for-%26%5Bu8%5D" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a> for &amp;[u8]</h3></section></summary><div class="impl-items"><section id="method.remaining-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1343-1345">source</a><a href="#method.remaining-2" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.remaining" class="fnname">remaining</a>(&amp;self) -&gt; usize</h4></section><section id="method.chunk-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1348-1350">source</a><a href="#method.chunk-2" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.chunk" class="fnname">chunk</a>(&amp;self) -&gt; &amp;[u8]</h4></section><section id="method.advance-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1353-1355">source</a><a href="#method.advance-2" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.advance" class="fnname">advance</a>(&amp;mut self, cnt: usize)</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Buf-for-Cursor%3CT%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1359-1390">source</a><a href="#impl-Buf-for-Cursor%3CT%3E" class="anchor"></a><h3 class="code-header">impl&lt;T:&nbsp;AsRef&lt;[u8]&gt;&gt; <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a> for Cursor&lt;T&gt;</h3></section></summary><div class="impl-items"><section id="method.remaining-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1360-1369">source</a><a href="#method.remaining-3" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.remaining" class="fnname">remaining</a>(&amp;self) -&gt; usize</h4></section><section id="method.chunk-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1371-1380">source</a><a href="#method.chunk-3" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.chunk" class="fnname">chunk</a>(&amp;self) -&gt; &amp;[u8]</h4></section><section id="method.advance-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/buf_impl.rs.html#1382-1389">source</a><a href="#method.advance-3" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.advance" class="fnname">advance</a>(&amp;mut self, cnt: usize)</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Buf-for-VecDeque%3Cu8%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/vec_deque.rs.html#5-22">source</a><a href="#impl-Buf-for-VecDeque%3Cu8%3E" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a> for VecDeque&lt;u8&gt;</h3></section></summary><div class="impl-items"><section id="method.remaining-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/vec_deque.rs.html#6-8">source</a><a href="#method.remaining-4" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.remaining" class="fnname">remaining</a>(&amp;self) -&gt; usize</h4></section><section id="method.chunk-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/vec_deque.rs.html#10-17">source</a><a href="#method.chunk-4" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.chunk" class="fnname">chunk</a>(&amp;self) -&gt; &amp;[u8]</h4></section><section id="method.advance-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/vec_deque.rs.html#19-21">source</a><a href="#method.advance-4" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.advance" class="fnname">advance</a>(&amp;mut self, cnt: usize)</h4></section></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div id="implementors-list"><section id="impl-Buf-for-Bytes" class="impl has-srclink"><a class="srclink rightside" href="../src/bytes/bytes.rs.html#536-570">source</a><a href="#impl-Buf-for-Bytes" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a> for <a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></h3></section><section id="impl-Buf-for-BytesMut" class="impl has-srclink"><a class="srclink rightside" href="../src/bytes/bytes_mut.rs.html#1052-1079">source</a><a href="#impl-Buf-for-BytesMut" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a> for <a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">BytesMut</a></h3></section><section id="impl-Buf-for-Chain%3CT%2C%20U%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/chain.rs.html#132-191">source</a><a href="#impl-Buf-for-Chain%3CT%2C%20U%3E" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a> for <a class="struct" href="buf/struct.Chain.html" title="struct bytes::buf::Chain">Chain</a>&lt;T, U&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a>,</span></h3></section><section id="impl-Buf-for-Take%3CT%3E" class="impl has-srclink"><a class="srclink rightside" href="../src/bytes/buf/take.rs.html#132-155">source</a><a href="#impl-Buf-for-Take%3CT%3E" class="anchor"></a><h3 class="code-header">impl&lt;T:&nbsp;<a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a>&gt; <a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a> for <a class="struct" href="buf/struct.Take.html" title="struct bytes::buf::Take">Take</a>&lt;T&gt;</h3></section></div><script src="../implementors/bytes/buf/buf_impl/trait.Buf.js" data-ignore-extern-crates="alloc,core,std" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="bytes" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>