mirror of
https://github.com/NotAShelf/mpvrc.git
synced 2026-04-17 08:19:51 +00:00
deploy: de38ae62916547ad097c066f94a32e9ba7790eeb
This commit is contained in:
commit
9a86359447
28502 changed files with 1261284 additions and 0 deletions
1
bytes/all.html
Normal file
1
bytes/all.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<!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="List of all items in this crate"><title>List of all items in this crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bytes" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod sys"><!--[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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../bytes/index.html">bytes</a><span class="version">1.9.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><h1>List of all items</h1><h3 id="structs">Structs</h3><ul class="all-items"><li><a href="struct.Bytes.html">Bytes</a></li><li><a href="struct.BytesMut.html">BytesMut</a></li><li><a href="buf/struct.Chain.html">buf::Chain</a></li><li><a href="buf/struct.IntoIter.html">buf::IntoIter</a></li><li><a href="buf/struct.Limit.html">buf::Limit</a></li><li><a href="buf/struct.Reader.html">buf::Reader</a></li><li><a href="buf/struct.Take.html">buf::Take</a></li><li><a href="buf/struct.UninitSlice.html">buf::UninitSlice</a></li><li><a href="buf/struct.Writer.html">buf::Writer</a></li></ul><h3 id="traits">Traits</h3><ul class="all-items"><li><a href="buf/trait.Buf.html">buf::Buf</a></li><li><a href="buf/trait.BufMut.html">buf::BufMut</a></li></ul></section></div></main></body></html>
|
||||
11
bytes/buf/buf_impl/trait.Buf.html
Normal file
11
bytes/buf/buf_impl/trait.Buf.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../bytes/buf/trait.Buf.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../bytes/buf/trait.Buf.html">../../../bytes/buf/trait.Buf.html</a>...</p>
|
||||
<script>location.replace("../../../bytes/buf/trait.Buf.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
bytes/buf/buf_mut/trait.BufMut.html
Normal file
11
bytes/buf/buf_mut/trait.BufMut.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../bytes/buf/trait.BufMut.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../bytes/buf/trait.BufMut.html">../../../bytes/buf/trait.BufMut.html</a>...</p>
|
||||
<script>location.replace("../../../bytes/buf/trait.BufMut.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
bytes/buf/chain/struct.Chain.html
Normal file
11
bytes/buf/chain/struct.Chain.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../bytes/buf/struct.Chain.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../bytes/buf/struct.Chain.html">../../../bytes/buf/struct.Chain.html</a>...</p>
|
||||
<script>location.replace("../../../bytes/buf/struct.Chain.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
bytes/buf/index.html
Normal file
11
bytes/buf/index.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!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="Utilities for working with buffers."><title>bytes::buf - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="bytes" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../bytes/index.html">bytes</a><span class="version">1.9.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module buf</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#buf-bufmut" title="`Buf`, `BufMut`"><code>Buf</code>, <code>BufMut</code></a></li></ul><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate bytes</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">bytes</a></span><h1>Module <span>buf</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/bytes/buf/mod.rs.html#1-39">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Utilities for working with buffers.</p>
|
||||
<p>A buffer is any structure that contains a sequence of bytes. The bytes may
|
||||
or may not be stored in contiguous memory. This module contains traits used
|
||||
to abstract over buffers as well as utilities for working with buffer types.</p>
|
||||
<h2 id="buf-bufmut"><a class="doc-anchor" href="#buf-bufmut">§</a><code>Buf</code>, <code>BufMut</code></h2>
|
||||
<p>These are the two foundational traits for abstractly working with buffers.
|
||||
They can be thought as iterators for byte structures. They offer additional
|
||||
performance over <code>Iterator</code> by providing an API optimized for byte slices.</p>
|
||||
<p>See <a href="trait.Buf.html" title="trait bytes::buf::Buf"><code>Buf</code></a> and <a href="trait.BufMut.html" title="trait bytes::buf::BufMut"><code>BufMut</code></a> for more details.</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Chain.html" title="struct bytes::buf::Chain">Chain</a></div><div class="desc docblock-short">A <code>Chain</code> sequences two buffers.</div></li><li><div class="item-name"><a class="struct" href="struct.IntoIter.html" title="struct bytes::buf::IntoIter">Into<wbr>Iter</a></div><div class="desc docblock-short">Iterator over the bytes contained by the buffer.</div></li><li><div class="item-name"><a class="struct" href="struct.Limit.html" title="struct bytes::buf::Limit">Limit</a></div><div class="desc docblock-short">A <code>BufMut</code> adapter which limits the amount of bytes that can be written
|
||||
to an underlying buffer.</div></li><li><div class="item-name"><a class="struct" href="struct.Reader.html" title="struct bytes::buf::Reader">Reader</a></div><div class="desc docblock-short">A <code>Buf</code> adapter which implements <code>io::Read</code> for the inner value.</div></li><li><div class="item-name"><a class="struct" href="struct.Take.html" title="struct bytes::buf::Take">Take</a></div><div class="desc docblock-short">A <code>Buf</code> adapter which limits the bytes read from an underlying buffer.</div></li><li><div class="item-name"><a class="struct" href="struct.UninitSlice.html" title="struct bytes::buf::UninitSlice">Uninit<wbr>Slice</a></div><div class="desc docblock-short">Uninitialized byte slice.</div></li><li><div class="item-name"><a class="struct" href="struct.Writer.html" title="struct bytes::buf::Writer">Writer</a></div><div class="desc docblock-short">A <code>BufMut</code> adapter which implements <code>io::Write</code> for the inner value.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.Buf.html" title="trait bytes::buf::Buf">Buf</a></div><div class="desc docblock-short">Read bytes from a buffer.</div></li><li><div class="item-name"><a class="trait" href="trait.BufMut.html" title="trait bytes::buf::BufMut">BufMut</a></div><div class="desc docblock-short">A trait for values that provide sequential write access to bytes.</div></li></ul></section></div></main></body></html>
|
||||
11
bytes/buf/iter/struct.IntoIter.html
Normal file
11
bytes/buf/iter/struct.IntoIter.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../bytes/buf/struct.IntoIter.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../bytes/buf/struct.IntoIter.html">../../../bytes/buf/struct.IntoIter.html</a>...</p>
|
||||
<script>location.replace("../../../bytes/buf/struct.IntoIter.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
bytes/buf/limit/struct.Limit.html
Normal file
11
bytes/buf/limit/struct.Limit.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../bytes/buf/struct.Limit.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../bytes/buf/struct.Limit.html">../../../bytes/buf/struct.Limit.html</a>...</p>
|
||||
<script>location.replace("../../../bytes/buf/struct.Limit.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
bytes/buf/reader/struct.Reader.html
Normal file
11
bytes/buf/reader/struct.Reader.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../bytes/buf/struct.Reader.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../bytes/buf/struct.Reader.html">../../../bytes/buf/struct.Reader.html</a>...</p>
|
||||
<script>location.replace("../../../bytes/buf/struct.Reader.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
1
bytes/buf/sidebar-items.js
Normal file
1
bytes/buf/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"struct":["Chain","IntoIter","Limit","Reader","Take","UninitSlice","Writer"],"trait":["Buf","BufMut"]};
|
||||
120
bytes/buf/struct.Chain.html
Normal file
120
bytes/buf/struct.Chain.html
Normal file
File diff suppressed because one or more lines are too long
274
bytes/buf/struct.IntoIter.html
Normal file
274
bytes/buf/struct.IntoIter.html
Normal file
File diff suppressed because one or more lines are too long
47
bytes/buf/struct.Limit.html
Normal file
47
bytes/buf/struct.Limit.html
Normal file
File diff suppressed because one or more lines are too long
56
bytes/buf/struct.Reader.html
Normal file
56
bytes/buf/struct.Reader.html
Normal file
File diff suppressed because one or more lines are too long
99
bytes/buf/struct.Take.html
Normal file
99
bytes/buf/struct.Take.html
Normal file
File diff suppressed because one or more lines are too long
106
bytes/buf/struct.UninitSlice.html
Normal file
106
bytes/buf/struct.UninitSlice.html
Normal file
File diff suppressed because one or more lines are too long
55
bytes/buf/struct.Writer.html
Normal file
55
bytes/buf/struct.Writer.html
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<!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="A `BufMut` adapter which implements `io::Write` for the inner value."><title>Writer in bytes::buf - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="bytes" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc struct"><!--[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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../bytes/index.html">bytes</a><span class="version">1.9.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Writer</a></h2><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.get_mut" title="get_mut">get_mut</a></li><li><a href="#method.get_ref" title="get_ref">get_ref</a></li><li><a href="#method.into_inner" title="into_inner">into_inner</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Debug-for-Writer%3CB%3E" title="Debug">Debug</a></li><li><a href="#impl-Write-for-Writer%3CB%3E" title="Write">Write</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-Writer%3CB%3E" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-Writer%3CB%3E" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Writer%3CB%3E" title="Send">Send</a></li><li><a href="#impl-Sync-for-Writer%3CB%3E" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-Writer%3CB%3E" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Writer%3CB%3E" title="UnwindSafe">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T" title="From<T>">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into<U>">Into<U></a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom<U>">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto<U>">TryInto<U></a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In bytes::<wbr>buf</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">bytes</a>::<wbr><a href="index.html">buf</a></span><h1>Struct <span class="struct">Writer</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/bytes/buf/writer.rs.html#11-13">Source</a> </span></div><pre class="rust item-decl"><code>pub struct Writer<B> { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A <code>BufMut</code> adapter which implements <code>io::Write</code> for the inner value.</p>
|
||||
<p>This struct is generally created by calling <code>writer()</code> on <code>BufMut</code>. See
|
||||
documentation of <a href="trait.BufMut.html#method.writer" title="method bytes::buf::BufMut::writer"><code>writer()</code></a> for more
|
||||
details.</p>
|
||||
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Writer%3CB%3E" class="impl"><a class="src rightside" href="../../src/bytes/buf/writer.rs.html#19-75">Source</a><a href="#impl-Writer%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BufMut.html" title="trait bytes::buf::BufMut">BufMut</a>> <a class="struct" href="struct.Writer.html" title="struct bytes::buf::Writer">Writer</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.get_ref" class="method"><a class="src rightside" href="../../src/bytes/buf/writer.rs.html#33-35">Source</a><h4 class="code-header">pub fn <a href="#method.get_ref" class="fn">get_ref</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&B</a></h4></section></summary><div class="docblock"><p>Gets a reference to the underlying <code>BufMut</code>.</p>
|
||||
<p>It is inadvisable to directly write to the underlying <code>BufMut</code>.</p>
|
||||
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::BufMut;
|
||||
|
||||
<span class="kw">let </span>buf = Vec::with_capacity(<span class="number">1024</span>).writer();
|
||||
|
||||
<span class="macro">assert_eq!</span>(<span class="number">1024</span>, buf.get_ref().capacity());</code></pre></div>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_mut" class="method"><a class="src rightside" href="../../src/bytes/buf/writer.rs.html#52-54">Source</a><h4 class="code-header">pub fn <a href="#method.get_mut" class="fn">get_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&mut B</a></h4></section></summary><div class="docblock"><p>Gets a mutable reference to the underlying <code>BufMut</code>.</p>
|
||||
<p>It is inadvisable to directly write to the underlying <code>BufMut</code>.</p>
|
||||
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::BufMut;
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="macro">vec!</span>[].writer();
|
||||
|
||||
buf.get_mut().reserve(<span class="number">1024</span>);
|
||||
|
||||
<span class="macro">assert_eq!</span>(<span class="number">1024</span>, buf.get_ref().capacity());</code></pre></div>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_inner" class="method"><a class="src rightside" href="../../src/bytes/buf/writer.rs.html#72-74">Source</a><h4 class="code-header">pub fn <a href="#method.into_inner" class="fn">into_inner</a>(self) -> B</h4></section></summary><div class="docblock"><p>Consumes this <code>Writer</code>, returning the underlying value.</p>
|
||||
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::BufMut;
|
||||
<span class="kw">use </span>std::io;
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="macro">vec!</span>[].writer();
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>src = <span class="kw-2">&</span><span class="string">b"hello world"</span>[..];
|
||||
|
||||
io::copy(<span class="kw-2">&mut </span>src, <span class="kw-2">&mut </span>buf).unwrap();
|
||||
|
||||
<span class="kw">let </span>buf = buf.into_inner();
|
||||
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span>buf, <span class="string">b"hello world"</span>[..]);</code></pre></div>
|
||||
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Writer%3CB%3E" class="impl"><a class="src rightside" href="../../src/bytes/buf/writer.rs.html#10">Source</a><a href="#impl-Debug-for-Writer%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Writer.html" title="struct bytes::buf::Writer">Writer</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/bytes/buf/writer.rs.html#10">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.84.1/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.84.1/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.84.1/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Write-for-Writer%3CB%3E" class="impl"><a class="src rightside" href="../../src/bytes/buf/writer.rs.html#77-88">Source</a><a href="#impl-Write-for-Writer%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B: <a class="trait" href="trait.BufMut.html" title="trait bytes::buf::BufMut">BufMut</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>> <a class="trait" href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="struct.Writer.html" title="struct bytes::buf::Writer">Writer</a><B></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.write" class="method trait-impl"><a class="src rightside" href="../../src/bytes/buf/writer.rs.html#78-83">Source</a><a href="#method.write" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#tymethod.write" class="fn">write</a>(&mut self, src: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <a class="type" href="https://doc.rust-lang.org/1.84.1/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>></h4></section></summary><div class='docblock'>Writes a buffer into this writer, returning how many bytes were written. <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#tymethod.write">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.flush" class="method trait-impl"><a class="src rightside" href="../../src/bytes/buf/writer.rs.html#85-87">Source</a><a href="#method.flush" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#tymethod.flush" class="fn">flush</a>(&mut self) -> <a class="type" href="https://doc.rust-lang.org/1.84.1/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>></h4></section></summary><div class='docblock'>Flushes this output stream, ensuring that all intermediately buffered
|
||||
contents reach their destination. <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#tymethod.flush">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_vectored" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.36.0">1.36.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.1/src/std/io/mod.rs.html#1671">Source</a></span><a href="#method.write_vectored" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#method.write_vectored" class="fn">write_vectored</a>(&mut self, bufs: &[<a class="struct" href="https://doc.rust-lang.org/1.84.1/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a><'_>]) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.usize.html">usize</a>, <a class="struct" href="https://doc.rust-lang.org/1.84.1/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class='docblock'>Like <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#tymethod.write" title="method std::io::Write::write"><code>write</code></a>, except that it writes from a slice of buffers. <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#method.write_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.is_write_vectored" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/std/io/mod.rs.html#1686">Source</a><a href="#method.is_write_vectored" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#method.is_write_vectored" class="fn">is_write_vectored</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.bool.html">bool</a></h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>can_vector</code>)</span></div></span><div class='docblock'>Determines if this <code>Write</code>r has an efficient <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#method.write_vectored" title="method std::io::Write::write_vectored"><code>write_vectored</code></a>
|
||||
implementation. <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#method.is_write_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_all" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.1/src/std/io/mod.rs.html#1748">Source</a></span><a href="#method.write_all" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#method.write_all" class="fn">write_all</a>(&mut self, buf: &[<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.84.1/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class='docblock'>Attempts to write an entire buffer into this writer. <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#method.write_all">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_all_vectored" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/std/io/mod.rs.html#1810">Source</a><a href="#method.write_all_vectored" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#method.write_all_vectored" class="fn">write_all_vectored</a>(&mut self, bufs: &mut [<a class="struct" href="https://doc.rust-lang.org/1.84.1/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a><'_>]) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.84.1/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>write_all_vectored</code>)</span></div></span><div class='docblock'>Attempts to write multiple buffers into this writer. <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#method.write_all_vectored">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.write_fmt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.1/src/std/io/mod.rs.html#1863">Source</a></span><a href="#method.write_fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#method.write_fmt" class="fn">write_fmt</a>(&mut self, fmt: <a class="struct" href="https://doc.rust-lang.org/1.84.1/core/fmt/struct.Arguments.html" title="struct core::fmt::Arguments">Arguments</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.84.1/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></section></summary><div class='docblock'>Writes a formatted string into this writer, returning any error
|
||||
encountered. <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#method.write_fmt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.by_ref" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.84.1/src/std/io/mod.rs.html#1923-1925">Source</a></span><a href="#method.by_ref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#method.by_ref" class="fn">by_ref</a>(&mut self) -> &mut Self<div class="where">where
|
||||
Self: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Creates a “by reference” adapter for this instance of <code>Write</code>. <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html#method.by_ref">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-Writer%3CB%3E" class="impl"><a href="#impl-Freeze-for-Writer%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.Writer.html" title="struct bytes::buf::Writer">Writer</a><B><div class="where">where
|
||||
B: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a>,</div></h3></section><section id="impl-RefUnwindSafe-for-Writer%3CB%3E" class="impl"><a href="#impl-RefUnwindSafe-for-Writer%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Writer.html" title="struct bytes::buf::Writer">Writer</a><B><div class="where">where
|
||||
B: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,</div></h3></section><section id="impl-Send-for-Writer%3CB%3E" class="impl"><a href="#impl-Send-for-Writer%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Writer.html" title="struct bytes::buf::Writer">Writer</a><B><div class="where">where
|
||||
B: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section><section id="impl-Sync-for-Writer%3CB%3E" class="impl"><a href="#impl-Sync-for-Writer%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Writer.html" title="struct bytes::buf::Writer">Writer</a><B><div class="where">where
|
||||
B: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</div></h3></section><section id="impl-Unpin-for-Writer%3CB%3E" class="impl"><a href="#impl-Unpin-for-Writer%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Writer.html" title="struct bytes::buf::Writer">Writer</a><B><div class="where">where
|
||||
B: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</div></h3></section><section id="impl-UnwindSafe-for-Writer%3CB%3E" class="impl"><a href="#impl-UnwindSafe-for-Writer%3CB%3E" class="anchor">§</a><h3 class="code-header">impl<B> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Writer.html" title="struct bytes::buf::Writer">Writer</a><B><div class="where">where
|
||||
B: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</div></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||||
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.84.1/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.84.1/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/borrow.rs.html#209">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/borrow.rs.html#211">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.84.1/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/borrow.rs.html#217">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.84.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/borrow.rs.html#218">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.84.1/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.84.1/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/convert/mod.rs.html#765">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/convert/mod.rs.html#768">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
|
||||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/convert/mod.rs.html#748-750">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
|
||||
U: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/convert/mod.rs.html#758">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
|
||||
<p>That is, this conversion is whatever the implementation of
|
||||
<code><a href="https://doc.rust-lang.org/1.84.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
|
||||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/convert/mod.rs.html#805-807">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where
|
||||
U: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/convert/mod.rs.html#809">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/convert/mod.rs.html#812">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/convert/mod.rs.html#790-792">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
|
||||
U: <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/convert/mod.rs.html#794">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.84.1/src/core/convert/mod.rs.html#797">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.84.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.84.1/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>
|
||||
11
bytes/buf/take/struct.Take.html
Normal file
11
bytes/buf/take/struct.Take.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../bytes/buf/struct.Take.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../bytes/buf/struct.Take.html">../../../bytes/buf/struct.Take.html</a>...</p>
|
||||
<script>location.replace("../../../bytes/buf/struct.Take.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
628
bytes/buf/trait.Buf.html
Normal file
628
bytes/buf/trait.Buf.html
Normal file
File diff suppressed because one or more lines are too long
741
bytes/buf/trait.BufMut.html
Normal file
741
bytes/buf/trait.BufMut.html
Normal file
File diff suppressed because one or more lines are too long
11
bytes/buf/uninit_slice/struct.UninitSlice.html
Normal file
11
bytes/buf/uninit_slice/struct.UninitSlice.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../bytes/buf/struct.UninitSlice.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../bytes/buf/struct.UninitSlice.html">../../../bytes/buf/struct.UninitSlice.html</a>...</p>
|
||||
<script>location.replace("../../../bytes/buf/struct.UninitSlice.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
bytes/buf/writer/struct.Writer.html
Normal file
11
bytes/buf/writer/struct.Writer.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../bytes/buf/struct.Writer.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../bytes/buf/struct.Writer.html">../../../bytes/buf/struct.Writer.html</a>...</p>
|
||||
<script>location.replace("../../../bytes/buf/struct.Writer.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
bytes/bytes/struct.Bytes.html
Normal file
11
bytes/bytes/struct.Bytes.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../bytes/struct.Bytes.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../bytes/struct.Bytes.html">../../bytes/struct.Bytes.html</a>...</p>
|
||||
<script>location.replace("../../bytes/struct.Bytes.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
11
bytes/bytes_mut/struct.BytesMut.html
Normal file
11
bytes/bytes_mut/struct.BytesMut.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../bytes/struct.BytesMut.html">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../bytes/struct.BytesMut.html">../../bytes/struct.BytesMut.html</a>...</p>
|
||||
<script>location.replace("../../bytes/struct.BytesMut.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
50
bytes/index.html
Normal file
50
bytes/index.html
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<!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="Provides abstractions for working with bytes."><title>bytes - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bytes" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.1 (e71f9a9a9 2025-01-27)" data-channel="1.84.1" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../bytes/index.html">bytes</a><span class="version">1.9.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#bytes" title="`Bytes`"><code>Bytes</code></a></li><li><a href="#buf-bufmut" title="`Buf`, `BufMut`"><code>Buf</code>, <code>BufMut</code></a><ul><li><a href="#relation-with-read-and-write" title="Relation with `Read` and `Write`">Relation with <code>Read</code> and <code>Write</code></a></li></ul></li></ul><h3><a href="#reexports">Crate Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>bytes</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/bytes/lib.rs.html#1-165">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Provides abstractions for working with bytes.</p>
|
||||
<p>The <code>bytes</code> crate provides an efficient byte buffer structure
|
||||
(<a href="struct.Bytes.html" title="struct bytes::Bytes"><code>Bytes</code></a>) and traits for working with buffer
|
||||
implementations (<a href="buf/trait.Buf.html" title="trait bytes::buf::Buf"><code>Buf</code></a>, <a href="buf/trait.BufMut.html" title="trait bytes::buf::BufMut"><code>BufMut</code></a>).</p>
|
||||
<h2 id="bytes"><a class="doc-anchor" href="#bytes">§</a><code>Bytes</code></h2>
|
||||
<p><code>Bytes</code> is an efficient container for storing and operating on contiguous
|
||||
slices of memory. It is intended for use primarily in networking code, but
|
||||
could have applications elsewhere as well.</p>
|
||||
<p><code>Bytes</code> values facilitate zero-copy network programming by allowing multiple
|
||||
<code>Bytes</code> objects to point to the same underlying memory. This is managed by
|
||||
using a reference count to track when the memory is no longer needed and can
|
||||
be freed.</p>
|
||||
<p>A <code>Bytes</code> handle can be created directly from an existing byte store (such as <code>&[u8]</code>
|
||||
or <code>Vec<u8></code>), but usually a <code>BytesMut</code> is used first and written to. For
|
||||
example:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::{BytesMut, BufMut};
|
||||
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::with_capacity(<span class="number">1024</span>);
|
||||
buf.put(<span class="kw-2">&</span><span class="string">b"hello world"</span>[..]);
|
||||
buf.put_u16(<span class="number">1234</span>);
|
||||
|
||||
<span class="kw">let </span>a = buf.split();
|
||||
<span class="macro">assert_eq!</span>(a, <span class="string">b"hello world\x04\xD2"</span>[..]);
|
||||
|
||||
buf.put(<span class="kw-2">&</span><span class="string">b"goodbye world"</span>[..]);
|
||||
|
||||
<span class="kw">let </span>b = buf.split();
|
||||
<span class="macro">assert_eq!</span>(b, <span class="string">b"goodbye world"</span>[..]);
|
||||
|
||||
<span class="macro">assert_eq!</span>(buf.capacity(), <span class="number">998</span>);</code></pre></div>
|
||||
<p>In the above example, only a single buffer of 1024 is allocated. The handles
|
||||
<code>a</code> and <code>b</code> will share the underlying buffer and maintain indices tracking
|
||||
the view into the buffer represented by the handle.</p>
|
||||
<p>See the <a href="struct.Bytes.html" title="struct bytes::Bytes">struct docs</a> for more details.</p>
|
||||
<h2 id="buf-bufmut"><a class="doc-anchor" href="#buf-bufmut">§</a><code>Buf</code>, <code>BufMut</code></h2>
|
||||
<p>These two traits provide read and write access to buffers. The underlying
|
||||
storage may or may not be in contiguous memory. For example, <code>Bytes</code> is a
|
||||
buffer that guarantees contiguous memory, but a <a href="https://en.wikipedia.org/wiki/Rope_(data_structure)">rope</a> stores the bytes in
|
||||
disjoint chunks. <code>Buf</code> and <code>BufMut</code> maintain cursors tracking the current
|
||||
position in the underlying byte storage. When bytes are read or written, the
|
||||
cursor is advanced.</p>
|
||||
<h3 id="relation-with-read-and-write"><a class="doc-anchor" href="#relation-with-read-and-write">§</a>Relation with <code>Read</code> and <code>Write</code></h3>
|
||||
<p>At first glance, it may seem that <code>Buf</code> and <code>BufMut</code> overlap in
|
||||
functionality with <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Read.html" title="trait std::io::Read"><code>std::io::Read</code></a> and <a href="https://doc.rust-lang.org/1.84.1/std/io/trait.Write.html" title="trait std::io::Write"><code>std::io::Write</code></a>. However, they
|
||||
serve different purposes. A buffer is the value that is provided as an
|
||||
argument to <code>Read::read</code> and <code>Write::write</code>. <code>Read</code> and <code>Write</code> may then
|
||||
perform a syscall, which has the potential of failing. Operations on <code>Buf</code>
|
||||
and <code>BufMut</code> are infallible.</p>
|
||||
</div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name" id="reexport.Buf"><code>pub use crate::buf::<a class="trait" href="buf/trait.Buf.html" title="trait bytes::buf::Buf">Buf</a>;</code></div></li><li><div class="item-name" id="reexport.BufMut"><code>pub use crate::buf::<a class="trait" href="buf/trait.BufMut.html" title="trait bytes::buf::BufMut">BufMut</a>;</code></div></li></ul><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="buf/index.html" title="mod bytes::buf">buf</a></div><div class="desc docblock-short">Utilities for working with buffers.</div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Bytes.html" title="struct bytes::Bytes">Bytes</a></div><div class="desc docblock-short">A cheaply cloneable and sliceable chunk of contiguous memory.</div></li><li><div class="item-name"><a class="struct" href="struct.BytesMut.html" title="struct bytes::BytesMut">Bytes<wbr>Mut</a></div><div class="desc docblock-short">A unique reference to a contiguous slice of memory.</div></li></ul></section></div></main></body></html>
|
||||
1
bytes/sidebar-items.js
Normal file
1
bytes/sidebar-items.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.SIDEBAR_ITEMS = {"mod":["buf"],"struct":["Bytes","BytesMut"]};
|
||||
1455
bytes/struct.Bytes.html
Normal file
1455
bytes/struct.Bytes.html
Normal file
File diff suppressed because one or more lines are too long
2956
bytes/struct.BytesMut.html
Normal file
2956
bytes/struct.BytesMut.html
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue