101 lines
28 KiB
HTML
101 lines
28 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Decoder` trait in crate `tokio_util`."><meta name="keywords" content="rust, rustlang, rust-lang, Decoder"><title>tokio_util::codec::Decoder - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
|
||
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
|
||
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../tokio_util/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Trait Decoder</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#associated-types">Associated Types</a><div class="sidebar-links"><a href="#associatedtype.Error">Error</a><a href="#associatedtype.Item">Item</a></div><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.decode">decode</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.decode_eof">decode_eof</a><a href="#method.framed">framed</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class="location"><a href="../index.html">tokio_util</a>::<wbr><a href="index.html">codec</a></p><script>window.sidebarCurrent = {name: "Decoder", ty: "trait", relpath: ""};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
|
||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/tokio_util/codec/decoder.rs.html#21-165" title="goto source code">[src]</a></span><span class="in-band">Trait <a href="../index.html">tokio_util</a>::<wbr><a href="index.html">codec</a>::<wbr><a class="trait" href="">Decoder</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust trait">pub trait Decoder {
|
||
type <a href="#associatedtype.Item" class="type">Item</a>;
|
||
type <a href="#associatedtype.Error" class="type">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>;
|
||
fn <a href="#tymethod.decode" class="fnname">decode</a>(<br> &mut self, <br> src: &mut <a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a><br> ) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self::<a class="type" href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Item" title="type tokio_util::codec::Decoder::Item">Item</a>>, Self::<a class="type" href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Error" title="type tokio_util::codec::Decoder::Error">Error</a>>;
|
||
|
||
fn <a href="#method.decode_eof" class="fnname">decode_eof</a>(<br> &mut self, <br> buf: &mut <a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a><br> ) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self::<a class="type" href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Item" title="type tokio_util::codec::Decoder::Item">Item</a>>, Self::<a class="type" href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Error" title="type tokio_util::codec::Decoder::Error">Error</a>> { ... }
|
||
<div class="item-spacer"></div> fn <a href="#method.framed" class="fnname">framed</a><T: <a class="trait" href="../../tokio/io/async_read/trait.AsyncRead.html" title="trait tokio::io::async_read::AsyncRead">AsyncRead</a> + <a class="trait" href="../../tokio/io/async_write/trait.AsyncWrite.html" title="trait tokio::io::async_write::AsyncWrite">AsyncWrite</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>>(self, io: T) -> <a class="struct" href="../../tokio_util/codec/struct.Framed.html" title="struct tokio_util::codec::Framed">Framed</a><T, Self><br> <span class="where">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span>,
|
||
{ ... }
|
||
}</pre></div><div class="docblock"><p>Decoding of frames via buffers.</p>
|
||
<p>This trait is used when constructing an instance of <a href="../../tokio_util/codec/struct.Framed.html"><code>Framed</code></a> or
|
||
<a href="../../tokio_util/codec/struct.FramedRead.html"><code>FramedRead</code></a>. An implementation of <code>Decoder</code> takes a byte stream that has
|
||
already been buffered in <code>src</code> and decodes the data into a stream of
|
||
<code>Self::Item</code> frames.</p>
|
||
<p>Implementations are able to track state on <code>self</code>, which enables
|
||
implementing stateful streaming parsers. In many cases, though, this type
|
||
will simply be a unit struct (e.g. <code>struct HttpDecoder</code>).</p>
|
||
</div><h2 id="associated-types" class="small-section-header">Associated Types<a href="#associated-types" class="anchor"></a></h2><div class="methods"><h3 id="associatedtype.Item" class="method"><code>type <a href="#associatedtype.Item" class="type">Item</a></code><a class="srclink" href="../../src/tokio_util/codec/decoder.rs.html#23" title="goto source code">[src]</a></h3><div class="docblock"><p>The type of decoded frames.</p>
|
||
</div><h3 id="associatedtype.Error" class="method"><code>type <a href="#associatedtype.Error" class="type">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></code><a class="srclink" href="../../src/tokio_util/codec/decoder.rs.html#40" title="goto source code">[src]</a></h3><div class="docblock"><p>The type of unrecoverable frame decoding errors.</p>
|
||
<p>If an individual message is ill-formed but can be ignored without
|
||
interfering with the processing of future messages, it may be more
|
||
useful to report the failure as an <code>Item</code>.</p>
|
||
<p><code>From<io::Error></code> is required in the interest of making <code>Error</code> suitable
|
||
for returning directly from a <a href="../../tokio_util/codec/struct.FramedRead.html"><code>FramedRead</code></a>, and to enable the default
|
||
implementation of <code>decode_eof</code> to yield an <code>io::Error</code> when the decoder
|
||
fails to consume all available data.</p>
|
||
<p>Note that implementors of this trait can simply indicate <code>type Error = io::Error</code> to use I/O errors as this type.</p>
|
||
</div></div><span class="loading-content">Loading content...</span><h2 id="required-methods" class="small-section-header">Required methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><h3 id="tymethod.decode" class="method"><code>fn <a href="#tymethod.decode" class="fnname">decode</a>(<br> &mut self, <br> src: &mut <a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self::<a class="type" href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Item" title="type tokio_util::codec::Decoder::Item">Item</a>>, Self::<a class="type" href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Error" title="type tokio_util::codec::Decoder::Error">Error</a>></code><a class="srclink" href="../../src/tokio_util/codec/decoder.rs.html#110" title="goto source code">[src]</a></h3><div class="docblock"><p>Attempts to decode a frame from the provided buffer of bytes.</p>
|
||
<p>This method is called by <a href="../../tokio_util/codec/struct.FramedRead.html"><code>FramedRead</code></a> whenever bytes are ready to be
|
||
parsed. The provided buffer of bytes is what's been read so far, and
|
||
this instance of <code>Decode</code> can determine whether an entire frame is in
|
||
the buffer and is ready to be returned.</p>
|
||
<p>If an entire frame is available, then this instance will remove those
|
||
bytes from the buffer provided and return them as a decoded
|
||
frame. Note that removing bytes from the provided buffer doesn't always
|
||
necessarily copy the bytes, so this should be an efficient operation in
|
||
most circumstances.</p>
|
||
<p>If the bytes look valid, but a frame isn't fully available yet, then
|
||
<code>Ok(None)</code> is returned. This indicates to the <a href="../../tokio_util/codec/struct.Framed.html"><code>Framed</code></a> instance that
|
||
it needs to read some more bytes before calling this method again.</p>
|
||
<p>Note that the bytes provided may be empty. If a previous call to
|
||
<code>decode</code> consumed all the bytes in the buffer then <code>decode</code> will be
|
||
called again until it returns <code>Ok(None)</code>, indicating that more bytes need to
|
||
be read.</p>
|
||
<p>Finally, if the bytes in the buffer are malformed then an error is
|
||
returned indicating why. This informs <a href="../../tokio_util/codec/struct.Framed.html"><code>Framed</code></a> that the stream is now
|
||
corrupt and should be terminated.</p>
|
||
<h1 id="buffer-management" class="section-header"><a href="#buffer-management">Buffer management</a></h1>
|
||
<p>Before returning from the function, implementations should ensure that
|
||
the buffer has appropriate capacity in anticipation of future calls to
|
||
<code>decode</code>. Failing to do so leads to inefficiency.</p>
|
||
<p>For example, if frames have a fixed length, or if the length of the
|
||
current frame is known from a header, a possible buffer management
|
||
strategy is:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">impl</span> <span class="ident">Decoder</span> <span class="kw">for</span> <span class="ident">MyCodec</span> {
|
||
<span class="comment">// ...</span>
|
||
|
||
<span class="kw">fn</span> <span class="ident">decode</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">src</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">BytesMut</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="prelude-ty">Option</span><span class="op"><</span><span class="self">Self</span>::<span class="ident">Item</span><span class="op">></span>, <span class="self">Self</span>::<span class="ident">Error</span><span class="op">></span> {
|
||
<span class="comment">// ...</span>
|
||
|
||
<span class="comment">// Reserve enough to complete decoding of the current frame.</span>
|
||
<span class="kw">let</span> <span class="ident">current_frame_len</span>: <span class="ident">usize</span> <span class="op">=</span> <span class="number">1000</span>; <span class="comment">// Example.</span>
|
||
<span class="comment">// And to start decoding the next frame.</span>
|
||
<span class="kw">let</span> <span class="ident">next_frame_header_len</span>: <span class="ident">usize</span> <span class="op">=</span> <span class="number">10</span>; <span class="comment">// Example.</span>
|
||
<span class="ident">src</span>.<span class="ident">reserve</span>(<span class="ident">current_frame_len</span> <span class="op">+</span> <span class="ident">next_frame_header_len</span>);
|
||
|
||
<span class="kw">return</span> <span class="prelude-val">Ok</span>(<span class="prelude-val">None</span>);
|
||
}
|
||
}</pre></div>
|
||
<p>An optimal buffer management strategy minimizes reallocations and
|
||
over-allocations.</p>
|
||
</div></div><span class="loading-content">Loading content...</span><h2 id="provided-methods" class="small-section-header">Provided methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><h3 id="method.decode_eof" class="method"><code>fn <a href="#method.decode_eof" class="fnname">decode_eof</a>(<br> &mut self, <br> buf: &mut <a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self::<a class="type" href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Item" title="type tokio_util::codec::Decoder::Item">Item</a>>, Self::<a class="type" href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Error" title="type tokio_util::codec::Decoder::Error">Error</a>></code><a class="srclink" href="../../src/tokio_util/codec/decoder.rs.html#125-136" title="goto source code">[src]</a></h3><div class="docblock"><p>A default method available to be called when there are no more bytes
|
||
available to be read from the underlying I/O.</p>
|
||
<p>This method defaults to calling <code>decode</code> and returns an error if
|
||
<code>Ok(None)</code> is returned while there is unconsumed data in <code>buf</code>.
|
||
Typically this doesn't need to be implemented unless the framing
|
||
protocol differs near the end of the stream.</p>
|
||
<p>Note that the <code>buf</code> argument may be empty. If a previous call to
|
||
<code>decode_eof</code> consumed all the bytes in the buffer, <code>decode_eof</code> will be
|
||
called again until it returns <code>None</code>, indicating that there are no more
|
||
frames to yield. This behavior enables returning finalization frames
|
||
that may not be based on inbound data.</p>
|
||
</div><h3 id="method.framed" class="method"><code>fn <a href="#method.framed" class="fnname">framed</a><T: <a class="trait" href="../../tokio/io/async_read/trait.AsyncRead.html" title="trait tokio::io::async_read::AsyncRead">AsyncRead</a> + <a class="trait" href="../../tokio/io/async_write/trait.AsyncWrite.html" title="trait tokio::io::async_write::AsyncWrite">AsyncWrite</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>>(self, io: T) -> <a class="struct" href="../../tokio_util/codec/struct.Framed.html" title="struct tokio_util::codec::Framed">Framed</a><T, Self> <span class="where fmt-newline">where<br> Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a class="srclink" href="../../src/tokio_util/codec/decoder.rs.html#159-164" title="goto source code">[src]</a></h3><div class="docblock"><p>Provides a <a href="../../futures_core/stream/trait.Stream.html"><code>Stream</code></a> and <a href="../../futures_sink/trait.Sink.html"><code>Sink</code></a> interface for reading and writing to this
|
||
<code>Io</code> object, using <code>Decode</code> and <code>Encode</code> to read and write the raw data.</p>
|
||
<p>Raw I/O objects work with byte sequences, but higher-level code usually
|
||
wants to batch these into meaningful chunks, called "frames". This
|
||
method layers framing on top of an I/O object, by using the <code>Codec</code>
|
||
traits to handle encoding and decoding of messages frames. Note that
|
||
the incoming and outgoing frame types may be distinct.</p>
|
||
<p>This function returns a <em>single</em> object that is both <code>Stream</code> and
|
||
<code>Sink</code>; grouping this into a single object is often useful for layering
|
||
things like gzip or TLS, which require both read and write access to the
|
||
underlying object.</p>
|
||
<p>If you want to work more directly with the streams and sink, consider
|
||
calling <code>split</code> on the <a href="../../tokio_util/codec/struct.Framed.html"><code>Framed</code></a> returned by this method, which will
|
||
break them into separate objects, allowing them to interact more easily.</p>
|
||
</div></div><span class="loading-content">Loading content...</span><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><h3 id="impl-Decoder" class="impl"><code class="in-band">impl Decoder for <a class="struct" href="../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodec.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodec">LengthDelimitedCodec</a></code><a href="#impl-Decoder" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/length_delimited.rs.html#549-578" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Item-1" class="type"><code>type <a href="#associatedtype.Item-1" class="type">Item</a> = <a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a></code></h4><h4 id="associatedtype.Error-1" class="type"><code>type <a href="#associatedtype.Error-1" class="type">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></code></h4><h4 id="method.decode" class="method hidden"><code>fn <a href="#method.decode" class="fnname">decode</a>(&mut self, src: &mut <a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a>>></code><a class="srclink" href="../../src/tokio_util/codec/length_delimited.rs.html#553-577" title="goto source code">[src]</a></h4></div><h3 id="impl-Decoder-1" class="impl"><code class="in-band">impl Decoder for <a class="struct" href="../../tokio_util/codec/struct.AnyDelimiterCodec.html" title="struct tokio_util::codec::AnyDelimiterCodec">AnyDelimiterCodec</a></code><a href="#impl-Decoder-1" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/any_delimiter_codec.rs.html#134-210" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Item-2" class="type"><code>type <a href="#associatedtype.Item-2" class="type">Item</a> = <a class="struct" href="../../bytes/bytes/struct.Bytes.html" title="struct bytes::bytes::Bytes">Bytes</a></code></h4><h4 id="associatedtype.Error-2" class="type"><code>type <a href="#associatedtype.Error-2" class="type">Error</a> = <a class="enum" href="../../tokio_util/codec/enum.AnyDelimiterCodecError.html" title="enum tokio_util::codec::AnyDelimiterCodecError">AnyDelimiterCodecError</a></code></h4><h4 id="method.decode-1" class="method hidden"><code>fn <a href="#method.decode-1" class="fnname">decode</a>(<br> &mut self, <br> buf: &mut <a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../bytes/bytes/struct.Bytes.html" title="struct bytes::bytes::Bytes">Bytes</a>>, <a class="enum" href="../../tokio_util/codec/enum.AnyDelimiterCodecError.html" title="enum tokio_util::codec::AnyDelimiterCodecError">AnyDelimiterCodecError</a>></code><a class="srclink" href="../../src/tokio_util/codec/any_delimiter_codec.rs.html#138-193" title="goto source code">[src]</a></h4><h4 id="method.decode_eof-1" class="method hidden"><code>fn <a href="#method.decode_eof-1" class="fnname">decode_eof</a>(<br> &mut self, <br> buf: &mut <a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../bytes/bytes/struct.Bytes.html" title="struct bytes::bytes::Bytes">Bytes</a>>, <a class="enum" href="../../tokio_util/codec/enum.AnyDelimiterCodecError.html" title="enum tokio_util::codec::AnyDelimiterCodecError">AnyDelimiterCodecError</a>></code><a class="srclink" href="../../src/tokio_util/codec/any_delimiter_codec.rs.html#195-209" title="goto source code">[src]</a></h4></div><h3 id="impl-Decoder-2" class="impl"><code class="in-band">impl Decoder for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-Decoder-2" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#54-66" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Item-3" class="type"><code>type <a href="#associatedtype.Item-3" class="type">Item</a> = <a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a></code></h4><h4 id="associatedtype.Error-3" class="type"><code>type <a href="#associatedtype.Error-3" class="type">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></code></h4><h4 id="method.decode-2" class="method hidden"><code>fn <a href="#method.decode-2" class="fnname">decode</a>(&mut self, buf: &mut <a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</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>></code><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#58-65" title="goto source code">[src]</a></h4></div><h3 id="impl-Decoder-3" class="impl"><code class="in-band">impl Decoder for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-Decoder-3" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#106-183" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Item-4" class="type"><code>type <a href="#associatedtype.Item-4" class="type">Item</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code></h4><h4 id="associatedtype.Error-4" class="type"><code>type <a href="#associatedtype.Error-4" class="type">Error</a> = <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a></code></h4><h4 id="method.decode-3" class="method hidden"><code>fn <a href="#method.decode-3" class="fnname">decode</a>(<br> &mut self, <br> buf: &mut <a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a>></code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#110-164" title="goto source code">[src]</a></h4><h4 id="method.decode_eof-2" class="method hidden"><code>fn <a href="#method.decode_eof-2" class="fnname">decode_eof</a>(<br> &mut self, <br> buf: &mut <a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a>></code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#166-182" title="goto source code">[src]</a></h4></div></div><span class="loading-content">Loading content...</span><script type="text/javascript" src="../../implementors/tokio_util/codec/trait.Decoder.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "tokio_util";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html> |