1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-07-02 20:04:31 +02:00

Deploying to gh-pages from @ actix/actix-net@af00dada5c 🚀

This commit is contained in:
github-merge-queue[bot]
2024-10-01 00:01:00 +00:00
commit 42c044fa2e
501 changed files with 42863 additions and 0 deletions

1
actix_codec/all.html Normal file
View 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-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_codec" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></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><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_codec/index.html">actix_<wbr>codec</a><span class="version">0.5.2</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><li><a href="#functions" title="Functions">Functions</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.BytesCodec.html">BytesCodec</a></li><li><a href="struct.Framed.html">Framed</a></li><li><a href="struct.FramedParts.html">FramedParts</a></li><li><a href="struct.LinesCodec.html">LinesCodec</a></li><li><a href="struct.ReadBuf.html">ReadBuf</a></li></ul><h3 id="traits">Traits</h3><ul class="all-items"><li><a href="trait.AsyncRead.html">AsyncRead</a></li><li><a href="trait.AsyncWrite.html">AsyncWrite</a></li><li><a href="trait.Decoder.html">Decoder</a></li><li><a href="trait.Encoder.html">Encoder</a></li></ul><h3 id="functions">Functions</h3><ul class="all-items"><li><a href="fn.poll_read_buf.html">poll_read_buf</a></li></ul></section></div></main></body></html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../actix_codec/struct.BytesCodec.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../actix_codec/struct.BytesCodec.html">../../actix_codec/struct.BytesCodec.html</a>...</p>
<script>location.replace("../../actix_codec/struct.BytesCodec.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,35 @@
<!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="Try to read data from an `AsyncRead` into an implementer of the `BufMut` trait."><title>poll_read_buf in actix_codec - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_codec" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc fn"><!--[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><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_codec/index.html">actix_<wbr>codec</a><span class="version">0.5.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">poll_<wbr>read_<wbr>buf</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate actix_<wbr>codec</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">actix_codec</a></span><h1>Function <span class="fn">poll_read_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"></span></div><pre class="rust item-decl"><code>pub fn poll_read_buf&lt;T, B&gt;(
io: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut T</a>&gt;,
cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut B</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;&gt;<div class="where">where
T: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
B: BufMut,</div></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Try to read data from an <code>AsyncRead</code> into an implementer of the <a href="bytes::Buf"><code>BufMut</code></a> trait.</p>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>bytes::{Bytes, BytesMut};
<span class="kw">use </span>tokio_stream <span class="kw">as </span>stream;
<span class="kw">use </span>tokio::io::Result;
<span class="kw">use </span>tokio_util::io::{StreamReader, poll_read_buf};
<span class="kw">use </span>futures::future::poll_fn;
<span class="kw">use </span>std::pin::Pin;
<span class="comment">// Create a reader from an iterator. This particular reader will always be
// ready.
</span><span class="kw">let </span><span class="kw-2">mut </span>read = StreamReader::new(stream::iter(<span class="macro">vec!</span>[Result::Ok(Bytes::from_static(<span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]))]));
<span class="kw">let </span><span class="kw-2">mut </span>buf = BytesMut::new();
<span class="kw">let </span><span class="kw-2">mut </span>reads = <span class="number">0</span>;
<span class="kw">loop </span>{
reads += <span class="number">1</span>;
<span class="kw">let </span>n = poll_fn(|cx| poll_read_buf(Pin::new(<span class="kw-2">&amp;mut </span>read), cx, <span class="kw-2">&amp;mut </span>buf)).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">if </span>n == <span class="number">0 </span>{
<span class="kw">break</span>;
}
}
<span class="comment">// one or more reads might be necessary.
</span><span class="macro">assert!</span>(reads &gt;= <span class="number">1</span>);
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>buf[..], <span class="kw-2">&amp;</span>[<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);</code></pre></div>
</div></details></section></div></main></body></html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../actix_codec/struct.Framed.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../actix_codec/struct.Framed.html">../../actix_codec/struct.Framed.html</a>...</p>
<script>location.replace("../../actix_codec/struct.Framed.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../actix_codec/struct.FramedParts.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../actix_codec/struct.FramedParts.html">../../actix_codec/struct.FramedParts.html</a>...</p>
<script>location.replace("../../actix_codec/struct.FramedParts.html" + location.search + location.hash);</script>
</body>
</html>

6
actix_codec/index.html Normal file
View File

@ -0,0 +1,6 @@
<!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="Codec utilities for working with framed protocols."><title>actix_codec - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_codec" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></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><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_codec/index.html">actix_<wbr>codec</a><span class="version">0.5.2</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="#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><li><a href="#functions" title="Functions">Functions</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>actix_codec</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/actix_codec/lib.rs.html#1-28">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Codec utilities for working with framed protocols.</p>
<p>Contains adapters to go from streams of bytes, <a href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead"><code>AsyncRead</code></a> and <a href="trait.AsyncWrite.html" title="trait actix_codec::AsyncWrite"><code>AsyncWrite</code></a>, to framed
streams implementing <a href="futures_sink::Sink"><code>Sink</code></a> and <a href="futures_core::Stream"><code>Stream</code></a>. Framed streams are also known as <code>transports</code>.</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.BytesCodec.html" title="struct actix_codec::BytesCodec">Bytes<wbr>Codec</a></div><div class="desc docblock-short">Bytes codec. Reads/writes chunks of bytes from a stream.</div></li><li><div class="item-name"><a class="struct" href="struct.Framed.html" title="struct actix_codec::Framed">Framed</a></div><div class="desc docblock-short">A unified <code>Stream</code> and <code>Sink</code> interface to an underlying I/O object, using the <code>Encoder</code> and
<code>Decoder</code> traits to encode and decode frames.</div></li><li><div class="item-name"><a class="struct" href="struct.FramedParts.html" title="struct actix_codec::FramedParts">Framed<wbr>Parts</a></div><div class="desc docblock-short"><code>FramedParts</code> contains an export of the data of a Framed transport.</div></li><li><div class="item-name"><a class="struct" href="struct.LinesCodec.html" title="struct actix_codec::LinesCodec">Lines<wbr>Codec</a></div><div class="desc docblock-short">Lines codec. Reads/writes line delimited strings.</div></li><li><div class="item-name"><a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a></div><div class="desc docblock-short">A wrapper around a byte buffer that is incrementally filled and initialized.</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.AsyncRead.html" title="trait actix_codec::AsyncRead">Async<wbr>Read</a></div><div class="desc docblock-short">Reads bytes from a source.</div></li><li><div class="item-name"><a class="trait" href="trait.AsyncWrite.html" title="trait actix_codec::AsyncWrite">Async<wbr>Write</a></div><div class="desc docblock-short">Writes bytes asynchronously.</div></li><li><div class="item-name"><a class="trait" href="trait.Decoder.html" title="trait actix_codec::Decoder">Decoder</a></div><div class="desc docblock-short">Decoding of frames via buffers.</div></li><li><div class="item-name"><a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a></div><div class="desc docblock-short">Trait of helper objects to write out messages as bytes, for use with
<a href="crate::codec::FramedWrite"><code>FramedWrite</code></a>.</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.poll_read_buf.html" title="fn actix_codec::poll_read_buf">poll_<wbr>read_<wbr>buf</a></div><div class="desc docblock-short">Try to read data from an <code>AsyncRead</code> into an implementer of the <a href="bytes::Buf"><code>BufMut</code></a> trait.</div></li></ul></section></div></main></body></html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../actix_codec/struct.LinesCodec.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../actix_codec/struct.LinesCodec.html">../../actix_codec/struct.LinesCodec.html</a>...</p>
<script>location.replace("../../actix_codec/struct.LinesCodec.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"fn":["poll_read_buf"],"struct":["BytesCodec","Framed","FramedParts","LinesCodec","ReadBuf"],"trait":["AsyncRead","AsyncWrite","Decoder","Encoder"]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,106 @@
<!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="Reads bytes from a source."><title>AsyncRead in actix_codec - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_codec" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></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" title="show sidebar"></button><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_codec/index.html">actix_<wbr>codec</a><span class="version">0.5.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Async<wbr>Read</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.poll_read" title="poll_read">poll_read</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-AsyncRead-for-%26%5Bu8%5D" title="&#38;[u8]">&#38;[u8]</a></li><li><a href="#impl-AsyncRead-for-%26mut+T" title="&#38;mut T">&#38;mut T</a></li><li><a href="#impl-AsyncRead-for-Box%3CT%3E" title="Box&#60;T&#62;">Box&#60;T&#62;</a></li><li><a href="#impl-AsyncRead-for-Cursor%3CT%3E" title="Cursor&#60;T&#62;">Cursor&#60;T&#62;</a></li><li><a href="#impl-AsyncRead-for-Either%3CL,+R%3E" title="Either&#60;L, R&#62;">Either&#60;L, R&#62;</a></li><li><a href="#impl-AsyncRead-for-InspectReader%3CR,+F%3E" title="InspectReader&#60;R, F&#62;">InspectReader&#60;R, F&#62;</a></li><li><a href="#impl-AsyncRead-for-InspectWriter%3CW,+F%3E" title="InspectWriter&#60;W, F&#62;">InspectWriter&#60;W, F&#62;</a></li><li><a href="#impl-AsyncRead-for-Pin%3CP%3E" title="Pin&#60;P&#62;">Pin&#60;P&#62;</a></li><li><a href="#impl-AsyncRead-for-SinkWriter%3CS%3E" title="SinkWriter&#60;S&#62;">SinkWriter&#60;S&#62;</a></li><li><a href="#impl-AsyncRead-for-StreamReader%3CS,+B%3E" title="StreamReader&#60;S, B&#62;">StreamReader&#60;S, B&#62;</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate actix_<wbr>codec</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">actix_codec</a></span><h1>Trait <span class="trait">AsyncRead</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub trait AsyncRead {
// Required method
fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;&amp;mut Self&gt;,
cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
buf: &amp;mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;&gt;;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Reads bytes from a source.</p>
<p>This trait is analogous to the <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read"><code>std::io::Read</code></a> trait, but integrates with
the asynchronous task system. In particular, the <a href="trait.AsyncRead.html#tymethod.poll_read" title="method actix_codec::AsyncRead::poll_read"><code>poll_read</code></a> method,
unlike <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#tymethod.read" title="method std::io::Read::read"><code>Read::read</code></a>, will automatically queue the current task for wakeup
and return if data is not yet available, rather than blocking the calling
thread.</p>
<p>Specifically, this means that the <code>poll_read</code> function will return one of
the following:</p>
<ul>
<li>
<p><code>Poll::Ready(Ok(()))</code> means that data was immediately read and placed into
the output buffer. The amount of data read can be determined by the
increase in the length of the slice returned by <code>ReadBuf::filled</code>. If the
difference is 0, either EOF has been reached, or the output buffer had zero
capacity (i.e. <code>buf.remaining()</code> == 0).</p>
</li>
<li>
<p><code>Poll::Pending</code> means that no data was read into the buffer
provided. The I/O object is not currently readable but may become readable
in the future. Most importantly, <strong>the current futures task is scheduled
to get unparked when the object is readable</strong>. This means that like
<code>Future::poll</code> youll receive a notification when the I/O object is
readable again.</p>
</li>
<li>
<p><code>Poll::Ready(Err(e))</code> for other errors are standard I/O errors coming from the
underlying object.</p>
</li>
</ul>
<p>This trait importantly means that the <code>read</code> method only works in the
context of a futures task. The object may panic if used outside of a task.</p>
<p>Utilities for working with <code>AsyncRead</code> values are provided by
<a href="crate::io::AsyncReadExt"><code>AsyncReadExt</code></a>.</p>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.poll_read" class="method"><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;&amp;mut Self&gt;,
cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
buf: &amp;mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Attempts to read from the <code>AsyncRead</code> into <code>buf</code>.</p>
<p>On success, returns <code>Poll::Ready(Ok(()))</code> and places data in the
unfilled portion of <code>buf</code>. If no data was read (<code>buf.filled().len()</code> is
unchanged), it implies that EOF has been reached.</p>
<p>If no data is available for reading, the method returns <code>Poll::Pending</code>
and arranges for the current task (via <code>cx.waker()</code>) to receive a
notification when the object becomes readable or is closed.</p>
</div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-%26%5Bu8%5D" class="impl"><a href="#impl-AsyncRead-for-%26%5Bu8%5D" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for &amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]</h3></section></summary><div class="impl-items"><section id="method.poll_read" class="method trait-impl"><a href="#method.poll_read" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;&amp;mut &amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]&gt;,
_cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
buf: &amp;mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-Either%3CL,+R%3E" class="impl"><a href="#impl-AsyncRead-for-Either%3CL,+R%3E" class="anchor">§</a><h3 class="code-header">impl&lt;L, R&gt; <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for Either&lt;L, R&gt;<div class="where">where
L: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a>,
R: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-1" class="method trait-impl"><a href="#method.poll_read-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;&amp;mut Either&lt;L, R&gt;&gt;,
cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
buf: &amp;mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-Pin%3CP%3E" class="impl"><a href="#impl-AsyncRead-for-Pin%3CP%3E" class="anchor">§</a><h3 class="code-header">impl&lt;P&gt; <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;P&gt;<div class="where">where
P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,
&lt;P as <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a>: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-2" class="method trait-impl"><a href="#method.poll_read-2" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;&amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;P&gt;&gt;,
cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
buf: &amp;mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-InspectReader%3CR,+F%3E" class="impl"><a href="#impl-AsyncRead-for-InspectReader%3CR,+F%3E" class="anchor">§</a><h3 class="code-header">impl&lt;R, F&gt; <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for InspectReader&lt;R, F&gt;<div class="where">where
R: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a>,
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]),</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-3" class="method trait-impl"><a href="#method.poll_read-3" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;&amp;mut InspectReader&lt;R, F&gt;&gt;,
cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
buf: &amp;mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-SinkWriter%3CS%3E" class="impl"><a href="#impl-AsyncRead-for-SinkWriter%3CS%3E" class="anchor">§</a><h3 class="code-header">impl&lt;S&gt; <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for SinkWriter&lt;S&gt;<div class="where">where
S: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-4" class="method trait-impl"><a href="#method.poll_read-4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;&amp;mut SinkWriter&lt;S&gt;&gt;,
cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
buf: &amp;mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-StreamReader%3CS,+B%3E" class="impl"><a href="#impl-AsyncRead-for-StreamReader%3CS,+B%3E" class="anchor">§</a><h3 class="code-header">impl&lt;S, B, E&gt; <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for StreamReader&lt;S, B&gt;<div class="where">where
S: Stream&lt;Item = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;B, E&gt;&gt;,
B: Buf,
E: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-5" class="method trait-impl"><a href="#method.poll_read-5" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;&amp;mut StreamReader&lt;S, B&gt;&gt;,
cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
buf: &amp;mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-%26mut+T" class="impl"><a href="#impl-AsyncRead-for-%26mut+T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut T</a><div class="where">where
T: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-6" class="method trait-impl"><a href="#method.poll_read-6" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;&amp;mut <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut T</a>&gt;,
cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
buf: &amp;mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-Box%3CT%3E" class="impl"><a href="#impl-AsyncRead-for-Box%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;T&gt;<div class="where">where
T: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-7" class="method trait-impl"><a href="#method.poll_read-7" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;&amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;T&gt;&gt;,
cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
buf: &amp;mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-Cursor%3CT%3E" class="impl"><a href="#impl-AsyncRead-for-Cursor%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/cursor/struct.Cursor.html" title="struct std::io::cursor::Cursor">Cursor</a>&lt;T&gt;<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]&gt; + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-8" class="method trait-impl"><a href="#method.poll_read-8" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;&amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/cursor/struct.Cursor.html" title="struct std::io::cursor::Cursor">Cursor</a>&lt;T&gt;&gt;,
_cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
buf: &amp;mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;&gt;</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsyncRead-for-InspectWriter%3CW,+F%3E" class="impl"><a href="#impl-AsyncRead-for-InspectWriter%3CW,+F%3E" class="anchor">§</a><h3 class="code-header">impl&lt;W, F&gt; <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for InspectWriter&lt;W, F&gt;<div class="where">where
W: <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a>,</div></h3></section></summary><div class="impl-items"><section id="method.poll_read-9" class="method trait-impl"><a href="#method.poll_read-9" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_read" class="fn">poll_read</a>(
self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;&amp;mut InspectWriter&lt;W, F&gt;&gt;,
cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;,
buf: &amp;mut <a class="struct" href="struct.ReadBuf.html" title="struct actix_codec::ReadBuf">ReadBuf</a>&lt;'_&gt;,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;&gt;</h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-AsyncRead-for-OwnedReadHalf" class="impl"><a href="#impl-AsyncRead-for-OwnedReadHalf" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for OwnedReadHalf</h3></section><section id="impl-AsyncRead-for-OwnedReadHalf-1" class="impl"><a href="#impl-AsyncRead-for-OwnedReadHalf-1" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for OwnedReadHalf</h3></section><section id="impl-AsyncRead-for-ReadHalf%3C'_%3E" class="impl"><a href="#impl-AsyncRead-for-ReadHalf%3C'_%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for ReadHalf&lt;'_&gt;</h3></section><section id="impl-AsyncRead-for-ReadHalf%3C'_%3E-1" class="impl"><a href="#impl-AsyncRead-for-ReadHalf%3C'_%3E-1" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for ReadHalf&lt;'_&gt;</h3></section><section id="impl-AsyncRead-for-Receiver" class="impl"><a href="#impl-AsyncRead-for-Receiver" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for Receiver</h3></section><section id="impl-AsyncRead-for-TcpStream" class="impl"><a href="#impl-AsyncRead-for-TcpStream" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for TcpStream</h3></section><section id="impl-AsyncRead-for-UnixStream" class="impl"><a href="#impl-AsyncRead-for-UnixStream" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AsyncRead.html" title="trait actix_codec::AsyncRead">AsyncRead</a> for UnixStream</h3></section></div><script src="../trait.impl/tokio/io/async_read/trait.AsyncRead.js" data-ignore-extern-crates="alloc,core,tokio,std,tokio_util" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,21 @@
<!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="Trait of helper objects to write out messages as bytes, for use with `FramedWrite`."><title>Encoder in actix_codec - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_codec" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></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" title="show sidebar"></button><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_codec/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_codec/index.html">actix_<wbr>codec</a><span class="version">0.5.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Encoder</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.encode" title="encode">encode</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate actix_<wbr>codec</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">actix_codec</a></span><h1>Trait <span class="trait">Encoder</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub trait Encoder&lt;Item&gt; {
type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;;
// Required method
fn <a href="#tymethod.encode" class="fn">encode</a>(
&amp;mut self,
item: Item,
dst: &amp;mut BytesMut,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.Encoder.html#associatedtype.Error" title="type actix_codec::Encoder::Error">Error</a>&gt;;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait of helper objects to write out messages as bytes, for use with
<a href="crate::codec::FramedWrite"><code>FramedWrite</code></a>.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>The type of encoding errors.</p>
<p><a href="crate::codec::FramedWrite"><code>FramedWrite</code></a> requires <code>Encoder</code>s errors to implement <code>From&lt;io::Error&gt;</code>
in the interest of letting it return <code>Error</code>s directly.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.encode" class="method"><h4 class="code-header">fn <a href="#tymethod.encode" class="fn">encode</a>(&amp;mut self, item: Item, dst: &amp;mut BytesMut) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.Encoder.html#associatedtype.Error" title="type actix_codec::Encoder::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Encodes a frame into the buffer provided.</p>
<p>This method will encode <code>item</code> into the byte buffer provided by <code>dst</code>.
The <code>dst</code> provided is an internal buffer of the <a href="crate::codec::FramedWrite"><code>FramedWrite</code></a> instance and
will be written out when possible.</p>
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CBytes%3E-for-BytesCodec" class="impl"><a class="src rightside" href="../src/actix_codec/bcodec.rs.html#11-19">source</a><a href="#impl-Encoder%3CBytes%3E-for-BytesCodec" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a>&lt;Bytes&gt; for actix_codec::<a class="struct" href="struct.BytesCodec.html" title="struct actix_codec::BytesCodec">BytesCodec</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/actix_codec/bcodec.rs.html#12">source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CBytes%3E-for-BytesCodec-1" class="impl"><a href="#impl-Encoder%3CBytes%3E-for-BytesCodec-1" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a>&lt;Bytes&gt; for BytesCodec</h3></section></summary><div class="impl-items"><section id="associatedtype.Error-2" class="associatedtype trait-impl"><a href="#associatedtype.Error-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CBytes%3E-for-LengthDelimitedCodec" class="impl"><a href="#impl-Encoder%3CBytes%3E-for-LengthDelimitedCodec" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a>&lt;Bytes&gt; for LengthDelimitedCodec</h3></section></summary><div class="impl-items"><section id="associatedtype.Error-3" class="associatedtype trait-impl"><a href="#associatedtype.Error-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CBytesMut%3E-for-BytesCodec" class="impl"><a href="#impl-Encoder%3CBytesMut%3E-for-BytesCodec" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a>&lt;BytesMut&gt; for BytesCodec</h3></section></summary><div class="impl-items"><section id="associatedtype.Error-4" class="associatedtype trait-impl"><a href="#associatedtype.Error-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CT%3E-for-AnyDelimiterCodec" class="impl"><a href="#impl-Encoder%3CT%3E-for-AnyDelimiterCodec" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a>&lt;T&gt; for AnyDelimiterCodec<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-5" class="associatedtype trait-impl"><a href="#associatedtype.Error-5" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = AnyDelimiterCodecError</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CT%3E-for-LinesCodec" class="impl"><a href="#impl-Encoder%3CT%3E-for-LinesCodec" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a>&lt;T&gt; for LinesCodec<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-6" class="associatedtype trait-impl"><a href="#associatedtype.Error-6" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = LinesCodecError</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Encoder%3CT%3E-for-LinesCodec-1" class="impl"><a class="src rightside" href="../src/actix_codec/lines.rs.html#16-27">source</a><a href="#impl-Encoder%3CT%3E-for-LinesCodec-1" class="anchor">§</a><h3 class="code-header">impl&lt;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt; <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a>&lt;T&gt; for actix_codec::<a class="struct" href="struct.LinesCodec.html" title="struct actix_codec::LinesCodec">LinesCodec</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Error-7" class="associatedtype trait-impl"><a class="src rightside" href="../src/actix_codec/lines.rs.html#17">source</a><a href="#associatedtype.Error-7" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a></h4></section></div></details></div><script src="../trait.impl/tokio_util/codec/encoder/trait.Encoder.js" data-ignore-extern-crates="tokio_util" async></script></section></div></main></body></html>