Initial docs commit
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<!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"><meta name="keywords" content="rust, rustlang, rust-lang"><title>List of all items in this crate</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 mod"><!--[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">Crate tokio_util</p><div class="block version"><p>Version 0.6.4</p></div><a id="all-types" href="index.html"><p>Back to index</p></a></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="in-band">List of all items</span><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>
|
||||
</span>
|
||||
<span class="in-band">List of all items</span></h1><h3 id="Structs">Structs</h3><ul class="structs docblock"><li><a href="codec/struct.AnyDelimiterCodec.html">codec::AnyDelimiterCodec</a></li><li><a href="codec/struct.BytesCodec.html">codec::BytesCodec</a></li><li><a href="codec/struct.Framed.html">codec::Framed</a></li><li><a href="codec/struct.FramedParts.html">codec::FramedParts</a></li><li><a href="codec/struct.FramedRead.html">codec::FramedRead</a></li><li><a href="codec/struct.FramedWrite.html">codec::FramedWrite</a></li><li><a href="codec/struct.LinesCodec.html">codec::LinesCodec</a></li><li><a href="codec/length_delimited/struct.Builder.html">codec::length_delimited::Builder</a></li><li><a href="codec/length_delimited/struct.LengthDelimitedCodec.html">codec::length_delimited::LengthDelimitedCodec</a></li><li><a href="codec/length_delimited/struct.LengthDelimitedCodecError.html">codec::length_delimited::LengthDelimitedCodecError</a></li><li><a href="sync/struct.CancellationToken.html">sync::CancellationToken</a></li><li><a href="sync/struct.PollSemaphore.html">sync::PollSemaphore</a></li><li><a href="sync/struct.PollSender.html">sync::PollSender</a></li><li><a href="sync/struct.ReusableBoxFuture.html">sync::ReusableBoxFuture</a></li><li><a href="sync/struct.WaitForCancellationFuture.html">sync::WaitForCancellationFuture</a></li></ul><h3 id="Enums">Enums</h3><ul class="enums docblock"><li><a href="codec/enum.AnyDelimiterCodecError.html">codec::AnyDelimiterCodecError</a></li><li><a href="codec/enum.LinesCodecError.html">codec::LinesCodecError</a></li><li><a href="either/enum.Either.html">either::Either</a></li></ul><h3 id="Traits">Traits</h3><ul class="traits docblock"><li><a href="codec/trait.Decoder.html">codec::Decoder</a></li><li><a href="codec/trait.Encoder.html">codec::Encoder</a></li></ul></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="tokio_util"></div>
|
||||
<script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/codec/enum.AnyDelimiterCodecError.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/codec/enum.AnyDelimiterCodecError.html">../../../tokio_util/codec/enum.AnyDelimiterCodecError.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/codec/enum.AnyDelimiterCodecError.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/codec/struct.AnyDelimiterCodec.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/codec/struct.AnyDelimiterCodec.html">../../../tokio_util/codec/struct.AnyDelimiterCodec.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/codec/struct.AnyDelimiterCodec.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/codec/struct.BytesCodec.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/codec/struct.BytesCodec.html">../../../tokio_util/codec/struct.BytesCodec.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/codec/struct.BytesCodec.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/codec/trait.Decoder.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/codec/trait.Decoder.html">../../../tokio_util/codec/trait.Decoder.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/codec/trait.Decoder.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/codec/trait.Encoder.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/codec/trait.Encoder.html">../../../tokio_util/codec/trait.Encoder.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/codec/trait.Encoder.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,30 @@
|
||||
<!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="An error occured while encoding or decoding a chunk."><meta name="keywords" content="rust, rustlang, rust-lang, AnyDelimiterCodecError"><title>tokio_util::codec::AnyDelimiterCodecError - 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 enum"><!--[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">Enum AnyDelimiterCodecError</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#variants">Variants</a><div class="sidebar-links"><a href="#variant.Io">Io</a><a href="#variant.MaxChunkLengthExceeded">MaxChunkLengthExceeded</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Display">Display</a><a href="#impl-Error">Error</a><a href="#impl-From%3CError%3E">From<Error></a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-ToString">ToString</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class="location"><a href="../index.html">tokio_util</a>::<wbr><a href="index.html">codec</a></p><div id="sidebar-vars" data-name="AnyDelimiterCodecError" data-ty="enum" data-relpath=""></div><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="in-band">Enum <a href="../index.html">tokio_util</a>::<wbr><a href="index.html">codec</a>::<wbr><a class="enum" href="">AnyDelimiterCodecError</a></span><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/any_delimiter_codec.rs.html#239-244" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust enum">pub enum AnyDelimiterCodecError {
|
||||
MaxChunkLengthExceeded,
|
||||
Io(<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>),
|
||||
}</pre></div><div class="docblock"><p>An error occured while encoding or decoding a chunk.</p>
|
||||
</div><h2 id="variants" class="variants small-section-header">
|
||||
Variants<a href="#variants" class="anchor"></a></h2>
|
||||
<div id="variant.MaxChunkLengthExceeded" class="variant small-section-header"><a href="#variant.MaxChunkLengthExceeded" class="anchor field"></a><code>MaxChunkLengthExceeded</code></div><div class="docblock"><p>The maximum chunk length was exceeded.</p>
|
||||
</div><div id="variant.Io" class="variant small-section-header"><a href="#variant.Io" class="anchor field"></a><code>Io(<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></div><div class="docblock"><p>An IO error occurred.</p>
|
||||
</div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="enum" href="../../tokio_util/codec/enum.AnyDelimiterCodecError.html" title="enum tokio_util::codec::AnyDelimiterCodecError">AnyDelimiterCodecError</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/any_delimiter_codec.rs.html#238" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../src/tokio_util/codec/any_delimiter_codec.rs.html#238" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Display" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="enum" href="../../tokio_util/codec/enum.AnyDelimiterCodecError.html" title="enum tokio_util::codec::AnyDelimiterCodecError">AnyDelimiterCodecError</a></code><a href="#impl-Display" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/any_delimiter_codec.rs.html#246-255" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt-1" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../src/tokio_util/codec/any_delimiter_codec.rs.html#247-254" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Error" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a> for <a class="enum" href="../../tokio_util/codec/enum.AnyDelimiterCodecError.html" title="enum tokio_util::codec::AnyDelimiterCodecError">AnyDelimiterCodecError</a></code><a href="#impl-Error" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/any_delimiter_codec.rs.html#263" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.source" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.source" class="fnname">source</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&(dyn <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static)></code><span class="since" title="Stable since Rust version 1.30.0">1.30.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#98" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>The lower-level source of this error, if any. <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.source">Read more</a></p>
|
||||
</div><h4 id="method.backtrace" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace" class="fnname">backtrace</a>(&self) -> <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/std/backtrace/struct.Backtrace.html" title="struct std::backtrace::Backtrace">Backtrace</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#126" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>backtrace</code>)</div></div><div class='docblock hidden'><p>Returns a stack backtrace, if available, of where this error occurred. <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace">Read more</a></p>
|
||||
</div><h4 id="method.description" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description" class="fnname">description</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#138" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.42.0: <p>use the Display impl or to_string()</p>
|
||||
</div></div><div class='docblock hidden'> <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description">Read more</a></div><h4 id="method.cause" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.cause" class="fnname">cause</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a>></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#148" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.33.0: <p>replaced by Error::source, which can support downcasting</p>
|
||||
</div></div></div><h3 id="impl-From%3CError%3E" class="impl"><code class="in-band">impl <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>> for <a class="enum" href="../../tokio_util/codec/enum.AnyDelimiterCodecError.html" title="enum tokio_util::codec::AnyDelimiterCodecError">AnyDelimiterCodecError</a></code><a href="#impl-From%3CError%3E" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/any_delimiter_codec.rs.html#257-261" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(e: <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</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#258-260" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="enum" href="../../tokio_util/codec/enum.AnyDelimiterCodecError.html" title="enum tokio_util::codec::AnyDelimiterCodecError">AnyDelimiterCodecError</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Send" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="enum" href="../../tokio_util/codec/enum.AnyDelimiterCodecError.html" title="enum tokio_util::codec::AnyDelimiterCodecError">AnyDelimiterCodecError</a></code><a href="#impl-Send" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="enum" href="../../tokio_util/codec/enum.AnyDelimiterCodecError.html" title="enum tokio_util::codec::AnyDelimiterCodecError">AnyDelimiterCodecError</a></code><a href="#impl-Sync" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="enum" href="../../tokio_util/codec/enum.AnyDelimiterCodecError.html" title="enum tokio_util::codec::AnyDelimiterCodecError">AnyDelimiterCodecError</a></code><a href="#impl-Unpin" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="enum" href="../../tokio_util/codec/enum.AnyDelimiterCodecError.html" title="enum tokio_util::codec::AnyDelimiterCodecError">AnyDelimiterCodecError</a></code><a href="#impl-UnwindSafe" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<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 href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-ToString" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<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 href="#impl-ToString" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2205-2218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.to_string" class="method hidden"><code>pub default fn <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string" class="fnname">to_string</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2211" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></p>
|
||||
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1,30 @@
|
||||
<!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="An error occured while encoding or decoding a line."><meta name="keywords" content="rust, rustlang, rust-lang, LinesCodecError"><title>tokio_util::codec::LinesCodecError - 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 enum"><!--[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">Enum LinesCodecError</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#variants">Variants</a><div class="sidebar-links"><a href="#variant.Io">Io</a><a href="#variant.MaxLineLengthExceeded">MaxLineLengthExceeded</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Display">Display</a><a href="#impl-Error">Error</a><a href="#impl-From%3CError%3E">From<Error></a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-ToString">ToString</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class="location"><a href="../index.html">tokio_util</a>::<wbr><a href="index.html">codec</a></p><div id="sidebar-vars" data-name="LinesCodecError" data-ty="enum" data-relpath=""></div><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="in-band">Enum <a href="../index.html">tokio_util</a>::<wbr><a href="index.html">codec</a>::<wbr><a class="enum" href="">LinesCodecError</a></span><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/lines_codec.rs.html#208-213" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust enum">pub enum LinesCodecError {
|
||||
MaxLineLengthExceeded,
|
||||
Io(<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>),
|
||||
}</pre></div><div class="docblock"><p>An error occured while encoding or decoding a line.</p>
|
||||
</div><h2 id="variants" class="variants small-section-header">
|
||||
Variants<a href="#variants" class="anchor"></a></h2>
|
||||
<div id="variant.MaxLineLengthExceeded" class="variant small-section-header"><a href="#variant.MaxLineLengthExceeded" class="anchor field"></a><code>MaxLineLengthExceeded</code></div><div class="docblock"><p>The maximum line length was exceeded.</p>
|
||||
</div><div id="variant.Io" class="variant small-section-header"><a href="#variant.Io" class="anchor field"></a><code>Io(<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></div><div class="docblock"><p>An IO error occured.</p>
|
||||
</div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#207" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#207" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Display" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a></code><a href="#impl-Display" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#215-222" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt-1" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#216-221" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Error" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a> for <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a></code><a href="#impl-Error" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#230" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.source" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.source" class="fnname">source</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&(dyn <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static)></code><span class="since" title="Stable since Rust version 1.30.0">1.30.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#98" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>The lower-level source of this error, if any. <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.source">Read more</a></p>
|
||||
</div><h4 id="method.backtrace" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace" class="fnname">backtrace</a>(&self) -> <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/std/backtrace/struct.Backtrace.html" title="struct std::backtrace::Backtrace">Backtrace</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#126" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>backtrace</code>)</div></div><div class='docblock hidden'><p>Returns a stack backtrace, if available, of where this error occurred. <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace">Read more</a></p>
|
||||
</div><h4 id="method.description" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description" class="fnname">description</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#138" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.42.0: <p>use the Display impl or to_string()</p>
|
||||
</div></div><div class='docblock hidden'> <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description">Read more</a></div><h4 id="method.cause" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.cause" class="fnname">cause</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a>></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#148" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.33.0: <p>replaced by Error::source, which can support downcasting</p>
|
||||
</div></div></div><h3 id="impl-From%3CError%3E" class="impl"><code class="in-band">impl <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>> for <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a></code><a href="#impl-From%3CError%3E" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#224-228" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(e: <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</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#225-227" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Send" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a></code><a href="#impl-Send" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a></code><a href="#impl-Sync" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a></code><a href="#impl-Unpin" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a></code><a href="#impl-UnwindSafe" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<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 href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-ToString" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<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 href="#impl-ToString" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2205-2218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.to_string" class="method hidden"><code>pub default fn <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string" class="fnname">to_string</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2211" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></p>
|
||||
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/codec/struct.Framed.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/codec/struct.Framed.html">../../../tokio_util/codec/struct.Framed.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/codec/struct.Framed.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/codec/struct.FramedParts.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/codec/struct.FramedParts.html">../../../tokio_util/codec/struct.FramedParts.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/codec/struct.FramedParts.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/codec/struct.FramedRead.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/codec/struct.FramedRead.html">../../../tokio_util/codec/struct.FramedRead.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/codec/struct.FramedRead.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/codec/struct.FramedWrite.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/codec/struct.FramedWrite.html">../../../tokio_util/codec/struct.FramedWrite.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/codec/struct.FramedWrite.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,237 @@
|
||||
<!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="Adaptors from AsyncRead/AsyncWrite to Stream/Sink"><meta name="keywords" content="rust, rustlang, rust-lang, codec"><title>tokio_util::codec - 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 mod"><!--[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">Module codec</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#reexports">Re-exports</a></li><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li></ul></div><p class="location"><a href="../index.html">tokio_util</a></p><div id="sidebar-vars" data-name="codec" data-ty="mod" data-relpath="../"></div><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="in-band">Module <a href="../index.html">tokio_util</a>::<wbr><a class="mod" href="">codec</a></span><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/mod.rs.html#1-290" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Adaptors from AsyncRead/AsyncWrite to Stream/Sink</p>
|
||||
<p>Raw I/O objects work with byte sequences, but higher-level code usually
|
||||
wants to batch these into meaningful chunks, called “frames”.</p>
|
||||
<p>This module contains adapters to go from streams of bytes, <a href="../../tokio/io/async_read/trait.AsyncRead.html"><code>AsyncRead</code></a> and
|
||||
<a href="../../tokio/io/async_write/trait.AsyncWrite.html"><code>AsyncWrite</code></a>, to framed streams implementing <a href="../../futures_sink/trait.Sink.html"><code>Sink</code></a> and <a href="../../futures_core/stream/trait.Stream.html"><code>Stream</code></a>.
|
||||
Framed streams are also known as transports.</p>
|
||||
<h1 id="the-decoder-trait" class="section-header"><a href="#the-decoder-trait">The Decoder trait</a></h1>
|
||||
<p>A <a href="../../tokio_util/codec/trait.Decoder.html"><code>Decoder</code></a> is used together with <a href="../../tokio_util/codec/struct.FramedRead.html"><code>FramedRead</code></a> or <a href="../../tokio_util/codec/struct.Framed.html"><code>Framed</code></a> to turn an
|
||||
<a href="../../tokio/io/async_read/trait.AsyncRead.html"><code>AsyncRead</code></a> into a <a href="../../futures_core/stream/trait.Stream.html"><code>Stream</code></a>. The job of the decoder trait is to specify
|
||||
how sequences of bytes are turned into a sequence of frames, and to
|
||||
determine where the boundaries between frames are. The job of the
|
||||
<code>FramedRead</code> is to repeatedly switch between reading more data from the IO
|
||||
resource, and asking the decoder whether we have received enough data to
|
||||
decode another frame of data.</p>
|
||||
<p>The main method on the <code>Decoder</code> trait is the <a href="../../tokio_util/codec/trait.Decoder.html#tymethod.decode"><code>decode</code></a> method. This method
|
||||
takes as argument the data that has been read so far, and when it is called,
|
||||
it will be in one of the following situations:</p>
|
||||
<ol>
|
||||
<li>The buffer contains less than a full frame.</li>
|
||||
<li>The buffer contains exactly a full frame.</li>
|
||||
<li>The buffer contains more than a full frame.</li>
|
||||
</ol>
|
||||
<p>In the first situation, the decoder should return <code>Ok(None)</code>.</p>
|
||||
<p>In the second situation, the decoder should clear the provided buffer and
|
||||
return <code>Ok(Some(the_decoded_frame))</code>.</p>
|
||||
<p>In the third situation, the decoder should use a method such as <a href="../../bytes/bytes_mut/struct.BytesMut.html#method.split_to"><code>split_to</code></a>
|
||||
or <a href="../../bytes/buf/buf_impl/trait.Buf.html#tymethod.advance"><code>advance</code></a> to modify the buffer such that the frame is removed from the
|
||||
buffer, but any data in the buffer after that frame should still remain in
|
||||
the buffer. The decoder should also return <code>Ok(Some(the_decoded_frame))</code> in
|
||||
this case.</p>
|
||||
<p>Finally the decoder may return an error if the data is invalid in some way.
|
||||
The decoder should <em>not</em> return an error just because it has yet to receive
|
||||
a full frame.</p>
|
||||
<p>It is guaranteed that, from one call to <code>decode</code> to another, the provided
|
||||
buffer will contain the exact same data as before, except that if more data
|
||||
has arrived through the IO resource, that data will have been appended to
|
||||
the buffer. This means that reading frames from a <code>FramedRead</code> is
|
||||
essentially equivalent to the following loop:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio</span>::<span class="ident">io</span>::<span class="ident">AsyncReadExt</span>;
|
||||
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>::<span class="ident">new</span>();
|
||||
<span class="kw">loop</span> {
|
||||
<span class="comment">// The read_buf call will append to buf rather than overwrite existing data.</span>
|
||||
<span class="kw">let</span> <span class="ident">len</span> <span class="op">=</span> <span class="ident">io_resource</span>.<span class="ident">read_buf</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
|
||||
<span class="kw">if</span> <span class="ident">len</span> <span class="op">=</span><span class="op">=</span> <span class="number">0</span> {
|
||||
<span class="kw">while</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">frame</span>) <span class="op">=</span> <span class="ident">decoder</span>.<span class="ident">decode_eof</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>)<span class="question-mark">?</span> {
|
||||
<span class="kw">yield</span> <span class="ident">frame</span>;
|
||||
}
|
||||
<span class="kw">break</span>;
|
||||
}
|
||||
|
||||
<span class="kw">while</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">frame</span>) <span class="op">=</span> <span class="ident">decoder</span>.<span class="ident">decode</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>)<span class="question-mark">?</span> {
|
||||
<span class="kw">yield</span> <span class="ident">frame</span>;
|
||||
}
|
||||
}</pre></div>
|
||||
<p>The example above uses <code>yield</code> whenever the <code>Stream</code> produces an item.</p>
|
||||
<h2 id="example-decoder" class="section-header"><a href="#example-decoder">Example decoder</a></h2>
|
||||
<p>As an example, consider a protocol that can be used to send strings where
|
||||
each frame is a four byte integer that contains the length of the frame,
|
||||
followed by that many bytes of string data. The decoder fails with an error
|
||||
if the string data is not valid utf-8 or too long.</p>
|
||||
<p>Such a decoder can be written like this:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">Decoder</span>;
|
||||
<span class="kw">use</span> <span class="ident">bytes</span>::{<span class="ident">BytesMut</span>, <span class="ident">Buf</span>};
|
||||
|
||||
<span class="kw">struct</span> <span class="ident">MyStringDecoder</span> {}
|
||||
|
||||
<span class="kw">const</span> <span class="ident">MAX</span>: <span class="ident">usize</span> <span class="op">=</span> <span class="number">8</span> <span class="op">*</span> <span class="number">1024</span> <span class="op">*</span> <span class="number">1024</span>;
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Decoder</span> <span class="kw">for</span> <span class="ident">MyStringDecoder</span> {
|
||||
<span class="kw">type</span> <span class="ident">Item</span> <span class="op">=</span> <span class="ident">String</span>;
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">Error</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="kw">if</span> <span class="ident">src</span>.<span class="ident">len</span>() <span class="op"><</span> <span class="number">4</span> {
|
||||
<span class="comment">// Not enough data to read length marker.</span>
|
||||
<span class="kw">return</span> <span class="prelude-val">Ok</span>(<span class="prelude-val">None</span>);
|
||||
}
|
||||
|
||||
<span class="comment">// Read length marker.</span>
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">length_bytes</span> <span class="op">=</span> [<span class="number">0u8</span>; <span class="number">4</span>];
|
||||
<span class="ident">length_bytes</span>.<span class="ident">copy_from_slice</span>(<span class="kw-2">&</span><span class="ident">src</span>[..<span class="number">4</span>]);
|
||||
<span class="kw">let</span> <span class="ident">length</span> <span class="op">=</span> <span class="ident">u32</span>::<span class="ident">from_le_bytes</span>(<span class="ident">length_bytes</span>) <span class="kw">as</span> <span class="ident">usize</span>;
|
||||
|
||||
<span class="comment">// Check that the length is not too large to avoid a denial of</span>
|
||||
<span class="comment">// service attack where the server runs out of memory.</span>
|
||||
<span class="kw">if</span> <span class="ident">length</span> <span class="op">></span> <span class="ident">MAX</span> {
|
||||
<span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">Error</span>::<span class="ident">new</span>(
|
||||
<span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">ErrorKind</span>::<span class="ident">InvalidData</span>,
|
||||
<span class="macro">format</span><span class="macro">!</span>(<span class="string">"Frame of length {} is too large."</span>, <span class="ident">length</span>)
|
||||
));
|
||||
}
|
||||
|
||||
<span class="kw">if</span> <span class="ident">src</span>.<span class="ident">len</span>() <span class="op"><</span> <span class="number">4</span> <span class="op">+</span> <span class="ident">length</span> {
|
||||
<span class="comment">// The full string has not yet arrived.</span>
|
||||
<span class="comment">//</span>
|
||||
<span class="comment">// We reserve more space in the buffer. This is not strictly</span>
|
||||
<span class="comment">// necessary, but is a good idea performance-wise.</span>
|
||||
<span class="ident">src</span>.<span class="ident">reserve</span>(<span class="number">4</span> <span class="op">+</span> <span class="ident">length</span> <span class="op">-</span> <span class="ident">src</span>.<span class="ident">len</span>());
|
||||
|
||||
<span class="comment">// We inform the Framed that we need more bytes to form the next</span>
|
||||
<span class="comment">// frame.</span>
|
||||
<span class="kw">return</span> <span class="prelude-val">Ok</span>(<span class="prelude-val">None</span>);
|
||||
}
|
||||
|
||||
<span class="comment">// Use advance to modify src such that it no longer contains</span>
|
||||
<span class="comment">// this frame.</span>
|
||||
<span class="kw">let</span> <span class="ident">data</span> <span class="op">=</span> <span class="ident">src</span>[<span class="number">4</span>..<span class="number">4</span> <span class="op">+</span> <span class="ident">length</span>].<span class="ident">to_vec</span>();
|
||||
<span class="ident">src</span>.<span class="ident">advance</span>(<span class="number">4</span> <span class="op">+</span> <span class="ident">length</span>);
|
||||
|
||||
<span class="comment">// Convert the data to a string, or fail if it is not valid utf-8.</span>
|
||||
<span class="kw">match</span> <span class="ident">String</span>::<span class="ident">from_utf8</span>(<span class="ident">data</span>) {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">string</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Ok</span>(<span class="prelude-val">Some</span>(<span class="ident">string</span>)),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">utf8_error</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Err</span>(<span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">Error</span>::<span class="ident">new</span>(
|
||||
<span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">ErrorKind</span>::<span class="ident">InvalidData</span>,
|
||||
<span class="ident">utf8_error</span>.<span class="ident">utf8_error</span>(),
|
||||
))
|
||||
},
|
||||
}
|
||||
}
|
||||
}</pre></div>
|
||||
<h1 id="the-encoder-trait" class="section-header"><a href="#the-encoder-trait">The Encoder trait</a></h1>
|
||||
<p>An <a href="../../tokio_util/codec/trait.Encoder.html" title="Encoder"><code>Encoder</code></a> is used together with <a href="../../tokio_util/codec/struct.FramedWrite.html"><code>FramedWrite</code></a> or <a href="../../tokio_util/codec/struct.Framed.html"><code>Framed</code></a> to turn
|
||||
an <a href="../../tokio/io/async_write/trait.AsyncWrite.html"><code>AsyncWrite</code></a> into a <a href="../../futures_sink/trait.Sink.html"><code>Sink</code></a>. The job of the encoder trait is to
|
||||
specify how frames are turned into a sequences of bytes. The job of the
|
||||
<code>FramedWrite</code> is to take the resulting sequence of bytes and write it to the
|
||||
IO resource.</p>
|
||||
<p>The main method on the <code>Encoder</code> trait is the <a href="../../tokio_util/codec/trait.Encoder.html#tymethod.encode"><code>encode</code></a> method. This method
|
||||
takes an item that is being written, and a buffer to write the item to. The
|
||||
buffer may already contain data, and in this case, the encoder should append
|
||||
the new frame the to buffer rather than overwrite the existing data.</p>
|
||||
<p>It is guaranteed that, from one call to <code>encode</code> to another, the provided
|
||||
buffer will contain the exact same data as before, except that some of the
|
||||
data may have been removed from the front of the buffer. Writing to a
|
||||
<code>FramedWrite</code> is essentially equivalent to the following loop:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio</span>::<span class="ident">io</span>::<span class="ident">AsyncWriteExt</span>;
|
||||
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">Buf</span>; <span class="comment">// for advance</span>
|
||||
|
||||
<span class="kw">const</span> <span class="ident">MAX</span>: <span class="ident">usize</span> <span class="op">=</span> <span class="number">8192</span>;
|
||||
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>::<span class="ident">new</span>();
|
||||
<span class="kw">loop</span> {
|
||||
<span class="ident">tokio</span>::<span class="macro">select</span><span class="macro">!</span> {
|
||||
<span class="ident">num_written</span> <span class="op">=</span> <span class="ident">io_resource</span>.<span class="ident">write</span>(<span class="kw-2">&</span><span class="ident">buf</span>), <span class="kw">if</span> <span class="op">!</span><span class="ident">buf</span>.<span class="ident">is_empty</span>() <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">buf</span>.<span class="ident">advance</span>(<span class="ident">num_written</span><span class="question-mark">?</span>);
|
||||
},
|
||||
<span class="ident">frame</span> <span class="op">=</span> <span class="ident">next_frame</span>(), <span class="kw">if</span> <span class="ident">buf</span>.<span class="ident">len</span>() <span class="op"><</span> <span class="ident">MAX</span> <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">encoder</span>.<span class="ident">encode</span>(<span class="ident">frame</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>)<span class="question-mark">?</span>;
|
||||
},
|
||||
<span class="kw">_</span> <span class="op">=</span> <span class="ident">no_more_frames</span>() <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">io_resource</span>.<span class="ident">write_all</span>(<span class="kw-2">&</span><span class="ident">buf</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
<span class="ident">io_resource</span>.<span class="ident">shutdown</span>().<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
<span class="kw">return</span> <span class="prelude-val">Ok</span>(());
|
||||
},
|
||||
}
|
||||
}</pre></div>
|
||||
<p>Here the <code>next_frame</code> method corresponds to any frames you write to the
|
||||
<code>FramedWrite</code>. The <code>no_more_frames</code> method corresponds to closing the
|
||||
<code>FramedWrite</code> with <a href="https://docs.rs/futures/0.3/futures/sink/trait.SinkExt.html#method.close"><code>SinkExt::close</code></a>.</p>
|
||||
<h2 id="example-encoder" class="section-header"><a href="#example-encoder">Example encoder</a></h2>
|
||||
<p>As an example, consider a protocol that can be used to send strings where
|
||||
each frame is a four byte integer that contains the length of the frame,
|
||||
followed by that many bytes of string data. The encoder will fail if the
|
||||
string is too long.</p>
|
||||
<p>Such an encoder can be written like this:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">Encoder</span>;
|
||||
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">BytesMut</span>;
|
||||
|
||||
<span class="kw">struct</span> <span class="ident">MyStringEncoder</span> {}
|
||||
|
||||
<span class="kw">const</span> <span class="ident">MAX</span>: <span class="ident">usize</span> <span class="op">=</span> <span class="number">8</span> <span class="op">*</span> <span class="number">1024</span> <span class="op">*</span> <span class="number">1024</span>;
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Encoder</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> <span class="kw">for</span> <span class="ident">MyStringEncoder</span> {
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">Error</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">encode</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">item</span>: <span class="ident">String</span>, <span class="ident">dst</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="self">Self</span>::<span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="comment">// Don't send a string if it is longer than the other end will</span>
|
||||
<span class="comment">// accept.</span>
|
||||
<span class="kw">if</span> <span class="ident">item</span>.<span class="ident">len</span>() <span class="op">></span> <span class="ident">MAX</span> {
|
||||
<span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">Error</span>::<span class="ident">new</span>(
|
||||
<span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">ErrorKind</span>::<span class="ident">InvalidData</span>,
|
||||
<span class="macro">format</span><span class="macro">!</span>(<span class="string">"Frame of length {} is too large."</span>, <span class="ident">item</span>.<span class="ident">len</span>())
|
||||
));
|
||||
}
|
||||
|
||||
<span class="comment">// Convert the length into a byte array.</span>
|
||||
<span class="comment">// The cast to u32 cannot overflow due to the length check above.</span>
|
||||
<span class="kw">let</span> <span class="ident">len_slice</span> <span class="op">=</span> <span class="ident">u32</span>::<span class="ident">to_le_bytes</span>(<span class="ident">item</span>.<span class="ident">len</span>() <span class="kw">as</span> <span class="ident">u32</span>);
|
||||
|
||||
<span class="comment">// Reserve space in the buffer.</span>
|
||||
<span class="ident">dst</span>.<span class="ident">reserve</span>(<span class="number">4</span> <span class="op">+</span> <span class="ident">item</span>.<span class="ident">len</span>());
|
||||
|
||||
<span class="comment">// Write the length and string to the buffer.</span>
|
||||
<span class="ident">dst</span>.<span class="ident">extend_from_slice</span>(<span class="kw-2">&</span><span class="ident">len_slice</span>);
|
||||
<span class="ident">dst</span>.<span class="ident">extend_from_slice</span>(<span class="ident">item</span>.<span class="ident">as_bytes</span>());
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
}</pre></div>
|
||||
</div><h2 id="reexports" class="section-header"><a href="#reexports">Re-exports</a></h2>
|
||||
<table><tr><td><code>pub use self::length_delimited::<a class="struct" href="../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodec.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodec">LengthDelimitedCodec</a>;</code></td></tr><tr><td><code>pub use self::length_delimited::<a class="struct" href="../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodecError.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodecError">LengthDelimitedCodecError</a>;</code></td></tr></table><h2 id="modules" class="section-header"><a href="#modules">Modules</a></h2>
|
||||
<table><tr class="module-item"><td><a class="mod" href="length_delimited/index.html" title="tokio_util::codec::length_delimited mod">length_delimited</a></td><td class="docblock-short"><p>Frame a stream of bytes based on a length prefix</p>
|
||||
</td></tr></table><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<table><tr class="module-item"><td><a class="struct" href="struct.AnyDelimiterCodec.html" title="tokio_util::codec::AnyDelimiterCodec struct">AnyDelimiterCodec</a></td><td class="docblock-short"><p>A simple <a href="../../tokio_util/codec/trait.Decoder.html"><code>Decoder</code></a> and <a href="../../tokio_util/codec/trait.Encoder.html"><code>Encoder</code></a> implementation that splits up data into chunks based on any character in the given delimiter string.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.BytesCodec.html" title="tokio_util::codec::BytesCodec struct">BytesCodec</a></td><td class="docblock-short"><p>A simple <a href="../../tokio_util/codec/trait.Decoder.html"><code>Decoder</code></a> and <a href="../../tokio_util/codec/trait.Encoder.html"><code>Encoder</code></a> implementation that just ships bytes around.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Framed.html" title="tokio_util::codec::Framed struct">Framed</a></td><td class="docblock-short"><p>A unified <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 to an underlying I/O object, using
|
||||
the <code>Encoder</code> and <code>Decoder</code> traits to encode and decode frames.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.FramedParts.html" title="tokio_util::codec::FramedParts struct">FramedParts</a></td><td class="docblock-short"><p><code>FramedParts</code> contains an export of the data of a Framed transport.
|
||||
It can be used to construct a new <a href="../../tokio_util/codec/struct.Framed.html"><code>Framed</code></a> with a different codec.
|
||||
It contains all current buffers and the inner transport.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.FramedRead.html" title="tokio_util::codec::FramedRead struct">FramedRead</a></td><td class="docblock-short"><p>A <a href="../../futures_core/stream/trait.Stream.html"><code>Stream</code></a> of messages decoded from an <a href="../../tokio/io/async_read/trait.AsyncRead.html"><code>AsyncRead</code></a>.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.FramedWrite.html" title="tokio_util::codec::FramedWrite struct">FramedWrite</a></td><td class="docblock-short"><p>A <a href="../../futures_sink/trait.Sink.html"><code>Sink</code></a> of frames encoded to an <code>AsyncWrite</code>.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.LinesCodec.html" title="tokio_util::codec::LinesCodec struct">LinesCodec</a></td><td class="docblock-short"><p>A simple <a href="../../tokio_util/codec/trait.Decoder.html"><code>Decoder</code></a> and <a href="../../tokio_util/codec/trait.Encoder.html"><code>Encoder</code></a> implementation that splits up data into lines.</p>
|
||||
</td></tr></table><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<table><tr class="module-item"><td><a class="enum" href="enum.AnyDelimiterCodecError.html" title="tokio_util::codec::AnyDelimiterCodecError enum">AnyDelimiterCodecError</a></td><td class="docblock-short"><p>An error occured while encoding or decoding a chunk.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="enum" href="enum.LinesCodecError.html" title="tokio_util::codec::LinesCodecError enum">LinesCodecError</a></td><td class="docblock-short"><p>An error occured while encoding or decoding a line.</p>
|
||||
</td></tr></table><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<table><tr class="module-item"><td><a class="trait" href="trait.Decoder.html" title="tokio_util::codec::Decoder trait">Decoder</a></td><td class="docblock-short"><p>Decoding of frames via buffers.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="trait" href="trait.Encoder.html" title="tokio_util::codec::Encoder trait">Encoder</a></td><td class="docblock-short"><p>Trait of helper objects to write out messages as bytes, for use with
|
||||
<a href="../../tokio_util/codec/struct.FramedWrite.html"><code>FramedWrite</code></a>.</p>
|
||||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1,261 @@
|
||||
<!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="Frame a stream of bytes based on a length prefix"><meta name="keywords" content="rust, rustlang, rust-lang, length_delimited"><title>tokio_util::codec::length_delimited - 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 mod"><!--[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">Module length_delimited</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><p class="location"><a href="../../index.html">tokio_util</a>::<wbr><a href="../index.html">codec</a></p><div id="sidebar-vars" data-name="length_delimited" data-ty="mod" data-relpath="../"></div><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="in-band">Module <a href="../../index.html">tokio_util</a>::<wbr><a href="../index.html">codec</a>::<wbr><a class="mod" href="">length_delimited</a></span><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/length_delimited.rs.html#1-993" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Frame a stream of bytes based on a length prefix</p>
|
||||
<p>Many protocols delimit their frames by prefacing frame data with a
|
||||
frame head that specifies the length of the frame. The
|
||||
<code>length_delimited</code> module provides utilities for handling the length
|
||||
based framing. This allows the consumer to work with entire frames
|
||||
without having to worry about buffering or other framing logic.</p>
|
||||
<h1 id="getting-started" class="section-header"><a href="#getting-started">Getting started</a></h1>
|
||||
<p>If implementing a protocol from scratch, using length delimited framing
|
||||
is an easy way to get started. <a href="../../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodec.html#method.new"><code>LengthDelimitedCodec::new()</code></a> will
|
||||
return a length delimited codec using default configuration values.
|
||||
This can then be used to construct a framer to adapt a full-duplex
|
||||
byte stream into a stream of frames.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio</span>::<span class="ident">io</span>::{<span class="ident">AsyncRead</span>, <span class="ident">AsyncWrite</span>};
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::{<span class="ident">Framed</span>, <span class="ident">LengthDelimitedCodec</span>};
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">bind_transport</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">AsyncRead</span> <span class="op">+</span> <span class="ident">AsyncWrite</span><span class="op">></span>(<span class="ident">io</span>: <span class="ident">T</span>)
|
||||
<span class="op">-</span><span class="op">></span> <span class="ident">Framed</span><span class="op"><</span><span class="ident">T</span>, <span class="ident">LengthDelimitedCodec</span><span class="op">></span>
|
||||
{
|
||||
<span class="ident">Framed</span>::<span class="ident">new</span>(<span class="ident">io</span>, <span class="ident">LengthDelimitedCodec</span>::<span class="ident">new</span>())
|
||||
}</pre></div>
|
||||
<p>The returned transport implements <code>Sink + Stream</code> for <code>BytesMut</code>. It
|
||||
encodes the frame with a big-endian <code>u32</code> header denoting the frame
|
||||
payload length:</p>
|
||||
<pre><code class="language-text">+----------+--------------------------------+
|
||||
| len: u32 | frame payload |
|
||||
+----------+--------------------------------+
|
||||
</code></pre>
|
||||
<p>Specifically, given the following:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio</span>::<span class="ident">io</span>::{<span class="ident">AsyncRead</span>, <span class="ident">AsyncWrite</span>};
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::{<span class="ident">Framed</span>, <span class="ident">LengthDelimitedCodec</span>};
|
||||
|
||||
<span class="kw">use</span> <span class="ident">futures</span>::<span class="ident">SinkExt</span>;
|
||||
<span class="kw">use</span> <span class="ident">bytes</span>::<span class="ident">Bytes</span>;
|
||||
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">write_frame</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="ident">io</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">std</span>::<span class="ident">error</span>::<span class="ident">Error</span><span class="op">></span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">AsyncRead</span> <span class="op">+</span> <span class="ident">AsyncWrite</span> <span class="op">+</span> <span class="ident">Unpin</span>,
|
||||
{
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">transport</span> <span class="op">=</span> <span class="ident">Framed</span>::<span class="ident">new</span>(<span class="ident">io</span>, <span class="ident">LengthDelimitedCodec</span>::<span class="ident">new</span>());
|
||||
<span class="kw">let</span> <span class="ident">frame</span> <span class="op">=</span> <span class="ident">Bytes</span>::<span class="ident">from</span>(<span class="string">"hello world"</span>);
|
||||
|
||||
<span class="ident">transport</span>.<span class="ident">send</span>(<span class="ident">frame</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}</pre></div>
|
||||
<p>The encoded frame will look like this:</p>
|
||||
<pre><code class="language-text">+---- len: u32 ----+---- data ----+
|
||||
| \x00\x00\x00\x0b | hello world |
|
||||
+------------------+--------------+
|
||||
</code></pre>
|
||||
<h1 id="decoding" class="section-header"><a href="#decoding">Decoding</a></h1>
|
||||
<p><a href="../../../tokio_util/codec/struct.FramedRead.html"><code>FramedRead</code></a> adapts an <a href="../../../tokio/io/async_read/trait.AsyncRead.html"><code>AsyncRead</code></a> into a <code>Stream</code> of <a href="../../../bytes/bytes_mut/struct.BytesMut.html"><code>BytesMut</code></a>,
|
||||
such that each yielded <a href="../../../bytes/bytes_mut/struct.BytesMut.html"><code>BytesMut</code></a> value contains the contents of an
|
||||
entire frame. There are many configuration parameters enabling
|
||||
<a href="../../../tokio_util/codec/struct.FramedRead.html"><code>FramedRead</code></a> to handle a wide range of protocols. Here are some
|
||||
examples that will cover the various options at a high level.</p>
|
||||
<h2 id="example-1" class="section-header"><a href="#example-1">Example 1</a></h2>
|
||||
<p>The following will parse a <code>u16</code> length field at offset 0, including the
|
||||
frame head in the yielded <code>BytesMut</code>.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_offset</span>(<span class="number">0</span>) <span class="comment">// default value</span>
|
||||
.<span class="ident">length_field_length</span>(<span class="number">2</span>)
|
||||
.<span class="ident">length_adjustment</span>(<span class="number">0</span>) <span class="comment">// default value</span>
|
||||
.<span class="ident">num_skip</span>(<span class="number">0</span>) <span class="comment">// Do not strip frame header</span>
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
<p>The following frame will be decoded as such:</p>
|
||||
<pre><code class="language-text"> INPUT DECODED
|
||||
+-- len ---+--- Payload ---+ +-- len ---+--- Payload ---+
|
||||
| \x00\x0B | Hello world | --> | \x00\x0B | Hello world |
|
||||
+----------+---------------+ +----------+---------------+
|
||||
</code></pre>
|
||||
<p>The value of the length field is 11 (<code>\x0B</code>) which represents the length
|
||||
of the payload, <code>hello world</code>. By default, <a href="../../../tokio_util/codec/struct.FramedRead.html"><code>FramedRead</code></a> assumes that
|
||||
the length field represents the number of bytes that <strong>follows</strong> the
|
||||
length field. Thus, the entire frame has a length of 13: 2 bytes for the
|
||||
frame head + 11 bytes for the payload.</p>
|
||||
<h2 id="example-2" class="section-header"><a href="#example-2">Example 2</a></h2>
|
||||
<p>The following will parse a <code>u16</code> length field at offset 0, omitting the
|
||||
frame head in the yielded <code>BytesMut</code>.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_offset</span>(<span class="number">0</span>) <span class="comment">// default value</span>
|
||||
.<span class="ident">length_field_length</span>(<span class="number">2</span>)
|
||||
.<span class="ident">length_adjustment</span>(<span class="number">0</span>) <span class="comment">// default value</span>
|
||||
<span class="comment">// `num_skip` is not needed, the default is to skip</span>
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
<p>The following frame will be decoded as such:</p>
|
||||
<pre><code class="language-text"> INPUT DECODED
|
||||
+-- len ---+--- Payload ---+ +--- Payload ---+
|
||||
| \x00\x0B | Hello world | --> | Hello world |
|
||||
+----------+---------------+ +---------------+
|
||||
</code></pre>
|
||||
<p>This is similar to the first example, the only difference is that the
|
||||
frame head is <strong>not</strong> included in the yielded <code>BytesMut</code> value.</p>
|
||||
<h2 id="example-3" class="section-header"><a href="#example-3">Example 3</a></h2>
|
||||
<p>The following will parse a <code>u16</code> length field at offset 0, including the
|
||||
frame head in the yielded <code>BytesMut</code>. In this case, the length field
|
||||
<strong>includes</strong> the frame head length.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_offset</span>(<span class="number">0</span>) <span class="comment">// default value</span>
|
||||
.<span class="ident">length_field_length</span>(<span class="number">2</span>)
|
||||
.<span class="ident">length_adjustment</span>(<span class="op">-</span><span class="number">2</span>) <span class="comment">// size of head</span>
|
||||
.<span class="ident">num_skip</span>(<span class="number">0</span>)
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
<p>The following frame will be decoded as such:</p>
|
||||
<pre><code class="language-text"> INPUT DECODED
|
||||
+-- len ---+--- Payload ---+ +-- len ---+--- Payload ---+
|
||||
| \x00\x0D | Hello world | --> | \x00\x0D | Hello world |
|
||||
+----------+---------------+ +----------+---------------+
|
||||
</code></pre>
|
||||
<p>In most cases, the length field represents the length of the payload
|
||||
only, as shown in the previous examples. However, in some protocols the
|
||||
length field represents the length of the whole frame, including the
|
||||
head. In such cases, we specify a negative <code>length_adjustment</code> to adjust
|
||||
the value provided in the frame head to represent the payload length.</p>
|
||||
<h2 id="example-4" class="section-header"><a href="#example-4">Example 4</a></h2>
|
||||
<p>The following will parse a 3 byte length field at offset 0 in a 5 byte
|
||||
frame head, including the frame head in the yielded <code>BytesMut</code>.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_offset</span>(<span class="number">0</span>) <span class="comment">// default value</span>
|
||||
.<span class="ident">length_field_length</span>(<span class="number">3</span>)
|
||||
.<span class="ident">length_adjustment</span>(<span class="number">2</span>) <span class="comment">// remaining head</span>
|
||||
.<span class="ident">num_skip</span>(<span class="number">0</span>)
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
<p>The following frame will be decoded as such:</p>
|
||||
<pre><code class="language-text"> INPUT
|
||||
+---- len -----+- head -+--- Payload ---+
|
||||
| \x00\x00\x0B | \xCAFE | Hello world |
|
||||
+--------------+--------+---------------+
|
||||
|
||||
DECODED
|
||||
+---- len -----+- head -+--- Payload ---+
|
||||
| \x00\x00\x0B | \xCAFE | Hello world |
|
||||
+--------------+--------+---------------+
|
||||
</code></pre>
|
||||
<p>A more advanced example that shows a case where there is extra frame
|
||||
head data between the length field and the payload. In such cases, it is
|
||||
usually desirable to include the frame head as part of the yielded
|
||||
<code>BytesMut</code>. This lets consumers of the length delimited framer to
|
||||
process the frame head as needed.</p>
|
||||
<p>The positive <code>length_adjustment</code> value lets <code>FramedRead</code> factor in the
|
||||
additional head into the frame length calculation.</p>
|
||||
<h2 id="example-5" class="section-header"><a href="#example-5">Example 5</a></h2>
|
||||
<p>The following will parse a <code>u16</code> length field at offset 1 of a 4 byte
|
||||
frame head. The first byte and the length field will be omitted from the
|
||||
yielded <code>BytesMut</code>, but the trailing 2 bytes of the frame head will be
|
||||
included.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_offset</span>(<span class="number">1</span>) <span class="comment">// length of hdr1</span>
|
||||
.<span class="ident">length_field_length</span>(<span class="number">2</span>)
|
||||
.<span class="ident">length_adjustment</span>(<span class="number">1</span>) <span class="comment">// length of hdr2</span>
|
||||
.<span class="ident">num_skip</span>(<span class="number">3</span>) <span class="comment">// length of hdr1 + LEN</span>
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
<p>The following frame will be decoded as such:</p>
|
||||
<pre><code class="language-text"> INPUT
|
||||
+- hdr1 -+-- len ---+- hdr2 -+--- Payload ---+
|
||||
| \xCA | \x00\x0B | \xFE | Hello world |
|
||||
+--------+----------+--------+---------------+
|
||||
|
||||
DECODED
|
||||
+- hdr2 -+--- Payload ---+
|
||||
| \xFE | Hello world |
|
||||
+--------+---------------+
|
||||
</code></pre>
|
||||
<p>The length field is situated in the middle of the frame head. In this
|
||||
case, the first byte in the frame head could be a version or some other
|
||||
identifier that is not needed for processing. On the other hand, the
|
||||
second half of the head is needed.</p>
|
||||
<p><code>length_field_offset</code> indicates how many bytes to skip before starting
|
||||
to read the length field. <code>length_adjustment</code> is the number of bytes to
|
||||
skip starting at the end of the length field. In this case, it is the
|
||||
second half of the head.</p>
|
||||
<h2 id="example-6" class="section-header"><a href="#example-6">Example 6</a></h2>
|
||||
<p>The following will parse a <code>u16</code> length field at offset 1 of a 4 byte
|
||||
frame head. The first byte and the length field will be omitted from the
|
||||
yielded <code>BytesMut</code>, but the trailing 2 bytes of the frame head will be
|
||||
included. In this case, the length field <strong>includes</strong> the frame head
|
||||
length.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_offset</span>(<span class="number">1</span>) <span class="comment">// length of hdr1</span>
|
||||
.<span class="ident">length_field_length</span>(<span class="number">2</span>)
|
||||
.<span class="ident">length_adjustment</span>(<span class="op">-</span><span class="number">3</span>) <span class="comment">// length of hdr1 + LEN, negative</span>
|
||||
.<span class="ident">num_skip</span>(<span class="number">3</span>)
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
<p>The following frame will be decoded as such:</p>
|
||||
<pre><code class="language-text"> INPUT
|
||||
+- hdr1 -+-- len ---+- hdr2 -+--- Payload ---+
|
||||
| \xCA | \x00\x0F | \xFE | Hello world |
|
||||
+--------+----------+--------+---------------+
|
||||
|
||||
DECODED
|
||||
+- hdr2 -+--- Payload ---+
|
||||
| \xFE | Hello world |
|
||||
+--------+---------------+
|
||||
</code></pre>
|
||||
<p>Similar to the example above, the difference is that the length field
|
||||
represents the length of the entire frame instead of just the payload.
|
||||
The length of <code>hdr1</code> and <code>len</code> must be counted in <code>length_adjustment</code>.
|
||||
Note that the length of <code>hdr2</code> does <strong>not</strong> need to be explicitly set
|
||||
anywhere because it already is factored into the total frame length that
|
||||
is read from the byte stream.</p>
|
||||
<h2 id="example-7" class="section-header"><a href="#example-7">Example 7</a></h2>
|
||||
<p>The following will parse a 3 byte length field at offset 0 in a 4 byte
|
||||
frame head, excluding the 4th byte from the yielded <code>BytesMut</code>.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_offset</span>(<span class="number">0</span>) <span class="comment">// default value</span>
|
||||
.<span class="ident">length_field_length</span>(<span class="number">3</span>)
|
||||
.<span class="ident">length_adjustment</span>(<span class="number">0</span>) <span class="comment">// default value</span>
|
||||
.<span class="ident">num_skip</span>(<span class="number">4</span>) <span class="comment">// skip the first 4 bytes</span>
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
<p>The following frame will be decoded as such:</p>
|
||||
<pre><code class="language-text"> INPUT DECODED
|
||||
+------- len ------+--- Payload ---+ +--- Payload ---+
|
||||
| \x00\x00\x0B\xFF | Hello world | => | Hello world |
|
||||
+------------------+---------------+ +---------------+
|
||||
</code></pre>
|
||||
<p>A simple example where there are unused bytes between the length field
|
||||
and the payload.</p>
|
||||
<h1 id="encoding" class="section-header"><a href="#encoding">Encoding</a></h1>
|
||||
<p><a href="../../../tokio_util/codec/struct.FramedWrite.html"><code>FramedWrite</code></a> adapts an <a href="../../../tokio/io/async_write/trait.AsyncWrite.html"><code>AsyncWrite</code></a> into a <code>Sink</code> of <a href="../../../bytes/bytes_mut/struct.BytesMut.html"><code>BytesMut</code></a>,
|
||||
such that each submitted <a href="../../../bytes/bytes_mut/struct.BytesMut.html"><code>BytesMut</code></a> is prefaced by a length field.
|
||||
There are fewer configuration options than <a href="../../../tokio_util/codec/struct.FramedRead.html"><code>FramedRead</code></a>. Given
|
||||
protocols that have more complex frame heads, an encoder should probably
|
||||
be written by hand using <a href="../../../tokio_util/codec/trait.Encoder.html"><code>Encoder</code></a>.</p>
|
||||
<p>Here is a simple example, given a <code>FramedWrite</code> with the following
|
||||
configuration:</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_length</span>(<span class="number">2</span>)
|
||||
.<span class="ident">new_write</span>(<span class="ident">io</span>);</pre></div>
|
||||
<p>A payload of <code>hello world</code> will be encoded as:</p>
|
||||
<pre><code class="language-text">+- len: u16 -+---- data ----+
|
||||
| \x00\x0b | hello world |
|
||||
+------------+--------------+
|
||||
</code></pre>
|
||||
</div><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<table><tr class="module-item"><td><a class="struct" href="struct.Builder.html" title="tokio_util::codec::length_delimited::Builder struct">Builder</a></td><td class="docblock-short"><p>Configure length delimited <code>LengthDelimitedCodec</code>s.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.LengthDelimitedCodec.html" title="tokio_util::codec::length_delimited::LengthDelimitedCodec struct">LengthDelimitedCodec</a></td><td class="docblock-short"><p>A codec for frames delimited by a frame head specifying their lengths.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.LengthDelimitedCodecError.html" title="tokio_util::codec::length_delimited::LengthDelimitedCodecError struct">LengthDelimitedCodecError</a></td><td class="docblock-short"><p>An error when the number of bytes read is more than max frame length.</p>
|
||||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
initSidebarItems({"struct":[["Builder","Configure length delimited `LengthDelimitedCodec`s."],["LengthDelimitedCodec","A codec for frames delimited by a frame head specifying their lengths."],["LengthDelimitedCodecError","An error when the number of bytes read is more than max frame length."]]});
|
||||
@@ -0,0 +1,155 @@
|
||||
<!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="Configure length delimited `LengthDelimitedCodec`s."><meta name="keywords" content="rust, rustlang, rust-lang, Builder"><title>tokio_util::codec::length_delimited::Builder - 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 struct"><!--[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">Struct Builder</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.big_endian">big_endian</a><a href="#method.length_adjustment">length_adjustment</a><a href="#method.length_field_length">length_field_length</a><a href="#method.length_field_offset">length_field_offset</a><a href="#method.little_endian">little_endian</a><a href="#method.max_frame_length">max_frame_length</a><a href="#method.native_endian">native_endian</a><a href="#method.new">new</a><a href="#method.new_codec">new_codec</a><a href="#method.new_framed">new_framed</a><a href="#method.new_read">new_read</a><a href="#method.new_write">new_write</a><a href="#method.num_skip">num_skip</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Copy">Copy</a><a href="#impl-Debug">Debug</a><a href="#impl-Default">Default</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class="location"><a href="../../index.html">tokio_util</a>::<wbr><a href="../index.html">codec</a>::<wbr><a href="index.html">length_delimited</a></p><div id="sidebar-vars" data-name="Builder" data-ty="struct" data-relpath=""></div><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="in-band">Struct <a href="../../index.html">tokio_util</a>::<wbr><a href="../index.html">codec</a>::<wbr><a href="index.html">length_delimited</a>::<wbr><a class="struct" href="">Builder</a></span><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/length_delimited.rs.html#390-409" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct Builder { /* fields omitted */ }</pre></div><div class="docblock"><p>Configure length delimited <code>LengthDelimitedCodec</code>s.</p>
|
||||
<p><code>Builder</code> enables constructing configured length delimited codecs. Note
|
||||
that not all configuration settings apply to both encoding and decoding. See
|
||||
the documentation for specific methods for more detail.</p>
|
||||
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.Builder.html" title="struct tokio_util::codec::length_delimited::Builder">Builder</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#632-971" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>() -> <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.Builder.html" title="struct tokio_util::codec::length_delimited::Builder">Builder</a></code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#652-672" title="goto source code">[src]</a></h4><div class="docblock"><p>Creates a new length delimited codec builder with default configuration
|
||||
values.</p>
|
||||
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">LengthDelimitedCodec</span>;
|
||||
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_offset</span>(<span class="number">0</span>)
|
||||
.<span class="ident">length_field_length</span>(<span class="number">2</span>)
|
||||
.<span class="ident">length_adjustment</span>(<span class="number">0</span>)
|
||||
.<span class="ident">num_skip</span>(<span class="number">0</span>)
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
</div><h4 id="method.big_endian" class="method"><code>pub fn <a href="#method.big_endian" class="fnname">big_endian</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self</code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#693-696" title="goto source code">[src]</a></h4><div class="docblock"><p>Read the length field as a big endian integer</p>
|
||||
<p>This is the default setting.</p>
|
||||
<p>This configuration option applies to both encoding and decoding.</p>
|
||||
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">LengthDelimitedCodec</span>;
|
||||
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">big_endian</span>()
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
</div><h4 id="method.little_endian" class="method"><code>pub fn <a href="#method.little_endian" class="fnname">little_endian</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self</code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#717-720" title="goto source code">[src]</a></h4><div class="docblock"><p>Read the length field as a little endian integer</p>
|
||||
<p>The default setting is big endian.</p>
|
||||
<p>This configuration option applies to both encoding and decoding.</p>
|
||||
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">LengthDelimitedCodec</span>;
|
||||
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">little_endian</span>()
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
</div><h4 id="method.native_endian" class="method"><code>pub fn <a href="#method.native_endian" class="fnname">native_endian</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self</code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#741-747" title="goto source code">[src]</a></h4><div class="docblock"><p>Read the length field as a native endian integer</p>
|
||||
<p>The default setting is big endian.</p>
|
||||
<p>This configuration option applies to both encoding and decoding.</p>
|
||||
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">LengthDelimitedCodec</span>;
|
||||
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">native_endian</span>()
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
</div><h4 id="method.max_frame_length" class="method"><code>pub fn <a href="#method.max_frame_length" class="fnname">max_frame_length</a>(&mut self, val: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self</code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#775-778" title="goto source code">[src]</a></h4><div class="docblock"><p>Sets the max frame length</p>
|
||||
<p>This configuration option applies to both encoding and decoding. The
|
||||
default value is 8MB.</p>
|
||||
<p>When decoding, the length field read from the byte stream is checked
|
||||
against this setting <strong>before</strong> any adjustments are applied. When
|
||||
encoding, the length of the submitted payload is checked against this
|
||||
setting.</p>
|
||||
<p>When frames exceed the max length, an <code>io::Error</code> with the custom value
|
||||
of the <code>LengthDelimitedCodecError</code> type will be returned.</p>
|
||||
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">LengthDelimitedCodec</span>;
|
||||
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">max_frame_length</span>(<span class="number">8</span> <span class="op">*</span> <span class="number">1024</span>)
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
</div><h4 id="method.length_field_length" class="method"><code>pub fn <a href="#method.length_field_length" class="fnname">length_field_length</a>(&mut self, val: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self</code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#799-803" title="goto source code">[src]</a></h4><div class="docblock"><p>Sets the number of bytes used to represent the length field</p>
|
||||
<p>The default value is <code>4</code>. The max value is <code>8</code>.</p>
|
||||
<p>This configuration option applies to both encoding and decoding.</p>
|
||||
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">LengthDelimitedCodec</span>;
|
||||
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_length</span>(<span class="number">4</span>)
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
</div><h4 id="method.length_field_offset" class="method"><code>pub fn <a href="#method.length_field_offset" class="fnname">length_field_offset</a>(&mut self, val: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self</code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#822-825" title="goto source code">[src]</a></h4><div class="docblock"><p>Sets the number of bytes in the header before the length field</p>
|
||||
<p>This configuration option only applies to decoding.</p>
|
||||
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">LengthDelimitedCodec</span>;
|
||||
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_offset</span>(<span class="number">1</span>)
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
</div><h4 id="method.length_adjustment" class="method"><code>pub fn <a href="#method.length_adjustment" class="fnname">length_adjustment</a>(&mut self, val: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self</code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#843-846" title="goto source code">[src]</a></h4><div class="docblock"><p>Delta between the payload length specified in the header and the real
|
||||
payload length</p>
|
||||
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">LengthDelimitedCodec</span>;
|
||||
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_adjustment</span>(<span class="op">-</span><span class="number">2</span>)
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
</div><h4 id="method.num_skip" class="method"><code>pub fn <a href="#method.num_skip" class="fnname">num_skip</a>(&mut self, val: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self</code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#867-870" title="goto source code">[src]</a></h4><div class="docblock"><p>Sets the number of bytes to skip before reading the payload</p>
|
||||
<p>Default value is <code>length_field_len + length_field_offset</code></p>
|
||||
<p>This configuration option only applies to decoding</p>
|
||||
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">LengthDelimitedCodec</span>;
|
||||
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">num_skip</span>(<span class="number">4</span>)
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
</div><h4 id="method.new_codec" class="method"><code>pub fn <a href="#method.new_codec" class="fnname">new_codec</a>(&self) -> <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodec.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodec">LengthDelimitedCodec</a></code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#887-892" title="goto source code">[src]</a></h4><div class="docblock"><p>Create a configured length delimited <code>LengthDelimitedCodec</code></p>
|
||||
<h1 id="examples-9" class="section-header"><a href="#examples-9">Examples</a></h1>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">LengthDelimitedCodec</span>;
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_offset</span>(<span class="number">0</span>)
|
||||
.<span class="ident">length_field_length</span>(<span class="number">2</span>)
|
||||
.<span class="ident">length_adjustment</span>(<span class="number">0</span>)
|
||||
.<span class="ident">num_skip</span>(<span class="number">0</span>)
|
||||
.<span class="ident">new_codec</span>();</pre></div>
|
||||
</div><h4 id="method.new_read" class="method"><code>pub fn <a href="#method.new_read" class="fnname">new_read</a><T>(&self, upstream: T) -> <a class="struct" href="../../../tokio_util/codec/struct.FramedRead.html" title="struct tokio_util::codec::FramedRead">FramedRead</a><T, <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodec.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodec">LengthDelimitedCodec</a>> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../../tokio/io/async_read/trait.AsyncRead.html" title="trait tokio::io::async_read::AsyncRead">AsyncRead</a>, </span></code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#912-917" title="goto source code">[src]</a></h4><div class="docblock"><p>Create a configured length delimited <code>FramedRead</code></p>
|
||||
<h1 id="examples-10" class="section-header"><a href="#examples-10">Examples</a></h1>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">LengthDelimitedCodec</span>;
|
||||
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_offset</span>(<span class="number">0</span>)
|
||||
.<span class="ident">length_field_length</span>(<span class="number">2</span>)
|
||||
.<span class="ident">length_adjustment</span>(<span class="number">0</span>)
|
||||
.<span class="ident">num_skip</span>(<span class="number">0</span>)
|
||||
.<span class="ident">new_read</span>(<span class="ident">io</span>);</pre></div>
|
||||
</div><h4 id="method.new_write" class="method"><code>pub fn <a href="#method.new_write" class="fnname">new_write</a><T>(&self, inner: T) -> <a class="struct" href="../../../tokio_util/codec/struct.FramedWrite.html" title="struct tokio_util::codec::FramedWrite">FramedWrite</a><T, <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodec.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodec">LengthDelimitedCodec</a>> <span class="where fmt-newline">where<br> T: <a class="trait" href="../../../tokio/io/async_write/trait.AsyncWrite.html" title="trait tokio::io::async_write::AsyncWrite">AsyncWrite</a>, </span></code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#933-938" title="goto source code">[src]</a></h4><div class="docblock"><p>Create a configured length delimited <code>FramedWrite</code></p>
|
||||
<h1 id="examples-11" class="section-header"><a href="#examples-11">Examples</a></h1>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_length</span>(<span class="number">2</span>)
|
||||
.<span class="ident">new_write</span>(<span class="ident">io</span>);</pre></div>
|
||||
</div><h4 id="method.new_framed" class="method"><code>pub fn <a href="#method.new_framed" class="fnname">new_framed</a><T>(&self, inner: T) -> <a class="struct" href="../../../tokio_util/codec/struct.Framed.html" title="struct tokio_util::codec::Framed">Framed</a><T, <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodec.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodec">LengthDelimitedCodec</a>> <span class="where fmt-newline">where<br> 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>, </span></code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#955-960" title="goto source code">[src]</a></h4><div class="docblock"><p>Create a configured length delimited <code>Framed</code></p>
|
||||
<h1 id="examples-12" class="section-header"><a href="#examples-12">Examples</a></h1>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="ident">LengthDelimitedCodec</span>::<span class="ident">builder</span>()
|
||||
.<span class="ident">length_field_length</span>(<span class="number">2</span>)
|
||||
.<span class="ident">new_framed</span>(<span class="ident">io</span>);</pre></div>
|
||||
</div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Clone" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.Builder.html" title="struct tokio_util::codec::length_delimited::Builder">Builder</a></code><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#389" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.clone" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&self) -> <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.Builder.html" title="struct tokio_util::codec::length_delimited::Builder">Builder</a></code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#389" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
|
||||
</div><h4 id="method.clone_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self)</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#128" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
||||
</div></div><h3 id="impl-Copy" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.Builder.html" title="struct tokio_util::codec::length_delimited::Builder">Builder</a></code><a href="#impl-Copy" class="anchor"></a><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#389" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.Builder.html" title="struct tokio_util::codec::length_delimited::Builder">Builder</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#389" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#389" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Default" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.Builder.html" title="struct tokio_util::codec::length_delimited::Builder">Builder</a></code><a href="#impl-Default" class="anchor"></a><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#973-977" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.default" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fnname">default</a>() -> Self</code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#974-976" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></p>
|
||||
</div></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.Builder.html" title="struct tokio_util::codec::length_delimited::Builder">Builder</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Send" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.Builder.html" title="struct tokio_util::codec::length_delimited::Builder">Builder</a></code><a href="#impl-Send" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.Builder.html" title="struct tokio_util::codec::length_delimited::Builder">Builder</a></code><a href="#impl-Sync" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.Builder.html" title="struct tokio_util::codec::length_delimited::Builder">Builder</a></code><a href="#impl-Unpin" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.Builder.html" title="struct tokio_util::codec::length_delimited::Builder">Builder</a></code><a href="#impl-UnwindSafe" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<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 href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-ToOwned" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code><a href="#impl-ToOwned" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81-93" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Owned" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
|
||||
</div><h4 id="method.to_owned" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&self) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#86" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
|
||||
</div><h4 id="method.clone_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T)</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#90" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
|
||||
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
|
||||
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A codec for frames delimited by a frame head specifying their lengths."><meta name="keywords" content="rust, rustlang, rust-lang, LengthDelimitedCodec"><title>tokio_util::codec::length_delimited::LengthDelimitedCodec - 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 struct"><!--[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">Struct LengthDelimitedCodec</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.builder">builder</a><a href="#method.max_frame_length">max_frame_length</a><a href="#method.new">new</a><a href="#method.set_max_frame_length">set_max_frame_length</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Decoder">Decoder</a><a href="#impl-Default">Default</a><a href="#impl-Encoder%3CBytes%3E">Encoder<Bytes></a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class="location"><a href="../../index.html">tokio_util</a>::<wbr><a href="../index.html">codec</a>::<wbr><a href="index.html">length_delimited</a></p><div id="sidebar-vars" data-name="LengthDelimitedCodec" data-ty="struct" data-relpath=""></div><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="in-band">Struct <a href="../../index.html">tokio_util</a>::<wbr><a href="../index.html">codec</a>::<wbr><a href="index.html">length_delimited</a>::<wbr><a class="struct" href="">LengthDelimitedCodec</a></span><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/length_delimited.rs.html#425-431" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct LengthDelimitedCodec { /* fields omitted */ }</pre></div><div class="docblock"><p>A codec for frames delimited by a frame head specifying their lengths.</p>
|
||||
<p>This allows the consumer to work with entire frames without having to worry
|
||||
about buffering or other framing logic.</p>
|
||||
<p>See <a href="index.html">module level</a> documentation for more detail.</p>
|
||||
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl <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" class="anchor"></a><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#441-547" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>() -> Self</code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#443-448" title="goto source code">[src]</a></h4><div class="docblock"><p>Creates a new <code>LengthDelimitedCodec</code> with the default configuration values.</p>
|
||||
</div><h4 id="method.builder" class="method"><code>pub fn <a href="#method.builder" class="fnname">builder</a>() -> <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.Builder.html" title="struct tokio_util::codec::length_delimited::Builder">Builder</a></code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#452-454" title="goto source code">[src]</a></h4><div class="docblock"><p>Creates a new length delimited codec builder with default configuration
|
||||
values.</p>
|
||||
</div><h4 id="method.max_frame_length" class="method"><code>pub fn <a href="#method.max_frame_length" class="fnname">max_frame_length</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#460-462" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns the current max frame setting</p>
|
||||
<p>This is the largest size this codec will accept from the wire. Larger
|
||||
frames will be rejected.</p>
|
||||
</div><h4 id="method.set_max_frame_length" class="method"><code>pub fn <a href="#method.set_max_frame_length" class="fnname">set_max_frame_length</a>(&mut self, val: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#470-472" title="goto source code">[src]</a></h4><div class="docblock"><p>Updates the max frame setting.</p>
|
||||
<p>The change takes effect the next time a frame is decoded. In other
|
||||
words, if a frame is currently in process of being decoded with a frame
|
||||
size greater than <code>val</code> but less than the max frame length in effect
|
||||
before calling this function, then the frame will be allowed.</p>
|
||||
</div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> 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-Debug" class="anchor"></a><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#424" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#424" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Decoder" class="impl"><code class="in-band">impl <a class="trait" href="../../../tokio_util/codec/trait.Decoder.html" title="trait tokio_util::codec::Decoder">Decoder</a> 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" class="type"><code>type <a href="../../../tokio_util/codec/trait.Decoder.html#associatedtype.Item" class="type">Item</a> = <a class="struct" href="../../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a></code></h4><div class='docblock'><p>The type of decoded frames.</p>
|
||||
</div><h4 id="associatedtype.Error" class="type"><code>type <a href="../../../tokio_util/codec/trait.Decoder.html#associatedtype.Error" 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><div class='docblock'><p>The type of unrecoverable frame decoding errors. <a href="../../../tokio_util/codec/trait.Decoder.html#associatedtype.Error">Read more</a></p>
|
||||
</div><h4 id="method.decode" class="method hidden"><code>fn <a href="../../../tokio_util/codec/trait.Decoder.html#tymethod.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 class='docblock hidden'><p>Attempts to decode a frame from the provided buffer of bytes. <a href="../../../tokio_util/codec/trait.Decoder.html#tymethod.decode">Read more</a></p>
|
||||
</div><h4 id="method.decode_eof" class="method hidden"><code>fn <a href="../../../tokio_util/codec/trait.Decoder.html#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></h4><div class='docblock hidden'><p>A default method available to be called when there are no more bytes
|
||||
available to be read from the underlying I/O. <a href="../../../tokio_util/codec/trait.Decoder.html#method.decode_eof">Read more</a></p>
|
||||
</div><h4 id="method.framed" class="method hidden"><code>fn <a href="../../../tokio_util/codec/trait.Decoder.html#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></h4><div class='docblock hidden'><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. <a href="../../../tokio_util/codec/trait.Decoder.html#method.framed">Read more</a></p>
|
||||
</div></div><h3 id="impl-Default" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> 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-Default" class="anchor"></a><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#624-628" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.default" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fnname">default</a>() -> Self</code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#625-627" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></p>
|
||||
</div></div><h3 id="impl-Encoder%3CBytes%3E" class="impl"><code class="in-band">impl <a class="trait" href="../../../tokio_util/codec/trait.Encoder.html" title="trait tokio_util::codec::Encoder">Encoder</a><<a class="struct" href="../../../bytes/bytes/struct.Bytes.html" title="struct bytes::bytes::Bytes">Bytes</a>> 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-Encoder%3CBytes%3E" class="anchor"></a><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#580-622" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="../../../tokio_util/codec/trait.Encoder.html#associatedtype.Error" 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><div class='docblock'><p>The type of encoding errors. <a href="../../../tokio_util/codec/trait.Encoder.html#associatedtype.Error">Read more</a></p>
|
||||
</div><h4 id="method.encode" class="method hidden"><code>fn <a href="../../../tokio_util/codec/trait.Encoder.html#tymethod.encode" class="fnname">encode</a>(&mut self, data: <a class="struct" href="../../../bytes/bytes/struct.Bytes.html" title="struct bytes::bytes::Bytes">Bytes</a>, dst: &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="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>></code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#583-621" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Encodes a frame into the buffer provided. <a href="../../../tokio_util/codec/trait.Encoder.html#tymethod.encode">Read more</a></p>
|
||||
</div></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> 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-RefUnwindSafe" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Send" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> 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-Send" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> 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-Sync" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> 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-Unpin" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> 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-UnwindSafe" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<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 href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-2" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-3" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1,22 @@
|
||||
<!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="An error when the number of bytes read is more than max frame length."><meta name="keywords" content="rust, rustlang, rust-lang, LengthDelimitedCodecError"><title>tokio_util::codec::length_delimited::LengthDelimitedCodecError - 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 struct"><!--[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">Struct LengthDelimitedCodecError</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Display">Display</a><a href="#impl-Error">Error</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-ToString">ToString</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class="location"><a href="../../index.html">tokio_util</a>::<wbr><a href="../index.html">codec</a>::<wbr><a href="index.html">length_delimited</a></p><div id="sidebar-vars" data-name="LengthDelimitedCodecError" data-ty="struct" data-relpath=""></div><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="in-band">Struct <a href="../../index.html">tokio_util</a>::<wbr><a href="../index.html">codec</a>::<wbr><a href="index.html">length_delimited</a>::<wbr><a class="struct" href="">LengthDelimitedCodecError</a></span><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/length_delimited.rs.html#412-414" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct LengthDelimitedCodecError { /* fields omitted */ }</pre></div><div class="docblock"><p>An error when the number of bytes read is more than max frame length.</p>
|
||||
</div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodecError.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodecError">LengthDelimitedCodecError</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#981-985" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#982-984" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Display" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodecError.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodecError">LengthDelimitedCodecError</a></code><a href="#impl-Display" class="anchor"></a><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#987-991" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt-1" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#988-990" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Error" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodecError.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodecError">LengthDelimitedCodecError</a></code><a href="#impl-Error" class="anchor"></a><a class="srclink" href="../../../src/tokio_util/codec/length_delimited.rs.html#993" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.source" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.source" class="fnname">source</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&(dyn <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static)></code><span class="since" title="Stable since Rust version 1.30.0">1.30.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#98" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>The lower-level source of this error, if any. <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.source">Read more</a></p>
|
||||
</div><h4 id="method.backtrace" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace" class="fnname">backtrace</a>(&self) -> <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/std/backtrace/struct.Backtrace.html" title="struct std::backtrace::Backtrace">Backtrace</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#126" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>backtrace</code>)</div></div><div class='docblock hidden'><p>Returns a stack backtrace, if available, of where this error occurred. <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace">Read more</a></p>
|
||||
</div><h4 id="method.description" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description" class="fnname">description</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#138" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.42.0: <p>use the Display impl or to_string()</p>
|
||||
</div></div><div class='docblock hidden'> <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description">Read more</a></div><h4 id="method.cause" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.cause" class="fnname">cause</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a>></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#148" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.33.0: <p>replaced by Error::source, which can support downcasting</p>
|
||||
</div></div></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodecError.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodecError">LengthDelimitedCodecError</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Send" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodecError.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodecError">LengthDelimitedCodecError</a></code><a href="#impl-Send" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodecError.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodecError">LengthDelimitedCodecError</a></code><a href="#impl-Sync" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodecError.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodecError">LengthDelimitedCodecError</a></code><a href="#impl-Unpin" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../../tokio_util/codec/length_delimited/struct.LengthDelimitedCodecError.html" title="struct tokio_util::codec::length_delimited::LengthDelimitedCodecError">LengthDelimitedCodecError</a></code><a href="#impl-UnwindSafe" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<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 href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-ToString" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<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 href="#impl-ToString" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2205-2218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.to_string" class="method hidden"><code>pub default fn <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string" class="fnname">to_string</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2211" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></p>
|
||||
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/codec/enum.LinesCodecError.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/codec/enum.LinesCodecError.html">../../../tokio_util/codec/enum.LinesCodecError.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/codec/enum.LinesCodecError.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/codec/struct.LinesCodec.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/codec/struct.LinesCodec.html">../../../tokio_util/codec/struct.LinesCodec.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/codec/struct.LinesCodec.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
initSidebarItems({"enum":[["AnyDelimiterCodecError","An error occured while encoding or decoding a chunk."],["LinesCodecError","An error occured while encoding or decoding a line."]],"mod":[["length_delimited","Frame a stream of bytes based on a length prefix"]],"struct":[["AnyDelimiterCodec","A simple `Decoder` and `Encoder` implementation that splits up data into chunks based on any character in the given delimiter string."],["BytesCodec","A simple `Decoder` and `Encoder` implementation that just ships bytes around."],["Framed","A unified `Stream` and `Sink` interface to an underlying I/O object, using the `Encoder` and `Decoder` traits to encode and decode frames."],["FramedParts","`FramedParts` contains an export of the data of a Framed transport. It can be used to construct a new `Framed` with a different codec. It contains all current buffers and the inner transport."],["FramedRead","A `Stream` of messages decoded from an `AsyncRead`."],["FramedWrite","A `Sink` of frames encoded to an `AsyncWrite`."],["LinesCodec","A simple `Decoder` and `Encoder` implementation that splits up data into lines."]],"trait":[["Decoder","Decoding of frames via buffers."],["Encoder","Trait of helper objects to write out messages as bytes, for use with `FramedWrite`."]]});
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A simple `Decoder` and `Encoder` implementation that just ships bytes around."><meta name="keywords" content="rust, rustlang, rust-lang, BytesCodec"><title>tokio_util::codec::BytesCodec - 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 struct"><!--[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">Struct BytesCodec</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.new">new</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Copy">Copy</a><a href="#impl-Debug">Debug</a><a href="#impl-Decoder">Decoder</a><a href="#impl-Default">Default</a><a href="#impl-Encoder%3CBytes%3E">Encoder<Bytes></a><a href="#impl-Eq">Eq</a><a href="#impl-Hash">Hash</a><a href="#impl-Ord">Ord</a><a href="#impl-PartialEq%3CBytesCodec%3E">PartialEq<BytesCodec></a><a href="#impl-PartialOrd%3CBytesCodec%3E">PartialOrd<BytesCodec></a><a href="#impl-StructuralEq">StructuralEq</a><a href="#impl-StructuralPartialEq">StructuralPartialEq</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class="location"><a href="../index.html">tokio_util</a>::<wbr><a href="index.html">codec</a></p><div id="sidebar-vars" data-name="BytesCodec" data-ty="struct" data-relpath=""></div><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="in-band">Struct <a href="../index.html">tokio_util</a>::<wbr><a href="index.html">codec</a>::<wbr><a class="struct" href="">BytesCodec</a></span><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/bytes_codec.rs.html#45" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct BytesCodec(_);</pre></div><div class="docblock"><p>A simple <a href="../../tokio_util/codec/trait.Decoder.html"><code>Decoder</code></a> and <a href="../../tokio_util/codec/trait.Encoder.html"><code>Encoder</code></a> implementation that just ships bytes around.</p>
|
||||
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
|
||||
<p>Turn an <a href="../../tokio/io/async_read/trait.AsyncRead.html"><code>AsyncRead</code></a> into a stream of <code>Result<</code><a href="../../bytes/bytes_mut/struct.BytesMut.html"><code>BytesMut</code></a><code>, </code><a href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html"><code>Error</code></a><code>></code>.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio</span>::<span class="ident">fs</span>::<span class="ident">File</span>;
|
||||
<span class="kw">use</span> <span class="ident">tokio</span>::<span class="ident">io</span>::<span class="ident">AsyncRead</span>;
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::{<span class="ident">FramedRead</span>, <span class="ident">BytesCodec</span>};
|
||||
|
||||
<span class="kw">let</span> <span class="ident">my_async_read</span> <span class="op">=</span> <span class="ident">File</span>::<span class="ident">open</span>(<span class="string">"filename.txt"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
<span class="kw">let</span> <span class="ident">my_stream_of_bytes</span> <span class="op">=</span> <span class="ident">FramedRead</span>::<span class="ident">new</span>(<span class="ident">my_async_read</span>, <span class="ident">BytesCodec</span>::<span class="ident">new</span>());</pre></div>
|
||||
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#47-52" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>() -> <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#49-51" title="goto source code">[src]</a></h4><div class="docblock"><p>Creates a new <code>BytesCodec</code> for shipping around raw bytes.</p>
|
||||
</div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Clone" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.clone" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&self) -> <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
|
||||
</div><h4 id="method.clone_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self)</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#128" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
||||
</div></div><h3 id="impl-Copy" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-Copy" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Decoder" class="impl"><code class="in-band">impl <a class="trait" href="../../tokio_util/codec/trait.Decoder.html" title="trait tokio_util::codec::Decoder">Decoder</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-Decoder" 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" class="type"><code>type <a href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Item" class="type">Item</a> = <a class="struct" href="../../bytes/bytes_mut/struct.BytesMut.html" title="struct bytes::bytes_mut::BytesMut">BytesMut</a></code></h4><div class='docblock'><p>The type of decoded frames.</p>
|
||||
</div><h4 id="associatedtype.Error" class="type"><code>type <a href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Error" 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><div class='docblock'><p>The type of unrecoverable frame decoding errors. <a href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Error">Read more</a></p>
|
||||
</div><h4 id="method.decode" class="method hidden"><code>fn <a href="../../tokio_util/codec/trait.Decoder.html#tymethod.decode" 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 class='docblock hidden'><p>Attempts to decode a frame from the provided buffer of bytes. <a href="../../tokio_util/codec/trait.Decoder.html#tymethod.decode">Read more</a></p>
|
||||
</div><h4 id="method.decode_eof" class="method hidden"><code>fn <a href="../../tokio_util/codec/trait.Decoder.html#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></h4><div class='docblock hidden'><p>A default method available to be called when there are no more bytes
|
||||
available to be read from the underlying I/O. <a href="../../tokio_util/codec/trait.Decoder.html#method.decode_eof">Read more</a></p>
|
||||
</div><h4 id="method.framed" class="method hidden"><code>fn <a href="../../tokio_util/codec/trait.Decoder.html#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></h4><div class='docblock hidden'><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. <a href="../../tokio_util/codec/trait.Decoder.html#method.framed">Read more</a></p>
|
||||
</div></div><h3 id="impl-Default" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-Default" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.default" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fnname">default</a>() -> <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></p>
|
||||
</div></div><h3 id="impl-Encoder%3CBytes%3E" class="impl"><code class="in-band">impl <a class="trait" href="../../tokio_util/codec/trait.Encoder.html" title="trait tokio_util::codec::Encoder">Encoder</a><<a class="struct" href="../../bytes/bytes/struct.Bytes.html" title="struct bytes::bytes::Bytes">Bytes</a>> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-Encoder%3CBytes%3E" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#68-76" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="../../tokio_util/codec/trait.Encoder.html#associatedtype.Error" 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><div class='docblock'><p>The type of encoding errors. <a href="../../tokio_util/codec/trait.Encoder.html#associatedtype.Error">Read more</a></p>
|
||||
</div><h4 id="method.encode" class="method hidden"><code>fn <a href="../../tokio_util/codec/trait.Encoder.html#tymethod.encode" class="fnname">encode</a>(&mut self, data: <a class="struct" href="../../bytes/bytes/struct.Bytes.html" title="struct bytes::bytes::Bytes">Bytes</a>, 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="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>></code><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#71-75" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Encodes a frame into the buffer provided. <a href="../../tokio_util/codec/trait.Encoder.html#tymethod.encode">Read more</a></p>
|
||||
</div></div><h3 id="impl-Eq" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-Eq" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Hash" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-Hash" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.hash" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash" class="fnname">hash</a><__H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>>(&self, state: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>__H)</code><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Feeds this value into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash">Read more</a></p>
|
||||
</div><h4 id="method.hash_slice" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice" class="fnname">hash_slice</a><H>(data: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[Self]</a>, state: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>H) <span class="where fmt-newline">where<br> H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>, </span></code><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/hash/mod.rs.html#184-186" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice">Read more</a></p>
|
||||
</div></div><h3 id="impl-Ord" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-Ord" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.cmp" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp" class="fnname">cmp</a>(&self, other: &<a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></code><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method returns an <a href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="Ordering"><code>Ordering</code></a> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></p>
|
||||
</div><h4 id="method.max" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max" class="fnname">max</a>(self, other: Self) -> Self</code><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#723-725" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max">Read more</a></p>
|
||||
</div><h4 id="method.min" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min" class="fnname">min</a>(self, other: Self) -> Self</code><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#743-745" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min">Read more</a></p>
|
||||
</div><h4 id="method.clamp" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.clamp" class="fnname">clamp</a>(self, min: Self, max: Self) -> Self</code><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#768-770" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.clamp">Read more</a></p>
|
||||
</div></div><h3 id="impl-PartialEq%3CBytesCodec%3E" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a>> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-PartialEq%3CBytesCodec%3E" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.eq" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq" class="fnname">eq</a>(&self, other: &<a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
|
||||
by <code>==</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
|
||||
</div><h4 id="method.ne" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne" class="fnname">ne</a>(&self, other: &<a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>!=</code>.</p>
|
||||
</div></div><h3 id="impl-PartialOrd%3CBytesCodec%3E" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a>> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-PartialOrd%3CBytesCodec%3E" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.partial_cmp" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fnname">partial_cmp</a>(&self, other: &<a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</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="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
||||
</div><h4 id="method.lt" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt" class="fnname">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#963" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
||||
</div><h4 id="method.le" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le" class="fnname">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#982" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
|
||||
operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
||||
</div><h4 id="method.gt" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt" class="fnname">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1000" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
||||
</div><h4 id="method.ge" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge" class="fnname">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1019" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
|
||||
operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
||||
</div></div><h3 id="impl-StructuralEq" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.StructuralEq.html" title="trait core::marker::StructuralEq">StructuralEq</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-StructuralEq" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-StructuralPartialEq" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.StructuralPartialEq.html" title="trait core::marker::StructuralPartialEq">StructuralPartialEq</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-StructuralPartialEq" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/bytes_codec.rs.html#44" title="goto source code">[src]</a></h3><div class="impl-items"></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Send" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-Send" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-Sync" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-Unpin" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../tokio_util/codec/struct.BytesCodec.html" title="struct tokio_util::codec::BytesCodec">BytesCodec</a></code><a href="#impl-UnwindSafe" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<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 href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-ToOwned" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code><a href="#impl-ToOwned" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81-93" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Owned" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
|
||||
</div><h4 id="method.to_owned" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&self) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#86" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
|
||||
</div><h4 id="method.clone_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T)</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#90" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
|
||||
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
|
||||
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-2" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-3" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
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
@@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A simple `Decoder` and `Encoder` implementation that splits up data into lines."><meta name="keywords" content="rust, rustlang, rust-lang, LinesCodec"><title>tokio_util::codec::LinesCodec - 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 struct"><!--[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">Struct LinesCodec</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.max_length">max_length</a><a href="#method.new">new</a><a href="#method.new_with_max_length">new_with_max_length</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-Decoder">Decoder</a><a href="#impl-Default">Default</a><a href="#impl-Encoder%3CT%3E">Encoder<T></a><a href="#impl-Eq">Eq</a><a href="#impl-Hash">Hash</a><a href="#impl-Ord">Ord</a><a href="#impl-PartialEq%3CLinesCodec%3E">PartialEq<LinesCodec></a><a href="#impl-PartialOrd%3CLinesCodec%3E">PartialOrd<LinesCodec></a><a href="#impl-StructuralEq">StructuralEq</a><a href="#impl-StructuralPartialEq">StructuralPartialEq</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class="location"><a href="../index.html">tokio_util</a>::<wbr><a href="index.html">codec</a></p><div id="sidebar-vars" data-name="LinesCodec" data-ty="struct" data-relpath=""></div><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="in-band">Struct <a href="../index.html">tokio_util</a>::<wbr><a href="index.html">codec</a>::<wbr><a class="struct" href="">LinesCodec</a></span><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/lines_codec.rs.html#12-28" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct LinesCodec { /* fields omitted */ }</pre></div><div class="docblock"><p>A simple <a href="../../tokio_util/codec/trait.Decoder.html"><code>Decoder</code></a> and <a href="../../tokio_util/codec/trait.Encoder.html"><code>Encoder</code></a> implementation that splits up data into lines.</p>
|
||||
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#30-91" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>() -> <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#40-46" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a <code>LinesCodec</code> for splitting up data into lines.</p>
|
||||
<h1 id="note" class="section-header"><a href="#note">Note</a></h1>
|
||||
<p>The returned <code>LinesCodec</code> will not have an upper bound on the length
|
||||
of a buffered line. See the documentation for <a href="../../tokio_util/codec/struct.LinesCodec.html#method.new_with_max_length"><code>new_with_max_length</code></a>
|
||||
for information on why this could be a potential security risk.</p>
|
||||
</div><h4 id="method.new_with_max_length" class="method"><code>pub fn <a href="#method.new_with_max_length" class="fnname">new_with_max_length</a>(max_length: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> Self</code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#66-71" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a <code>LinesCodec</code> with a maximum line length limit.</p>
|
||||
<p>If this is set, calls to <code>LinesCodec::decode</code> will return a
|
||||
<a href="../../tokio_util/codec/enum.LinesCodecError.html"><code>LinesCodecError</code></a> when a line exceeds the length limit. Subsequent calls
|
||||
will discard up to <code>limit</code> bytes from that line until a newline
|
||||
character is reached, returning <code>None</code> until the line over the limit
|
||||
has been fully discarded. After that point, calls to <code>decode</code> will
|
||||
function as normal.</p>
|
||||
<h1 id="note-1" class="section-header"><a href="#note-1">Note</a></h1>
|
||||
<p>Setting a length limit is highly recommended for any <code>LinesCodec</code> which
|
||||
will be exposed to untrusted input. Otherwise, the size of the buffer
|
||||
that holds the line currently being read is unbounded. An attacker could
|
||||
exploit this unbounded buffer by sending an unbounded amount of input
|
||||
without any <code>\n</code> characters, causing unbounded memory consumption.</p>
|
||||
</div><h4 id="method.max_length" class="method"><code>pub fn <a href="#method.max_length" class="fnname">max_length</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#88-90" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns the maximum line length when decoding.</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">usize</span>;
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">LinesCodec</span>;
|
||||
|
||||
<span class="kw">let</span> <span class="ident">codec</span> <span class="op">=</span> <span class="ident">LinesCodec</span>::<span class="ident">new</span>();
|
||||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">codec</span>.<span class="ident">max_length</span>(), <span class="ident">usize</span>::<span class="ident">MAX</span>);</pre></div>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||||
<span class="kw">use</span> <span class="ident">tokio_util</span>::<span class="ident">codec</span>::<span class="ident">LinesCodec</span>;
|
||||
|
||||
<span class="kw">let</span> <span class="ident">codec</span> <span class="op">=</span> <span class="ident">LinesCodec</span>::<span class="ident">new_with_max_length</span>(<span class="number">256</span>);
|
||||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">codec</span>.<span class="ident">max_length</span>(), <span class="number">256</span>);</pre></div>
|
||||
</div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Clone" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.clone" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&self) -> <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
|
||||
</div><h4 id="method.clone_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self)</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#128" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
||||
</div></div><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Decoder" class="impl"><code class="in-band">impl <a class="trait" href="../../tokio_util/codec/trait.Decoder.html" title="trait tokio_util::codec::Decoder">Decoder</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-Decoder" 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" class="type"><code>type <a href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Item" 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><div class='docblock'><p>The type of decoded frames.</p>
|
||||
</div><h4 id="associatedtype.Error" class="type"><code>type <a href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a></code></h4><div class='docblock'><p>The type of unrecoverable frame decoding errors. <a href="../../tokio_util/codec/trait.Decoder.html#associatedtype.Error">Read more</a></p>
|
||||
</div><h4 id="method.decode" class="method hidden"><code>fn <a href="../../tokio_util/codec/trait.Decoder.html#tymethod.decode" 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><div class='docblock hidden'><p>Attempts to decode a frame from the provided buffer of bytes. <a href="../../tokio_util/codec/trait.Decoder.html#tymethod.decode">Read more</a></p>
|
||||
</div><h4 id="method.decode_eof" class="method hidden"><code>fn <a href="../../tokio_util/codec/trait.Decoder.html#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><<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 class='docblock hidden'><p>A default method available to be called when there are no more bytes
|
||||
available to be read from the underlying I/O. <a href="../../tokio_util/codec/trait.Decoder.html#method.decode_eof">Read more</a></p>
|
||||
</div><h4 id="method.framed" class="method hidden"><code>fn <a href="../../tokio_util/codec/trait.Decoder.html#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></h4><div class='docblock hidden'><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. <a href="../../tokio_util/codec/trait.Decoder.html#method.framed">Read more</a></p>
|
||||
</div></div><h3 id="impl-Default" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-Default" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#200-204" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.default" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fnname">default</a>() -> Self</code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#201-203" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></p>
|
||||
</div></div><h3 id="impl-Encoder%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="../../tokio_util/codec/trait.Encoder.html" title="trait tokio_util::codec::Encoder">Encoder</a><T> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a> <span class="where fmt-newline">where<br> 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>>, </span></code><a href="#impl-Encoder%3CT%3E" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#185-198" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="../../tokio_util/codec/trait.Encoder.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="../../tokio_util/codec/enum.LinesCodecError.html" title="enum tokio_util::codec::LinesCodecError">LinesCodecError</a></code></h4><div class='docblock'><p>The type of encoding errors. <a href="../../tokio_util/codec/trait.Encoder.html#associatedtype.Error">Read more</a></p>
|
||||
</div><h4 id="method.encode" class="method hidden"><code>fn <a href="../../tokio_util/codec/trait.Encoder.html#tymethod.encode" class="fnname">encode</a>(&mut self, line: T, 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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</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#191-197" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Encodes a frame into the buffer provided. <a href="../../tokio_util/codec/trait.Encoder.html#tymethod.encode">Read more</a></p>
|
||||
</div></div><h3 id="impl-Eq" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-Eq" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Hash" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-Hash" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.hash" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash" class="fnname">hash</a><__H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>>(&self, state: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>__H)</code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Feeds this value into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash">Read more</a></p>
|
||||
</div><h4 id="method.hash_slice" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice" class="fnname">hash_slice</a><H>(data: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[Self]</a>, state: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>H) <span class="where fmt-newline">where<br> H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>, </span></code><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/hash/mod.rs.html#184-186" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice">Read more</a></p>
|
||||
</div></div><h3 id="impl-Ord" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-Ord" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.cmp" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp" class="fnname">cmp</a>(&self, other: &<a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method returns an <a href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="Ordering"><code>Ordering</code></a> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></p>
|
||||
</div><h4 id="method.max" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max" class="fnname">max</a>(self, other: Self) -> Self</code><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#723-725" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max">Read more</a></p>
|
||||
</div><h4 id="method.min" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min" class="fnname">min</a>(self, other: Self) -> Self</code><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#743-745" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min">Read more</a></p>
|
||||
</div><h4 id="method.clamp" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.clamp" class="fnname">clamp</a>(self, min: Self, max: Self) -> Self</code><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#768-770" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.clamp">Read more</a></p>
|
||||
</div></div><h3 id="impl-PartialEq%3CLinesCodec%3E" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a>> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-PartialEq%3CLinesCodec%3E" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.eq" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq" class="fnname">eq</a>(&self, other: &<a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
|
||||
by <code>==</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
|
||||
</div><h4 id="method.ne" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne" class="fnname">ne</a>(&self, other: &<a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>!=</code>.</p>
|
||||
</div></div><h3 id="impl-PartialOrd%3CLinesCodec%3E" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a>> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-PartialOrd%3CLinesCodec%3E" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.partial_cmp" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fnname">partial_cmp</a>(&self, other: &<a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</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="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></code><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
|
||||
</div><h4 id="method.lt" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt" class="fnname">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#963" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
|
||||
</div><h4 id="method.le" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le" class="fnname">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#982" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
|
||||
operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
|
||||
</div><h4 id="method.gt" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt" class="fnname">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1000" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
|
||||
</div><h4 id="method.ge" class="method hidden"><code><span class="docblock attributes">#[must_use]</span>pub fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge" class="fnname">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1019" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
|
||||
operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
|
||||
</div></div><h3 id="impl-StructuralEq" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.StructuralEq.html" title="trait core::marker::StructuralEq">StructuralEq</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-StructuralEq" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-StructuralPartialEq" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.StructuralPartialEq.html" title="trait core::marker::StructuralPartialEq">StructuralPartialEq</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-StructuralPartialEq" class="anchor"></a><a class="srclink" href="../../src/tokio_util/codec/lines_codec.rs.html#11" title="goto source code">[src]</a></h3><div class="impl-items"></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Send" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-Send" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-Sync" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-Unpin" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../tokio_util/codec/struct.LinesCodec.html" title="struct tokio_util::codec::LinesCodec">LinesCodec</a></code><a href="#impl-UnwindSafe" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<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 href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-ToOwned" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code><a href="#impl-ToOwned" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81-93" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Owned" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
|
||||
</div><h4 id="method.to_owned" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&self) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#86" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
|
||||
</div><h4 id="method.clone_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T)</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#90" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
|
||||
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
|
||||
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-2" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-3" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
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
@@ -0,0 +1,8 @@
|
||||
<!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="Module defining an Either type."><meta name="keywords" content="rust, rustlang, rust-lang, either"><title>tokio_util::either - 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 mod"><!--[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">Module either</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#enums">Enums</a></li></ul></div><p class="location"><a href="../index.html">tokio_util</a></p><div id="sidebar-vars" data-name="either" data-ty="mod" data-relpath="../"></div><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="in-band">Module <a href="../index.html">tokio_util</a>::<wbr><a class="mod" href="">either</a></span><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/either.rs.html#1-188" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Module defining an Either type.</p>
|
||||
</div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<table><tr class="module-item"><td><a class="enum" href="enum.Either.html" title="tokio_util::either::Either enum">Either</a></td><td class="docblock-short"><p>Combines two different futures, streams, or sinks having the same associated types into a single type.</p>
|
||||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
initSidebarItems({"enum":[["Either","Combines two different futures, streams, or sinks having the same associated types into a single type."]]});
|
||||
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Utilities for working with Tokio."><meta name="keywords" content="rust, rustlang, rust-lang, tokio_util"><title>tokio_util - 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 mod"><!--[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">Crate tokio_util</p><div class="block version"><p>Version 0.6.4</p></div><div class="sidebar-elems"><a id="all-types" href="all.html"><p>See all tokio_util's items</p></a><div class="block items"><ul><li><a href="#modules">Modules</a></li></ul></div><p class="location"></p><div id="sidebar-vars" data-name="tokio_util" data-ty="mod" data-relpath="../"></div></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="in-band">Crate <a class="mod" href="">tokio_util</a></span><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/lib.rs.html#1-199" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Utilities for working with Tokio.</p>
|
||||
<p>This crate is not versioned in lockstep with the core
|
||||
<a href="https://docs.rs/tokio"><code>tokio</code></a> crate. However, <code>tokio-util</code> <em>will</em> respect Rust’s
|
||||
semantic versioning policy, especially with regard to breaking changes.</p>
|
||||
</div><h2 id="modules" class="section-header"><a href="#modules">Modules</a></h2>
|
||||
<table><tr class="module-item"><td><a class="mod" href="codec/index.html" title="tokio_util::codec mod">codec</a></td><td class="docblock-short"><p>Adaptors from AsyncRead/AsyncWrite to Stream/Sink</p>
|
||||
</td></tr><tr class="module-item"><td><a class="mod" href="either/index.html" title="tokio_util::either mod">either</a></td><td class="docblock-short"><p>Module defining an Either type.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="mod" href="sync/index.html" title="tokio_util::sync mod">sync</a></td><td class="docblock-short"><p>Synchronization primitives</p>
|
||||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="tokio_util"></div>
|
||||
<script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
initSidebarItems({"mod":[["codec","Adaptors from AsyncRead/AsyncWrite to Stream/Sink"],["either","Module defining an Either type."],["sync","Synchronization primitives"]]});
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/sync/struct.CancellationToken.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/sync/struct.CancellationToken.html">../../../tokio_util/sync/struct.CancellationToken.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/sync/struct.CancellationToken.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/sync/struct.WaitForCancellationFuture.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/sync/struct.WaitForCancellationFuture.html">../../../tokio_util/sync/struct.WaitForCancellationFuture.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/sync/struct.WaitForCancellationFuture.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,14 @@
|
||||
<!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="Synchronization primitives"><meta name="keywords" content="rust, rustlang, rust-lang, sync"><title>tokio_util::sync - 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 mod"><!--[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">Module sync</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><p class="location"><a href="../index.html">tokio_util</a></p><div id="sidebar-vars" data-name="sync" data-ty="mod" data-relpath="../"></div><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="in-band">Module <a href="../index.html">tokio_util</a>::<wbr><a class="mod" href="">sync</a></span><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/sync/mod.rs.html#1-15" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Synchronization primitives</p>
|
||||
</div><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<table><tr class="module-item"><td><a class="struct" href="struct.CancellationToken.html" title="tokio_util::sync::CancellationToken struct">CancellationToken</a></td><td class="docblock-short"><p>A token which can be used to signal a cancellation request to one or more
|
||||
tasks.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.PollSemaphore.html" title="tokio_util::sync::PollSemaphore struct">PollSemaphore</a></td><td class="docblock-short"><p>A wrapper around <a href="../../tokio/sync/semaphore/struct.Semaphore.html"><code>Semaphore</code></a> that provides a <code>poll_acquire</code> method.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.PollSender.html" title="tokio_util::sync::PollSender struct">PollSender</a></td><td class="docblock-short"><p>A wrapper around <a href="../../tokio/sync/mpsc/bounded/struct.Sender.html"><code>mpsc::Sender</code></a> that can be polled.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.ReusableBoxFuture.html" title="tokio_util::sync::ReusableBoxFuture struct">ReusableBoxFuture</a></td><td class="docblock-short"><p>A reusable <code>Pin<Box<dyn Future<Output = T> + Send>></code>.</p>
|
||||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.WaitForCancellationFuture.html" title="tokio_util::sync::WaitForCancellationFuture struct">WaitForCancellationFuture</a></td><td class="docblock-short"><p>A Future that is resolved once the corresponding <a href="../../tokio_util/sync/struct.CancellationToken.html" title="CancellationToken"><code>CancellationToken</code></a>
|
||||
was cancelled</p>
|
||||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/sync/struct.PollSender.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/sync/struct.PollSender.html">../../../tokio_util/sync/struct.PollSender.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/sync/struct.PollSender.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/sync/struct.PollSemaphore.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/sync/struct.PollSemaphore.html">../../../tokio_util/sync/struct.PollSemaphore.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/sync/struct.PollSemaphore.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL=../../../tokio_util/sync/struct.ReusableBoxFuture.html">
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="../../../tokio_util/sync/struct.ReusableBoxFuture.html">../../../tokio_util/sync/struct.ReusableBoxFuture.html</a>...</p>
|
||||
<script>location.replace("../../../tokio_util/sync/struct.ReusableBoxFuture.html" + location.search + location.hash);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
initSidebarItems({"struct":[["CancellationToken","A token which can be used to signal a cancellation request to one or more tasks."],["PollSemaphore","A wrapper around `Semaphore` that provides a `poll_acquire` method."],["PollSender","A wrapper around `mpsc::Sender` that can be polled."],["ReusableBoxFuture","A reusable `Pin<Box<dyn Future<Output = T> + Send>>`."],["WaitForCancellationFuture","A Future that is resolved once the corresponding [`CancellationToken`] was cancelled"]]});
|
||||
@@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A token which can be used to signal a cancellation request to one or more tasks."><meta name="keywords" content="rust, rustlang, rust-lang, CancellationToken"><title>tokio_util::sync::CancellationToken - 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 struct"><!--[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">Struct CancellationToken</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.cancel">cancel</a><a href="#method.cancelled">cancelled</a><a href="#method.child_token">child_token</a><a href="#method.is_cancelled">is_cancelled</a><a href="#method.new">new</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-Default">Default</a><a href="#impl-Drop">Drop</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class="location"><a href="../index.html">tokio_util</a>::<wbr><a href="index.html">sync</a></p><div id="sidebar-vars" data-name="CancellationToken" data-ty="struct" data-relpath=""></div><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="in-band">Struct <a href="../index.html">tokio_util</a>::<wbr><a href="index.html">sync</a>::<wbr><a class="struct" href="">CancellationToken</a></span><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/sync/cancellation_token.rs.html#54-56" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct CancellationToken { /* fields omitted */ }</pre></div><div class="docblock"><p>A token which can be used to signal a cancellation request to one or more
|
||||
tasks.</p>
|
||||
<p>Tasks can call <a href="../../tokio_util/sync/struct.CancellationToken.html#method.cancelled" title="CancellationToken::cancelled()"><code>CancellationToken::cancelled()</code></a> in order to
|
||||
obtain a Future which will be resolved when cancellation is requested.</p>
|
||||
<p>Cancellation can be requested through the <a href="../../tokio_util/sync/struct.CancellationToken.html#method.cancel" title="CancellationToken::cancel"><code>CancellationToken::cancel</code></a> method.</p>
|
||||
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
||||
<div class='information'><div class='tooltip ignore'>ⓘ</div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
|
||||
<span class="kw">use</span> <span class="ident">tokio</span>::<span class="ident">select</span>;
|
||||
<span class="kw">use</span> <span class="ident">tokio</span>::<span class="ident">scope</span>::<span class="ident">CancellationToken</span>;
|
||||
|
||||
<span class="attribute">#[<span class="ident">tokio</span>::<span class="ident">main</span>]</span>
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">main</span>() {
|
||||
<span class="kw">let</span> <span class="ident">token</span> <span class="op">=</span> <span class="ident">CancellationToken</span>::<span class="ident">new</span>();
|
||||
<span class="kw">let</span> <span class="ident">cloned_token</span> <span class="op">=</span> <span class="ident">token</span>.<span class="ident">clone</span>();
|
||||
|
||||
<span class="kw">let</span> <span class="ident">join_handle</span> <span class="op">=</span> <span class="ident">tokio</span>::<span class="ident">spawn</span>(<span class="kw">async</span> <span class="kw">move</span> {
|
||||
<span class="comment">// Wait for either cancellation or a very long time</span>
|
||||
<span class="macro">select</span><span class="macro">!</span> {
|
||||
<span class="kw">_</span> <span class="op">=</span> <span class="ident">cloned_token</span>.<span class="ident">cancelled</span>() <span class="op">=</span><span class="op">></span> {
|
||||
<span class="comment">// The token was cancelled</span>
|
||||
<span class="number">5</span>
|
||||
}
|
||||
<span class="kw">_</span> <span class="op">=</span> <span class="ident">tokio</span>::<span class="ident">time</span>::<span class="ident">sleep</span>(<span class="ident">std</span>::<span class="ident">time</span>::<span class="ident">Duration</span>::<span class="ident">from_secs</span>(<span class="number">9999</span>)) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="number">99</span>
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
<span class="ident">tokio</span>::<span class="ident">spawn</span>(<span class="kw">async</span> <span class="kw">move</span> {
|
||||
<span class="ident">tokio</span>::<span class="ident">time</span>::<span class="ident">sleep</span>(<span class="ident">std</span>::<span class="ident">time</span>::<span class="ident">Duration</span>::<span class="ident">from_millis</span>(<span class="number">10</span>)).<span class="kw">await</span>;
|
||||
<span class="ident">token</span>.<span class="ident">cancel</span>();
|
||||
});
|
||||
|
||||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">5</span>, <span class="ident">join_handle</span>.<span class="kw">await</span>.<span class="ident">unwrap</span>());
|
||||
}</pre></div>
|
||||
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="../../tokio_util/sync/struct.CancellationToken.html" title="struct tokio_util::sync::CancellationToken">CancellationToken</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#138-297" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>() -> <a class="struct" href="../../tokio_util/sync/struct.CancellationToken.html" title="struct tokio_util::sync::CancellationToken">CancellationToken</a></code><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#140-155" title="goto source code">[src]</a></h4><div class="docblock"><p>Creates a new CancellationToken in the non-cancelled state.</p>
|
||||
</div><h4 id="method.child_token" class="method"><code>pub fn <a href="#method.child_token" class="fnname">child_token</a>(&self) -> <a class="struct" href="../../tokio_util/sync/struct.CancellationToken.html" title="struct tokio_util::sync::CancellationToken">CancellationToken</a></code><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#202-254" title="goto source code">[src]</a></h4><div class="docblock"><p>Creates a <code>CancellationToken</code> which will get cancelled whenever the
|
||||
current token gets cancelled.</p>
|
||||
<p>If the current token is already cancelled, the child token will get
|
||||
returned in cancelled state.</p>
|
||||
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
|
||||
<div class='information'><div class='tooltip ignore'>ⓘ</div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore">
|
||||
<span class="kw">use</span> <span class="ident">tokio</span>::<span class="ident">select</span>;
|
||||
<span class="kw">use</span> <span class="ident">tokio</span>::<span class="ident">scope</span>::<span class="ident">CancellationToken</span>;
|
||||
|
||||
<span class="attribute">#[<span class="ident">tokio</span>::<span class="ident">main</span>]</span>
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">main</span>() {
|
||||
<span class="kw">let</span> <span class="ident">token</span> <span class="op">=</span> <span class="ident">CancellationToken</span>::<span class="ident">new</span>();
|
||||
<span class="kw">let</span> <span class="ident">child_token</span> <span class="op">=</span> <span class="ident">token</span>.<span class="ident">child_token</span>();
|
||||
|
||||
<span class="kw">let</span> <span class="ident">join_handle</span> <span class="op">=</span> <span class="ident">tokio</span>::<span class="ident">spawn</span>(<span class="kw">async</span> <span class="kw">move</span> {
|
||||
<span class="comment">// Wait for either cancellation or a very long time</span>
|
||||
<span class="macro">select</span><span class="macro">!</span> {
|
||||
<span class="kw">_</span> <span class="op">=</span> <span class="ident">child_token</span>.<span class="ident">cancelled</span>() <span class="op">=</span><span class="op">></span> {
|
||||
<span class="comment">// The token was cancelled</span>
|
||||
<span class="number">5</span>
|
||||
}
|
||||
<span class="kw">_</span> <span class="op">=</span> <span class="ident">tokio</span>::<span class="ident">time</span>::<span class="ident">sleep</span>(<span class="ident">std</span>::<span class="ident">time</span>::<span class="ident">Duration</span>::<span class="ident">from_secs</span>(<span class="number">9999</span>)) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="number">99</span>
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
<span class="ident">tokio</span>::<span class="ident">spawn</span>(<span class="kw">async</span> <span class="kw">move</span> {
|
||||
<span class="ident">tokio</span>::<span class="ident">time</span>::<span class="ident">sleep</span>(<span class="ident">std</span>::<span class="ident">time</span>::<span class="ident">Duration</span>::<span class="ident">from_millis</span>(<span class="number">10</span>)).<span class="kw">await</span>;
|
||||
<span class="ident">token</span>.<span class="ident">cancel</span>();
|
||||
});
|
||||
|
||||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="number">5</span>, <span class="ident">join_handle</span>.<span class="kw">await</span>.<span class="ident">unwrap</span>());
|
||||
}</pre></div>
|
||||
</div><h4 id="method.cancel" class="method"><code>pub fn <a href="#method.cancel" class="fnname">cancel</a>(&self)</code><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#260-262" title="goto source code">[src]</a></h4><div class="docblock"><p>Cancel the <a href="../../tokio_util/sync/struct.CancellationToken.html" title="CancellationToken"><code>CancellationToken</code></a> and all child tokens which had been
|
||||
derived from it.</p>
|
||||
<p>This will wake up all tasks which are waiting for cancellation.</p>
|
||||
</div><h4 id="method.is_cancelled" class="method"><code>pub fn <a href="#method.is_cancelled" class="fnname">is_cancelled</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#265-267" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns <code>true</code> if the <code>CancellationToken</code> had been cancelled</p>
|
||||
</div><h4 id="method.cancelled" class="method"><code>pub fn <a href="#method.cancelled" class="fnname">cancelled</a>(&self) -> <a class="struct" href="../../tokio_util/sync/struct.WaitForCancellationFuture.html" title="struct tokio_util::sync::WaitForCancellationFuture">WaitForCancellationFuture</a><'_><span class="notable-traits"><span class="notable-traits-tooltip">ⓘ<div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../../tokio_util/sync/struct.WaitForCancellationFuture.html" title="struct tokio_util::sync::WaitForCancellationFuture">WaitForCancellationFuture</a><'a></h3><code class="content"><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a> for <a class="struct" href="../../tokio_util/sync/struct.WaitForCancellationFuture.html" title="struct tokio_util::sync::WaitForCancellationFuture">WaitForCancellationFuture</a><'a></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" class="type">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>;</span></code></span></div></span></span></code><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#270-276" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns a <code>Future</code> that gets fulfilled when cancellation is requested.</p>
|
||||
</div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Clone" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../tokio_util/sync/struct.CancellationToken.html" title="struct tokio_util::sync::CancellationToken">CancellationToken</a></code><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#90-102" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.clone" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&self) -> Self</code><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#91-101" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
|
||||
</div><h4 id="method.clone_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self)</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#128" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
||||
</div></div><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../tokio_util/sync/struct.CancellationToken.html" title="struct tokio_util::sync::CancellationToken">CancellationToken</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#82-88" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#83-87" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Default" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="../../tokio_util/sync/struct.CancellationToken.html" title="struct tokio_util::sync::CancellationToken">CancellationToken</a></code><a href="#impl-Default" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#132-136" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.default" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fnname">default</a>() -> <a class="struct" href="../../tokio_util/sync/struct.CancellationToken.html" title="struct tokio_util::sync::CancellationToken">CancellationToken</a></code><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#133-135" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></p>
|
||||
</div></div><h3 id="impl-Drop" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="../../tokio_util/sync/struct.CancellationToken.html" title="struct tokio_util::sync::CancellationToken">CancellationToken</a></code><a href="#impl-Drop" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#104-130" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.drop" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop" class="fnname">drop</a>(&mut self)</code><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#105-129" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Executes the destructor for this type. <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></p>
|
||||
</div></div><h3 id="impl-Send" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../tokio_util/sync/struct.CancellationToken.html" title="struct tokio_util::sync::CancellationToken">CancellationToken</a></code><a href="#impl-Send" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#60" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../tokio_util/sync/struct.CancellationToken.html" title="struct tokio_util::sync::CancellationToken">CancellationToken</a></code><a href="#impl-Sync" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#61" title="goto source code">[src]</a></h3><div class="impl-items"></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../tokio_util/sync/struct.CancellationToken.html" title="struct tokio_util::sync::CancellationToken">CancellationToken</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../tokio_util/sync/struct.CancellationToken.html" title="struct tokio_util::sync::CancellationToken">CancellationToken</a></code><a href="#impl-Unpin" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../tokio_util/sync/struct.CancellationToken.html" title="struct tokio_util::sync::CancellationToken">CancellationToken</a></code><a href="#impl-UnwindSafe" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<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 href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-ToOwned" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code><a href="#impl-ToOwned" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81-93" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Owned" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
|
||||
</div><h4 id="method.to_owned" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&self) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#86" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
|
||||
</div><h4 id="method.clone_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T)</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#90" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
|
||||
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
|
||||
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A wrapper around `Semaphore` that provides a `poll_acquire` method."><meta name="keywords" content="rust, rustlang, rust-lang, PollSemaphore"><title>tokio_util::sync::PollSemaphore - 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 struct"><!--[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">Struct PollSemaphore</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.clone_inner">clone_inner</a><a href="#method.close">close</a><a href="#method.into_inner">into_inner</a><a href="#method.new">new</a><a href="#method.poll_acquire">poll_acquire</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-Stream">Stream</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class="location"><a href="../index.html">tokio_util</a>::<wbr><a href="index.html">sync</a></p><div id="sidebar-vars" data-name="PollSemaphore" data-ty="struct" data-relpath=""></div><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="in-band">Struct <a href="../index.html">tokio_util</a>::<wbr><a href="index.html">sync</a>::<wbr><a class="struct" href="">PollSemaphore</a></span><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/sync/poll_semaphore.rs.html#13-16" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct PollSemaphore { /* fields omitted */ }</pre></div><div class="docblock"><p>A wrapper around <a href="../../tokio/sync/semaphore/struct.Semaphore.html"><code>Semaphore</code></a> that provides a <code>poll_acquire</code> method.</p>
|
||||
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="../../tokio_util/sync/struct.PollSemaphore.html" title="struct tokio_util::sync::PollSemaphore">PollSemaphore</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/poll_semaphore.rs.html#18-68" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>(semaphore: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><<a class="struct" href="../../tokio/sync/semaphore/struct.Semaphore.html" title="struct tokio::sync::semaphore::Semaphore">Semaphore</a>>) -> Self</code><a class="srclink" href="../../src/tokio_util/sync/poll_semaphore.rs.html#20-27" title="goto source code">[src]</a></h4><div class="docblock"><p>Create a new <code>PollSemaphore</code>.</p>
|
||||
</div><h4 id="method.close" class="method"><code>pub fn <a href="#method.close" class="fnname">close</a>(&self)</code><a class="srclink" href="../../src/tokio_util/sync/poll_semaphore.rs.html#30-32" title="goto source code">[src]</a></h4><div class="docblock"><p>Closes the semaphore.</p>
|
||||
</div><h4 id="method.clone_inner" class="method"><code>pub fn <a href="#method.clone_inner" class="fnname">clone_inner</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><<a class="struct" href="../../tokio/sync/semaphore/struct.Semaphore.html" title="struct tokio::sync::semaphore::Semaphore">Semaphore</a>></code><a class="srclink" href="../../src/tokio_util/sync/poll_semaphore.rs.html#35-37" title="goto source code">[src]</a></h4><div class="docblock"><p>Obtain a clone of the inner semaphore.</p>
|
||||
</div><h4 id="method.into_inner" class="method"><code>pub fn <a href="#method.into_inner" class="fnname">into_inner</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><<a class="struct" href="../../tokio/sync/semaphore/struct.Semaphore.html" title="struct tokio::sync::semaphore::Semaphore">Semaphore</a>></code><a class="srclink" href="../../src/tokio_util/sync/poll_semaphore.rs.html#40-42" title="goto source code">[src]</a></h4><div class="docblock"><p>Get back the inner semaphore.</p>
|
||||
</div><h4 id="method.poll_acquire" class="method"><code>pub fn <a href="#method.poll_acquire" class="fnname">poll_acquire</a>(<br> &mut self, <br> cx: &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><'_><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</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="../../tokio/sync/semaphore/struct.OwnedSemaphorePermit.html" title="struct tokio::sync::semaphore::OwnedSemaphorePermit">OwnedSemaphorePermit</a>>></code><a class="srclink" href="../../src/tokio_util/sync/poll_semaphore.rs.html#57-67" title="goto source code">[src]</a></h4><div class="docblock"><p>Poll to acquire a permit from the semaphore.</p>
|
||||
<p>This can return the following values:</p>
|
||||
<ul>
|
||||
<li><code>Poll::Pending</code> if a permit is not currently available.</li>
|
||||
<li><code>Poll::Ready(Some(permit))</code> if a permit was acquired.</li>
|
||||
<li><code>Poll::Ready(None)</code> if the semaphore has been closed.</li>
|
||||
</ul>
|
||||
<p>When this method returns <code>Poll::Pending</code>, the current task is scheduled
|
||||
to receive a wakeup when a permit becomes available, or when the
|
||||
semaphore is closed. Note that on multiple calls to <code>poll_acquire</code>, only
|
||||
the <code>Waker</code> from the <code>Context</code> passed to the most recent call is
|
||||
scheduled to receive a wakeup.</p>
|
||||
</div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Clone" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSemaphore.html" title="struct tokio_util::sync::PollSemaphore">PollSemaphore</a></code><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/poll_semaphore.rs.html#78-82" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.clone" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&self) -> <a class="struct" href="../../tokio_util/sync/struct.PollSemaphore.html" title="struct tokio_util::sync::PollSemaphore">PollSemaphore</a></code><a class="srclink" href="../../src/tokio_util/sync/poll_semaphore.rs.html#79-81" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
|
||||
</div><h4 id="method.clone_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self)</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#128" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
||||
</div></div><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSemaphore.html" title="struct tokio_util::sync::PollSemaphore">PollSemaphore</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/poll_semaphore.rs.html#84-90" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../src/tokio_util/sync/poll_semaphore.rs.html#85-89" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Stream" class="impl"><code class="in-band">impl <a class="trait" href="../../futures_core/stream/trait.Stream.html" title="trait futures_core::stream::Stream">Stream</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSemaphore.html" title="struct tokio_util::sync::PollSemaphore">PollSemaphore</a></code><a href="#impl-Stream" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/poll_semaphore.rs.html#70-76" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Item" class="type"><code>type <a href="../../futures_core/stream/trait.Stream.html#associatedtype.Item" class="type">Item</a> = <a class="struct" href="../../tokio/sync/semaphore/struct.OwnedSemaphorePermit.html" title="struct tokio::sync::semaphore::OwnedSemaphorePermit">OwnedSemaphorePermit</a></code></h4><div class='docblock'><p>Values yielded by the stream.</p>
|
||||
</div><h4 id="method.poll_next" class="method hidden"><code>fn <a href="../../futures_core/stream/trait.Stream.html#tymethod.poll_next" class="fnname">poll_next</a>(<br> self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self>, <br> cx: &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><'_><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</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="../../tokio/sync/semaphore/struct.OwnedSemaphorePermit.html" title="struct tokio::sync::semaphore::OwnedSemaphorePermit">OwnedSemaphorePermit</a>>></code><a class="srclink" href="../../src/tokio_util/sync/poll_semaphore.rs.html#73-75" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Attempt to pull out the next value of this stream, registering the
|
||||
current task for wakeup if the value is not yet available, and returning
|
||||
<code>None</code> if the stream is exhausted. <a href="../../futures_core/stream/trait.Stream.html#tymethod.poll_next">Read more</a></p>
|
||||
</div><h4 id="method.size_hint" class="method hidden"><code>pub fn <a href="../../futures_core/stream/trait.Stream.html#method.size_hint" class="fnname">size_hint</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a class="srclink" href="../../src/futures_core/stream.rs.html#98" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns the bounds on the remaining length of the stream. <a href="../../futures_core/stream/trait.Stream.html#method.size_hint">Read more</a></p>
|
||||
</div></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSemaphore.html" title="struct tokio_util::sync::PollSemaphore">PollSemaphore</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Send" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSemaphore.html" title="struct tokio_util::sync::PollSemaphore">PollSemaphore</a></code><a href="#impl-Send" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSemaphore.html" title="struct tokio_util::sync::PollSemaphore">PollSemaphore</a></code><a href="#impl-Sync" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSemaphore.html" title="struct tokio_util::sync::PollSemaphore">PollSemaphore</a></code><a href="#impl-Unpin" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSemaphore.html" title="struct tokio_util::sync::PollSemaphore">PollSemaphore</a></code><a href="#impl-UnwindSafe" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<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 href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-ToOwned" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code><a href="#impl-ToOwned" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81-93" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Owned" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
|
||||
</div><h4 id="method.to_owned" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&self) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#86" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
|
||||
</div><h4 id="method.clone_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T)</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#90" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
|
||||
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
|
||||
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A wrapper around `mpsc::Sender` that can be polled."><meta name="keywords" content="rust, rustlang, rust-lang, PollSender"><title>tokio_util::sync::PollSender - 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 struct"><!--[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">Struct PollSender</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.abort_send">abort_send</a><a href="#method.clone_inner">clone_inner</a><a href="#method.close_this_sender">close_this_sender</a><a href="#method.inner_ref">inner_ref</a><a href="#method.is_closed">is_closed</a><a href="#method.is_ready">is_ready</a><a href="#method.new">new</a><a href="#method.poll_send_done">poll_send_done</a><a href="#method.start_send">start_send</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-Sink%3CT%3E">Sink<T></a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class="location"><a href="../index.html">tokio_util</a>::<wbr><a href="index.html">sync</a></p><div id="sidebar-vars" data-name="PollSender" data-ty="struct" data-relpath=""></div><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="in-band">Struct <a href="../index.html">tokio_util</a>::<wbr><a href="index.html">sync</a>::<wbr><a class="struct" href="">PollSender</a></span><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/sync/mpsc.rs.html#18-23" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct PollSender<T> { /* fields omitted */ }</pre></div><div class="docblock"><p>A wrapper around <a href="../../tokio/sync/mpsc/bounded/struct.Sender.html"><code>mpsc::Sender</code></a> that can be polled.</p>
|
||||
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl<T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static> <a class="struct" href="../../tokio_util/sync/struct.PollSender.html" title="struct tokio_util::sync::PollSender">PollSender</a><T></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#37-171" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>(sender: <a class="struct" href="../../tokio/sync/mpsc/bounded/struct.Sender.html" title="struct tokio::sync::mpsc::bounded::Sender">Sender</a><T>) -> Self</code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#39-45" title="goto source code">[src]</a></h4><div class="docblock"><p>Create a new <code>PollSender</code>.</p>
|
||||
</div><h4 id="method.start_send" class="method"><code>pub fn <a href="#method.start_send" class="fnname">start_send</a>(&mut self, value: T) -> <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>, <a class="struct" href="../../tokio/sync/mpsc/error/struct.SendError.html" title="struct tokio::sync::mpsc::error::SendError">SendError</a><T>></code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#57-69" title="goto source code">[src]</a></h4><div class="docblock"><p>Start sending a new item.</p>
|
||||
<p>This method panics if a send is currently in progress. To ensure that no
|
||||
send is in progress, call <code>poll_send_done</code> first until it returns
|
||||
<code>Poll::Ready</code>.</p>
|
||||
<p>If this method returns an error, that indicates that the channel is
|
||||
closed. Note that this method is not guaranteed to return an error if
|
||||
the channel is closed, but in that case the error would be reported by
|
||||
the first call to <code>poll_send_done</code>.</p>
|
||||
</div><h4 id="method.poll_send_done" class="method"><code>pub fn <a href="#method.poll_send_done" class="fnname">poll_send_done</a>(<br> &mut self, <br> cx: &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><'_><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="../../tokio/sync/mpsc/error/struct.SendError.html" title="struct tokio::sync::mpsc::error::SendError">SendError</a><T>>></code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#91-104" title="goto source code">[src]</a></h4><div class="docblock"><p>If a send is in progress, poll for its completion. If no send is in progress,
|
||||
this method returns <code>Poll::Ready(Ok(()))</code>.</p>
|
||||
<p>This method can return the following values:</p>
|
||||
<ul>
|
||||
<li><code>Poll::Ready(Ok(()))</code> if the in-progress send has been completed, or there is
|
||||
no send in progress (even if the channel is closed).</li>
|
||||
<li><code>Poll::Ready(Err(err))</code> if the in-progress send failed because the channel has
|
||||
been closed.</li>
|
||||
<li><code>Poll::Pending</code> if a send is in progress, but it could not complete now.</li>
|
||||
</ul>
|
||||
<p>When this method returns <code>Poll::Pending</code>, the current task is scheduled
|
||||
to receive a wakeup when the message is sent, or when the entire channel
|
||||
is closed (but not if just this sender is closed by
|
||||
<code>close_this_sender</code>). Note that on multiple calls to <code>poll_send_done</code>,
|
||||
only the <code>Waker</code> from the <code>Context</code> passed to the most recent call is
|
||||
scheduled to receive a wakeup.</p>
|
||||
<p>If this method returns <code>Poll::Ready</code>, then <code>start_send</code> is guaranteed to
|
||||
not panic.</p>
|
||||
</div><h4 id="method.is_ready" class="method"><code>pub fn <a href="#method.is_ready" class="fnname">is_ready</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#112-114" title="goto source code">[src]</a></h4><div class="docblock"><p>Check whether the channel is ready to send more messages now.</p>
|
||||
<p>If this method returns <code>true</code>, then <code>start_send</code> is guaranteed to not
|
||||
panic.</p>
|
||||
<p>If the channel is closed, this method returns <code>true</code>.</p>
|
||||
</div><h4 id="method.is_closed" class="method"><code>pub fn <a href="#method.is_closed" class="fnname">is_closed</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#117-122" title="goto source code">[src]</a></h4><div class="docblock"><p>Check whether the channel has been closed.</p>
|
||||
</div><h4 id="method.clone_inner" class="method"><code>pub fn <a href="#method.clone_inner" class="fnname">clone_inner</a>(&self) -> <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="../../tokio/sync/mpsc/bounded/struct.Sender.html" title="struct tokio::sync::mpsc::bounded::Sender">Sender</a><T>></code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#128-133" title="goto source code">[src]</a></h4><div class="docblock"><p>Clone the underlying <code>Sender</code>.</p>
|
||||
<p>If this method returns <code>None</code>, then the channel is closed. (But it is
|
||||
not guaranteed to return <code>None</code> if the channel is closed.)</p>
|
||||
</div><h4 id="method.inner_ref" class="method"><code>pub fn <a href="#method.inner_ref" class="fnname">inner_ref</a>(&self) -> <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="../../tokio/sync/mpsc/bounded/struct.Sender.html" title="struct tokio::sync::mpsc::bounded::Sender">Sender</a><T>></code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#139-141" title="goto source code">[src]</a></h4><div class="docblock"><p>Access the underlying <code>Sender</code>.</p>
|
||||
<p>If this method returns <code>None</code>, then the channel is closed. (But it is
|
||||
not guaranteed to return <code>None</code> if the channel is closed.)</p>
|
||||
</div><h4 id="method.close_this_sender" class="method"><code>pub fn <a href="#method.close_this_sender" class="fnname">close_this_sender</a>(&mut self)</code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#155-157" title="goto source code">[src]</a></h4><div class="docblock"><p>Close this sender. No more messages can be sent from this sender.</p>
|
||||
<p>Note that this only closes the channel from the view-point of this
|
||||
sender. The channel remains open until all senders have gone away, or
|
||||
until the <a href="../../tokio/sync/mpsc/bounded/struct.Receiver.html"><code>Receiver</code></a> closes the channel.</p>
|
||||
<p>If there is a send in progress when this method is called, that send is
|
||||
unaffected by this operation, and <code>poll_send_done</code> can still be called
|
||||
to complete that send.</p>
|
||||
</div><h4 id="method.abort_send" class="method"><code>pub fn <a href="#method.abort_send" class="fnname">abort_send</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#162-170" title="goto source code">[src]</a></h4><div class="docblock"><p>Abort the current in-progress send, if any.</p>
|
||||
<p>Returns <code>true</code> if a send was aborted.</p>
|
||||
</div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Clone" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSender.html" title="struct tokio_util::sync::PollSender">PollSender</a><T></code><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#173-183" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.clone" class="method"><code>fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&self) -> <a class="struct" href="../../tokio_util/sync/struct.PollSender.html" title="struct tokio_util::sync::PollSender">PollSender</a><T></code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#176-182" title="goto source code">[src]</a></h4><div class="docblock"><p>Clones this <code>PollSender</code>. The resulting clone will not have any
|
||||
in-progress send operations, even if the current <code>PollSender</code> does.</p>
|
||||
</div><h4 id="method.clone_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self)</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#128" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
||||
</div></div><h3 id="impl-Debug" class="impl"><code class="in-band">impl<T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>> <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSender.html" title="struct tokio_util::sync::PollSender">PollSender</a><T></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#17" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#17" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Sink%3CT%3E" class="impl"><code class="in-band">impl<T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static> <a class="trait" href="../../futures_sink/trait.Sink.html" title="trait futures_sink::Sink">Sink</a><T> for <a class="struct" href="../../tokio_util/sync/struct.PollSender.html" title="struct tokio_util::sync::PollSender">PollSender</a><T></code><a href="#impl-Sink%3CT%3E" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#185-224" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="../../futures_sink/trait.Sink.html#associatedtype.Error" class="type">Error</a> = <a class="struct" href="../../tokio/sync/mpsc/error/struct.SendError.html" title="struct tokio::sync::mpsc::error::SendError">SendError</a><T></code></h4><div class='docblock'><p>The type of value produced by the sink when an error occurs.</p>
|
||||
</div><h4 id="method.poll_ready" class="method"><code>fn <a href="../../futures_sink/trait.Sink.html#tymethod.poll_ready" class="fnname">poll_ready</a>(<br> self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self>, <br> cx: &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><'_><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../../futures_sink/trait.Sink.html#associatedtype.Error" title="type futures_sink::Sink::Error">Error</a>>></code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#191-193" title="goto source code">[src]</a></h4><div class="docblock"><p>This is equivalent to calling <a href="../../tokio_util/sync/struct.PollSender.html#method.poll_send_done"><code>poll_send_done</code></a>.</p>
|
||||
</div><h4 id="method.poll_flush" class="method"><code>fn <a href="../../futures_sink/trait.Sink.html#tymethod.poll_flush" class="fnname">poll_flush</a>(<br> self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self>, <br> cx: &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><'_><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../../futures_sink/trait.Sink.html#associatedtype.Error" title="type futures_sink::Sink::Error">Error</a>>></code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#198-200" title="goto source code">[src]</a></h4><div class="docblock"><p>This is equivalent to calling <a href="../../tokio_util/sync/struct.PollSender.html#method.poll_send_done"><code>poll_send_done</code></a>.</p>
|
||||
</div><h4 id="method.start_send-1" class="method"><code>fn <a href="../../futures_sink/trait.Sink.html#tymethod.start_send" class="fnname">start_send</a>(self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self>, item: T) -> <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="type" href="../../futures_sink/trait.Sink.html#associatedtype.Error" title="type futures_sink::Sink::Error">Error</a>></code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#205-207" title="goto source code">[src]</a></h4><div class="docblock"><p>This is equivalent to calling <a href="../../tokio_util/sync/struct.PollSender.html#method.start_send"><code>start_send</code></a>.</p>
|
||||
</div><h4 id="method.poll_close" class="method"><code>fn <a href="../../futures_sink/trait.Sink.html#tymethod.poll_close" class="fnname">poll_close</a>(<br> self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self>, <br> cx: &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><'_><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Self::<a class="type" href="../../futures_sink/trait.Sink.html#associatedtype.Error" title="type futures_sink::Sink::Error">Error</a>>></code><a class="srclink" href="../../src/tokio_util/sync/mpsc.rs.html#218-223" title="goto source code">[src]</a></h4><div class="docblock"><p>This method will first flush the <code>PollSender</code>, and then close it by
|
||||
calling <a href="../../tokio_util/sync/struct.PollSender.html#method.close_this_sender"><code>close_this_sender</code></a>.</p>
|
||||
<p>If a send fails while flushing because the <a href="../../tokio/sync/mpsc/bounded/struct.Receiver.html"><code>Receiver</code></a> has gone away,
|
||||
then this function returns an error. The channel is still successfully
|
||||
closed in this situation.</p>
|
||||
</div></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl<T> !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSender.html" title="struct tokio_util::sync::PollSender">PollSender</a><T></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Send" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSender.html" title="struct tokio_util::sync::PollSender">PollSender</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>, </span></code><a href="#impl-Send" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSender.html" title="struct tokio_util::sync::PollSender">PollSender</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>, </span></code><a href="#impl-Sync" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSender.html" title="struct tokio_util::sync::PollSender">PollSender</a><T></code><a href="#impl-Unpin" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl<T> !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../tokio_util/sync/struct.PollSender.html" title="struct tokio_util::sync::PollSender">PollSender</a><T></code><a href="#impl-UnwindSafe" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<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 href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-ToOwned" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></code><a href="#impl-ToOwned" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#81-93" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Owned" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="type">Owned</a> = T</code></h4><div class='docblock'><p>The resulting type after obtaining ownership.</p>
|
||||
</div><h4 id="method.to_owned" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&self) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#86" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
|
||||
</div><h4 id="method.clone_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T)</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#90" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
|
||||
</details></div></div><div class='docblock hidden'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
|
||||
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-2" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A reusable `Pin<Box<dyn Future<Output = T> + Send>>`."><meta name="keywords" content="rust, rustlang, rust-lang, ReusableBoxFuture"><title>tokio_util::sync::ReusableBoxFuture - 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 struct"><!--[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">Struct ReusableBoxFuture</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.get_pin">get_pin</a><a href="#method.new">new</a><a href="#method.poll">poll</a><a href="#method.set">set</a><a href="#method.try_set">try_set</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Drop">Drop</a><a href="#impl-Future">Future</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-IntoFuture">IntoFuture</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryFuture">TryFuture</a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class="location"><a href="../index.html">tokio_util</a>::<wbr><a href="index.html">sync</a></p><div id="sidebar-vars" data-name="ReusableBoxFuture" data-ty="struct" data-relpath=""></div><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="in-band">Struct <a href="../index.html">tokio_util</a>::<wbr><a href="index.html">sync</a>::<wbr><a class="struct" href="">ReusableBoxFuture</a></span><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/sync/reusable_box.rs.html#13-15" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct ReusableBoxFuture<T> { /* fields omitted */ }</pre></div><div class="docblock"><p>A reusable <code>Pin<Box<dyn Future<Output = T> + Send>></code>.</p>
|
||||
<p>This type lets you replace the future stored in the box without
|
||||
reallocating when the size and alignment permits this.</p>
|
||||
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl<T> <a class="struct" href="../../tokio_util/sync/struct.ReusableBoxFuture.html" title="struct tokio_util::sync::ReusableBoxFuture">ReusableBoxFuture</a><T></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#17-117" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a><F>(future: F) -> Self <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = T> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static, </span></code><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#19-31" title="goto source code">[src]</a></h4><div class="docblock"><p>Create a new <code>ReusableBoxFuture<T></code> containing the provided future.</p>
|
||||
</div><h4 id="method.set" class="method"><code>pub fn <a href="#method.set" class="fnname">set</a><F>(&mut self, future: F) <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = T> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static, </span></code><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#37-44" title="goto source code">[src]</a></h4><div class="docblock"><p>Replace the future currently stored in this box.</p>
|
||||
<p>This reallocates if and only if the layout of the provided future is
|
||||
different from the layout of the currently stored future.</p>
|
||||
</div><h4 id="method.try_set" class="method"><code>pub fn <a href="#method.try_set" class="fnname">try_set</a><F>(&mut self, future: F) -> <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>, F> <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = T> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static, </span></code><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#51-71" title="goto source code">[src]</a></h4><div class="docblock"><p>Replace the future currently stored in this box.</p>
|
||||
<p>This function never reallocates, but returns an error if the provided
|
||||
future has a different size or alignment from the currently stored
|
||||
future.</p>
|
||||
</div><h4 id="method.get_pin" class="method"><code>pub fn <a href="#method.get_pin" class="fnname">get_pin</a>(&mut self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><&mut (dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = T> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>)></code><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#107-111" title="goto source code">[src]</a></h4><div class="docblock"><p>Get a pinned reference to the underlying future.</p>
|
||||
</div><h4 id="method.poll" class="method"><code>pub fn <a href="#method.poll" class="fnname">poll</a>(&mut self, cx: &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><'_>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><T></code><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#114-116" title="goto source code">[src]</a></h4><div class="docblock"><p>Poll the future stored inside this box.</p>
|
||||
</div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Debug" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../tokio_util/sync/struct.ReusableBoxFuture.html" title="struct tokio_util::sync::ReusableBoxFuture">ReusableBoxFuture</a><T></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#147-151" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#148-150" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Drop" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="../../tokio_util/sync/struct.ReusableBoxFuture.html" title="struct tokio_util::sync::ReusableBoxFuture">ReusableBoxFuture</a><T></code><a href="#impl-Drop" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#139-145" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.drop" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop" class="fnname">drop</a>(&mut self)</code><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#140-144" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Executes the destructor for this type. <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></p>
|
||||
</div></div><h3 id="impl-Future" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a> for <a class="struct" href="../../tokio_util/sync/struct.ReusableBoxFuture.html" title="struct tokio_util::sync::ReusableBoxFuture">ReusableBoxFuture</a><T></code><a href="#impl-Future" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#119-126" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Output" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" class="type">Output</a> = T</code></h4><div class='docblock'><p>The type of value produced on completion.</p>
|
||||
</div><h4 id="method.poll-1" class="method"><code>fn <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#tymethod.poll" class="fnname">poll</a>(self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self>, cx: &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><'_>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><T></code><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#123-125" title="goto source code">[src]</a></h4><div class="docblock"><p>Poll the future stored inside this box.</p>
|
||||
</div></div><h3 id="impl-Send" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../tokio_util/sync/struct.ReusableBoxFuture.html" title="struct tokio_util::sync::ReusableBoxFuture">ReusableBoxFuture</a><T></code><a href="#impl-Send" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#129" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../tokio_util/sync/struct.ReusableBoxFuture.html" title="struct tokio_util::sync::ReusableBoxFuture">ReusableBoxFuture</a><T></code><a href="#impl-Sync" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#134" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../tokio_util/sync/struct.ReusableBoxFuture.html" title="struct tokio_util::sync::ReusableBoxFuture">ReusableBoxFuture</a><T></code><a href="#impl-Unpin" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/reusable_box.rs.html#137" title="goto source code">[src]</a></h3><div class="impl-items"></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl<T> !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../tokio_util/sync/struct.ReusableBoxFuture.html" title="struct tokio_util::sync::ReusableBoxFuture">ReusableBoxFuture</a><T></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl<T> !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../tokio_util/sync/struct.ReusableBoxFuture.html" title="struct tokio_util::sync::ReusableBoxFuture">ReusableBoxFuture</a><T></code><a href="#impl-UnwindSafe" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<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 href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-IntoFuture" class="impl"><code class="in-band">impl<F> <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html" title="trait core::future::into_future::IntoFuture">IntoFuture</a> for F <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>, </span></code><a href="#impl-IntoFuture" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/future/into_future.rs.html#20-27" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Output-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html#associatedtype.Output" class="type">Output</a> = <F as <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a></code></h4><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>into_future</code>)</div></div><div class='docblock'><p>The output that the future will produce on completion.</p>
|
||||
</div><h4 id="associatedtype.Future" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html#associatedtype.Future" class="type">Future</a> = F</code></h4><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>into_future</code>)</div></div><div class='docblock'><p>Which kind of future are we turning this into?</p>
|
||||
</div><h4 id="method.into_future" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html#tymethod.into_future" class="fnname">into_future</a>(self) -> <F as <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html" title="trait core::future::into_future::IntoFuture">IntoFuture</a>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html#associatedtype.Future" title="type core::future::into_future::IntoFuture::Future">Future</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/future/into_future.rs.html#24" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>into_future</code>)</div></div><div class='docblock hidden'><p>Creates a future from a value.</p>
|
||||
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-TryFuture" class="impl"><code class="in-band">impl<F, T, E> <a class="trait" href="../../futures_core/future/trait.TryFuture.html" title="trait futures_core::future::TryFuture">TryFuture</a> for F <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, E>> + ?<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 href="#impl-TryFuture" class="anchor"></a><a class="srclink" href="../../src/futures_core/future.rs.html#76-86" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Ok" class="type"><code>type <a href="../../futures_core/future/trait.TryFuture.html#associatedtype.Ok" class="type">Ok</a> = T</code></h4><div class='docblock'><p>The type of successful values yielded by this future</p>
|
||||
</div><h4 id="associatedtype.Error-2" class="type"><code>type <a href="../../futures_core/future/trait.TryFuture.html#associatedtype.Error" class="type">Error</a> = E</code></h4><div class='docblock'><p>The type of failures yielded by this future</p>
|
||||
</div><h4 id="method.try_poll" class="method hidden"><code>pub fn <a href="../../futures_core/future/trait.TryFuture.html#tymethod.try_poll" class="fnname">try_poll</a>(<br> self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>F>, <br> cx: &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><'_><br>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<F as <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>></code><a class="srclink" href="../../src/futures_core/future.rs.html#83" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Poll this <code>TryFuture</code> as if it were a <code>Future</code>. <a href="../../futures_core/future/trait.TryFuture.html#tymethod.try_poll">Read more</a></p>
|
||||
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A Future that is resolved once the corresponding [`CancellationToken`] was cancelled"><meta name="keywords" content="rust, rustlang, rust-lang, WaitForCancellationFuture"><title>tokio_util::sync::WaitForCancellationFuture - 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 struct"><!--[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">Struct WaitForCancellationFuture</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Drop">Drop</a><a href="#impl-Future">Future</a><a href="#impl-Send">Send</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">!Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-IntoFuture">IntoFuture</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><p class="location"><a href="../index.html">tokio_util</a>::<wbr><a href="index.html">sync</a></p><div id="sidebar-vars" data-name="WaitForCancellationFuture" data-ty="struct" data-relpath=""></div><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="in-band">Struct <a href="../index.html">tokio_util</a>::<wbr><a href="index.html">sync</a>::<wbr><a class="struct" href="">WaitForCancellationFuture</a></span><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/sync/cancellation_token.rs.html#66-73" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct"><span class="docblock attributes top-attr">#[must_use = "futures do nothing unless polled"]</span>pub struct WaitForCancellationFuture<'a> { /* fields omitted */ }</pre></div><div class="docblock"><p>A Future that is resolved once the corresponding <a href="../../tokio_util/sync/struct.CancellationToken.html" title="CancellationToken"><code>CancellationToken</code></a>
|
||||
was cancelled</p>
|
||||
</div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-Debug" class="impl"><code class="in-band">impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../tokio_util/sync/struct.WaitForCancellationFuture.html" title="struct tokio_util::sync::WaitForCancellationFuture">WaitForCancellationFuture</a><'a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#301-305" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#302-304" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></div><h3 id="impl-Drop" class="impl"><code class="in-band">impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="../../tokio_util/sync/struct.WaitForCancellationFuture.html" title="struct tokio_util::sync::WaitForCancellationFuture">WaitForCancellationFuture</a><'a></code><a href="#impl-Drop" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#343-354" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.drop" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop" class="fnname">drop</a>(&mut self)</code><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#344-353" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Executes the destructor for this type. <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></p>
|
||||
</div></div><h3 id="impl-Future" class="impl"><code class="in-band">impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a> for <a class="struct" href="../../tokio_util/sync/struct.WaitForCancellationFuture.html" title="struct tokio_util::sync::WaitForCancellationFuture">WaitForCancellationFuture</a><'a></code><a href="#impl-Future" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#307-341" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Output" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" class="type">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a></code></h4><div class='docblock'><p>The type of value produced on completion.</p>
|
||||
</div><h4 id="method.poll" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#tymethod.poll" class="fnname">poll</a>(self: <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self>, cx: &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><'_>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></code><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#310-340" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Attempt to resolve the future to a final value, registering
|
||||
the current task for wakeup if the value is not yet available. <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#tymethod.poll">Read more</a></p>
|
||||
</div></div><h3 id="impl-Send" class="impl"><code class="in-band">impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../tokio_util/sync/struct.WaitForCancellationFuture.html" title="struct tokio_util::sync::WaitForCancellationFuture">WaitForCancellationFuture</a><'a></code><a href="#impl-Send" class="anchor"></a><a class="srclink" href="../../src/tokio_util/sync/cancellation_token.rs.html#78" title="goto source code">[src]</a></h3><div class="impl-items"></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../tokio_util/sync/struct.WaitForCancellationFuture.html" title="struct tokio_util::sync::WaitForCancellationFuture">WaitForCancellationFuture</a><'a></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">impl<'a> !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../tokio_util/sync/struct.WaitForCancellationFuture.html" title="struct tokio_util::sync::WaitForCancellationFuture">WaitForCancellationFuture</a><'a></code><a href="#impl-Sync" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">impl<'a> !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../tokio_util/sync/struct.WaitForCancellationFuture.html" title="struct tokio_util::sync::WaitForCancellationFuture">WaitForCancellationFuture</a><'a></code><a href="#impl-Unpin" class="anchor"></a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl<'a> <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../tokio_util/sync/struct.WaitForCancellationFuture.html" title="struct tokio_util::sync::WaitForCancellationFuture">WaitForCancellationFuture</a><'a></code><a href="#impl-UnwindSafe" class="anchor"></a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<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 href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<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 href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-IntoFuture" class="impl"><code class="in-band">impl<F> <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html" title="trait core::future::into_future::IntoFuture">IntoFuture</a> for F <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>, </span></code><a href="#impl-IntoFuture" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/future/into_future.rs.html#20-27" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Output-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html#associatedtype.Output" class="type">Output</a> = <F as <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a></code></h4><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>into_future</code>)</div></div><div class='docblock'><p>The output that the future will produce on completion.</p>
|
||||
</div><h4 id="associatedtype.Future" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html#associatedtype.Future" class="type">Future</a> = F</code></h4><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>into_future</code>)</div></div><div class='docblock'><p>Which kind of future are we turning this into?</p>
|
||||
</div><h4 id="method.into_future" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html#tymethod.into_future" class="fnname">into_future</a>(self) -> <F as <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html" title="trait core::future::into_future::IntoFuture">IntoFuture</a>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/future/into_future/trait.IntoFuture.html#associatedtype.Future" title="type core::future::into_future::IntoFuture::Future">Future</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/future/into_future.rs.html#24" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>into_future</code>)</div></div><div class='docblock hidden'><p>Creates a future from a value.</p>
|
||||
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="tokio_util"></div>
|
||||
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
||||
Reference in New Issue
Block a user