mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-27 18:02:58 +01:00
21 lines
13 KiB
HTML
21 lines
13 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="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<Item> {
|
|
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><<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>;
|
|
|
|
// Required method
|
|
fn <a href="#tymethod.encode" class="fn">encode</a>(
|
|
&mut self,
|
|
item: Item,
|
|
dst: &mut BytesMut,
|
|
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.Encoder.html#associatedtype.Error" title="type actix_codec::Encoder::Error">Error</a>>;
|
|
}</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><<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></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<io::Error></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>(&mut self, item: Item, dst: &mut BytesMut) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.Encoder.html#associatedtype.Error" title="type actix_codec::Encoder::Error">Error</a>></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><Bytes> 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><Bytes> 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><Bytes> 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><BytesMut> 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<T> <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a><T> 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><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>>,</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<T> <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a><T> 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><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>>,</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<T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>>> <a class="trait" href="trait.Encoder.html" title="trait actix_codec::Encoder">Encoder</a><T> 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> |