blob: 9a1d1c881ce4cccb209b812f0e66c1ec17432dc5 [file] [log] [blame]
<!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 extension trait for `Future`s that provides a variety of convenient adapters."><meta name="keywords" content="rust, rustlang, rust-lang, FutureExt"><title>FutureExt in teaclave_test_utils - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../teaclave_test_utils/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../teaclave_test_utils/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">FutureExt</a></h2><div class="sidebar-elems"><section><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.boxed">boxed</a></li><li><a href="#method.boxed_local">boxed_local</a></li><li><a href="#method.catch_unwind">catch_unwind</a></li><li><a href="#method.flatten">flatten</a></li><li><a href="#method.flatten_stream">flatten_stream</a></li><li><a href="#method.fuse">fuse</a></li><li><a href="#method.inspect">inspect</a></li><li><a href="#method.into_stream">into_stream</a></li><li><a href="#method.left_future">left_future</a></li><li><a href="#method.map">map</a></li><li><a href="#method.map_into">map_into</a></li><li><a href="#method.never_error">never_error</a></li><li><a href="#method.now_or_never">now_or_never</a></li><li><a href="#method.poll_unpin">poll_unpin</a></li><li><a href="#method.remote_handle">remote_handle</a></li><li><a href="#method.right_future">right_future</a></li><li><a href="#method.shared">shared</a></li><li><a href="#method.then">then</a></li><li><a href="#method.unit_error">unit_error</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In teaclave_test_utils</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Trait <a href="index.html">teaclave_test_utils</a>::<wbr><a class="trait" href="#">FutureExt</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/futures_util/future/future/mod.rs.html#123">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust trait"><code>pub trait FutureExt: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a> {
<details class="rustdoc-toggle type-contents-toggle"><summary class="hideme"><span>Show 19 methods</span></summary> fn <a href="#method.map" class="fnname">map</a>&lt;U, F&gt;(self, f: F) -&gt; <a class="struct" href="../futures_util/future/future/struct.Map.html" title="struct futures_util::future::future::Map">Map</a>&lt;Self, F&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>) -&gt; U</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.map_into" class="fnname">map_into</a>&lt;U&gt;(self) -&gt; <a class="struct" href="../futures_util/future/future/struct.MapInto.html" title="struct futures_util::future::future::MapInto">MapInto</a>&lt;Self, U&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.then" class="fnname">then</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="../futures_util/future/future/struct.Then.html" title="struct futures_util::future::future::Then">Then</a>&lt;Self, Fut, F&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fut: <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>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.left_future" class="fnname">left_future</a>&lt;B&gt;(self) -&gt; <a class="enum" href="../futures_util/future/either/enum.Either.html" title="enum futures_util::future::either::Either">Either</a>&lt;Self, B&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>&lt;Output = Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.right_future" class="fnname">right_future</a>&lt;A&gt;(self) -&gt; <a class="enum" href="../futures_util/future/either/enum.Either.html" title="enum futures_util::future::either::Either">Either</a>&lt;A, Self&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>&lt;Output = Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.into_stream" class="fnname">into_stream</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/struct.IntoStream.html" title="struct futures_util::future::future::IntoStream">IntoStream</a>&lt;Self&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.flatten" class="fnname">flatten</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/struct.Flatten.html" title="struct futures_util::future::future::Flatten">Flatten</a>&lt;Self&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</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></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.flatten_stream" class="fnname">flatten_stream</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/struct.FlattenStream.html" title="struct futures_util::future::future::FlattenStream">FlattenStream</a>&lt;Self&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>: <a class="trait" href="../futures_core/stream/trait.Stream.html" title="trait futures_core::stream::Stream">Stream</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.fuse" class="fnname">fuse</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/fuse/struct.Fuse.html" title="struct futures_util::future::future::fuse::Fuse">Fuse</a>&lt;Self&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.inspect" class="fnname">inspect</a>&lt;F&gt;(self, f: F) -&gt; <a class="struct" href="../futures_util/future/future/struct.Inspect.html" title="struct futures_util::future::future::Inspect">Inspect</a>&lt;Self, F&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>)</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.catch_unwind" class="fnname">catch_unwind</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/catch_unwind/struct.CatchUnwind.html" title="struct futures_util::future::future::catch_unwind::CatchUnwind">CatchUnwind</a>&lt;Self&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.shared" class="fnname">shared</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/shared/struct.Shared.html" title="struct futures_util::future::future::shared::Shared">Shared</a>&lt;Self&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.remote_handle" class="fnname">remote_handle</a>(self) -&gt; (<a class="struct" href="../futures_util/future/future/remote_handle/struct.Remote.html" title="struct futures_util::future::future::remote_handle::Remote">Remote</a>&lt;Self&gt;, <a class="struct" href="../futures_util/future/future/remote_handle/struct.RemoteHandle.html" title="struct futures_util::future::future::remote_handle::RemoteHandle">RemoteHandle</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt;) { ... }
<span class="item-spacer"></span> fn <a href="#method.boxed" class="fnname">boxed</a>&lt;'a&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;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>&lt;Output = Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'a, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: 'a + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.boxed_local" class="fnname">boxed_local</a>&lt;'a&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;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>&lt;Output = Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt; + 'a, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: 'a</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.unit_error" class="fnname">unit_error</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/struct.UnitError.html" title="struct futures_util::future::future::UnitError">UnitError</a>&lt;Self&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.never_error" class="fnname">never_error</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/struct.NeverError.html" title="struct futures_util::future::future::NeverError">NeverError</a>&lt;Self&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.poll_unpin" class="fnname">poll_unpin</a>(&amp;mut self, cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.now_or_never" class="fnname">now_or_never</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt; { ... }
</details>}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An extension trait for <code>Future</code>s that provides a variety of convenient
adapters.</p>
</div></details><h2 id="provided-methods" class="small-section-header">Provided Methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.map" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#146-149">source</a><h4 class="code-header">fn <a href="#method.map" class="fnname">map</a>&lt;U, F&gt;(self, f: F) -&gt; <a class="struct" href="../futures_util/future/future/struct.Map.html" title="struct futures_util::future::future::Map">Map</a>&lt;Self, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>) -&gt; U,</span></h4></section></summary><div class="docblock"><p>Map this future’s output to a different type, returning a new future of
the resulting type.</p>
<p>This function is similar to the <code>Option::map</code> or <code>Iterator::map</code> where
it will change the type of the underlying future. This is useful to
chain along a computation once a future has been resolved.</p>
<p>Note that this function consumes the receiving future and returns a
wrapped version of it, similar to the existing <code>map</code> methods in the
standard library.</p>
<h5 id="examples"><a href="#examples">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::FutureExt;
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="number">1 </span>};
<span class="kw">let </span>new_future = future.map(|x| x + <span class="number">3</span>);
<span class="macro">assert_eq!</span>(new_future.<span class="kw">await</span>, <span class="number">4</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.map_into" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#159-162">source</a><h4 class="code-header">fn <a href="#method.map_into" class="fnname">map_into</a>&lt;U&gt;(self) -&gt; <a class="struct" href="../futures_util/future/future/struct.MapInto.html" title="struct futures_util::future::future::MapInto">MapInto</a>&lt;Self, U&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt;,</span></h4></section></summary><div class="docblock"><p>Map this future’s output to a different type, returning a new future of
the resulting type.</p>
<p>This function is equivalent to calling <code>map(Into::into)</code> but allows naming
the return type.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.then" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#191-195">source</a><h4 class="code-header">fn <a href="#method.then" class="fnname">then</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="../futures_util/future/future/struct.Then.html" title="struct futures_util::future::future::Then">Then</a>&lt;Self, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <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></h4></section></summary><div class="docblock"><p>Chain on a computation for when a future finished, passing the result of
the future to the provided closure <code>f</code>.</p>
<p>The returned value of the closure must implement the <code>Future</code> trait
and can represent some more work to be done before the composed future
is finished.</p>
<p>The closure <code>f</code> is only run <em>after</em> successful completion of the <code>self</code>
future.</p>
<p>Note that this function consumes the receiving future and returns a
wrapped version of it.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::FutureExt;
<span class="kw">let </span>future_of_1 = <span class="kw">async </span>{ <span class="number">1 </span>};
<span class="kw">let </span>future_of_4 = future_of_1.then(|x| <span class="kw">async move </span>{ x + <span class="number">3 </span>});
<span class="macro">assert_eq!</span>(future_of_4.<span class="kw">await</span>, <span class="number">4</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.left_future" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#222-225">source</a><h4 class="code-header">fn <a href="#method.left_future" class="fnname">left_future</a>&lt;B&gt;(self) -&gt; <a class="enum" href="../futures_util/future/either/enum.Either.html" title="enum futures_util::future::either::Either">Either</a>&lt;Self, B&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>&lt;Output = Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Wrap this future in an <code>Either</code> future, making it the left-hand variant
of that <code>Either</code>.</p>
<p>This can be used in combination with the <code>right_future</code> method to write <code>if</code>
statements that evaluate to different futures in different branches.</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::FutureExt;
<span class="kw">let </span>x = <span class="number">6</span>;
<span class="kw">let </span>future = <span class="kw">if </span>x &lt; <span class="number">10 </span>{
<span class="kw">async </span>{ <span class="bool-val">true </span>}.left_future()
} <span class="kw">else </span>{
<span class="kw">async </span>{ <span class="bool-val">false </span>}.right_future()
};
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, <span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.right_future" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#252-255">source</a><h4 class="code-header">fn <a href="#method.right_future" class="fnname">right_future</a>&lt;A&gt;(self) -&gt; <a class="enum" href="../futures_util/future/either/enum.Either.html" title="enum futures_util::future::either::Either">Either</a>&lt;A, Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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>&lt;Output = Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Wrap this future in an <code>Either</code> future, making it the right-hand variant
of that <code>Either</code>.</p>
<p>This can be used in combination with the <code>left_future</code> method to write <code>if</code>
statements that evaluate to different futures in different branches.</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::FutureExt;
<span class="kw">let </span>x = <span class="number">6</span>;
<span class="kw">let </span>future = <span class="kw">if </span>x &gt; <span class="number">10 </span>{
<span class="kw">async </span>{ <span class="bool-val">true </span>}.left_future()
} <span class="kw">else </span>{
<span class="kw">async </span>{ <span class="bool-val">false </span>}.right_future()
};
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, <span class="bool-val">false</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into_stream" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#278-280">source</a><h4 class="code-header">fn <a href="#method.into_stream" class="fnname">into_stream</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/struct.IntoStream.html" title="struct futures_util::future::future::IntoStream">IntoStream</a>&lt;Self&gt;</h4></section></summary><div class="docblock"><p>Convert this future into a single element stream.</p>
<p>The returned stream contains single success if this future resolves to
success or single error if this future resolves into error.</p>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::FutureExt;
<span class="kw">use </span>futures::stream::StreamExt;
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="number">17 </span>};
<span class="kw">let </span>stream = future.into_stream();
<span class="kw">let </span>collected: Vec&lt;<span class="kw">_</span>&gt; = stream.collect().<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(collected, <span class="macro">vec!</span>[<span class="number">17</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.flatten" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#307-310">source</a><h4 class="code-header">fn <a href="#method.flatten" class="fnname">flatten</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/struct.Flatten.html" title="struct futures_util::future::future::Flatten">Flatten</a>&lt;Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</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>,</span></h4></section></summary><div class="docblock"><p>Flatten the execution of this future when the output of this
future is itself another future.</p>
<p>This can be useful when combining futures together to flatten the
computation out the final result.</p>
<p>This method is roughly equivalent to <code>self.then(|x| x)</code>.</p>
<p>Note that this function consumes the receiving future and returns a
wrapped version of it.</p>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::FutureExt;
<span class="kw">let </span>nested_future = <span class="kw">async </span>{ <span class="kw">async </span>{ <span class="number">1 </span>} };
<span class="kw">let </span>future = nested_future.flatten();
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, <span class="number">1</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.flatten_stream" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#341-344">source</a><h4 class="code-header">fn <a href="#method.flatten_stream" class="fnname">flatten_stream</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/struct.FlattenStream.html" title="struct futures_util::future::future::FlattenStream">FlattenStream</a>&lt;Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>: <a class="trait" href="../futures_core/stream/trait.Stream.html" title="trait futures_core::stream::Stream">Stream</a>,</span></h4></section></summary><div class="docblock"><p>Flatten the execution of this future when the successful result of this
future is a stream.</p>
<p>This can be useful when stream initialization is deferred, and it is
convenient to work with that stream as if stream was available at the
call site.</p>
<p>Note that this function consumes this future and returns a wrapped
version of it.</p>
<h5 id="examples-6"><a href="#examples-6">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::FutureExt;
<span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream_items = <span class="macro">vec!</span>[<span class="number">17</span>, <span class="number">18</span>, <span class="number">19</span>];
<span class="kw">let </span>future_of_a_stream = <span class="kw">async </span>{ stream::iter(stream_items) };
<span class="kw">let </span>stream = future_of_a_stream.flatten_stream();
<span class="kw">let </span>list: Vec&lt;<span class="kw">_</span>&gt; = stream.collect().<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(list, <span class="macro">vec!</span>[<span class="number">17</span>, <span class="number">18</span>, <span class="number">19</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fuse" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#365-367">source</a><h4 class="code-header">fn <a href="#method.fuse" class="fnname">fuse</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/fuse/struct.Fuse.html" title="struct futures_util::future::future::fuse::Fuse">Fuse</a>&lt;Self&gt;</h4></section></summary><div class="docblock"><p>Fuse a future such that <code>poll</code> will never again be called once it has
completed. This method can be used to turn any <code>Future</code> into a
<code>FusedFuture</code>.</p>
<p>Normally, once a future has returned <code>Poll::Ready</code> from <code>poll</code>,
any further calls could exhibit bad behavior such as blocking
forever, panicking, never returning, etc. If it is known that <code>poll</code>
may be called too often then this method can be used to ensure that it
has defined semantics.</p>
<p>If a <code>fuse</code>d future is <code>poll</code>ed after having returned <code>Poll::Ready</code>
previously, it will return <code>Poll::Pending</code>, from <code>poll</code> again (and will
continue to do so for all future calls to <code>poll</code>).</p>
<p>This combinator will drop the underlying future as soon as it has been
completed to ensure resources are reclaimed as soon as possible.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.inspect" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#391-394">source</a><h4 class="code-header">fn <a href="#method.inspect" class="fnname">inspect</a>&lt;F&gt;(self, f: F) -&gt; <a class="struct" href="../futures_util/future/future/struct.Inspect.html" title="struct futures_util::future::future::Inspect">Inspect</a>&lt;Self, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&amp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>),</span></h4></section></summary><div class="docblock"><p>Do something with the output of a future before passing it on.</p>
<p>When using futures, you’ll often chain several of them together. While
working on such code, you might want to check out what’s happening at
various parts in the pipeline, without consuming the intermediate
value. To do that, insert a call to <code>inspect</code>.</p>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::FutureExt;
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="number">1 </span>};
<span class="kw">let </span>new_future = future.inspect(|<span class="kw-2">&amp;</span>x| <span class="macro">println!</span>(<span class="string">&quot;about to resolve: {}&quot;</span>, x));
<span class="macro">assert_eq!</span>(new_future.<span class="kw">await</span>, <span class="number">1</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.catch_unwind" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#431-433">source</a><h4 class="code-header">fn <a href="#method.catch_unwind" class="fnname">catch_unwind</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/catch_unwind/struct.CatchUnwind.html" title="struct futures_util::future::future::catch_unwind::CatchUnwind">CatchUnwind</a>&lt;Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</span></h4></section></summary><div class="docblock"><p>Catches unwinding panics while polling the future.</p>
<p>In general, panics within a future can propagate all the way out to the
task level. This combinator makes it possible to halt unwinding within
the future itself. It’s most commonly used within task executors. It’s
not recommended to use this for error handling.</p>
<p>Note that this method requires the <code>UnwindSafe</code> bound from the standard
library. This isn’t always applied automatically, and the standard
library provides an <code>AssertUnwindSafe</code> wrapper type to apply it
after-the fact. To assist using this method, the <code>Future</code> trait is also
implemented for <code>AssertUnwindSafe&lt;F&gt;</code> where <code>F</code> implements <code>Future</code>.</p>
<p>This method is only available when the <code>std</code> feature of this
library is activated, and it is activated by default.</p>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::{<span class="self">self</span>, FutureExt, Ready};
<span class="kw">let </span>future = future::ready(<span class="number">2</span>);
<span class="macro">assert!</span>(future.catch_unwind().<span class="kw">await</span>.is_ok());
<span class="kw">let </span>future = future::lazy(|<span class="kw">_</span>| -&gt; Ready&lt;i32&gt; {
<span class="macro">unimplemented!</span>()
});
<span class="macro">assert!</span>(future.catch_unwind().<span class="kw">await</span>.is_err());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.shared" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#486-489">source</a><h4 class="code-header">fn <a href="#method.shared" class="fnname">shared</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/shared/struct.Shared.html" title="struct futures_util::future::future::shared::Shared">Shared</a>&lt;Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</span></h4></section></summary><div class="docblock"><p>Create a cloneable handle to this future where all handles will resolve
to the same result.</p>
<p>The <code>shared</code> combinator method provides a method to convert any future
into a cloneable future. It enables a future to be polled by multiple
threads.</p>
<p>This method is only available when the <code>std</code> feature of this
library is activated, and it is activated by default.</p>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::FutureExt;
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="number">6 </span>};
<span class="kw">let </span>shared1 = future.shared();
<span class="kw">let </span>shared2 = shared1.clone();
<span class="macro">assert_eq!</span>(<span class="number">6</span>, shared1.<span class="kw">await</span>);
<span class="macro">assert_eq!</span>(<span class="number">6</span>, shared2.<span class="kw">await</span>);</code></pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// Note, unlike most examples this is written in the context of a
// synchronous function to better illustrate the cross-thread aspect of
// the `shared` combinator.
</span><span class="kw">use </span>futures::future::FutureExt;
<span class="kw">use </span>futures::executor::block_on;
<span class="kw">use </span>std::thread;
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="number">6 </span>};
<span class="kw">let </span>shared1 = future.shared();
<span class="kw">let </span>shared2 = shared1.clone();
<span class="kw">let </span>join_handle = thread::spawn(<span class="kw">move </span>|| {
<span class="macro">assert_eq!</span>(<span class="number">6</span>, block_on(shared2));
});
<span class="macro">assert_eq!</span>(<span class="number">6</span>, shared1.<span class="kw">await</span>);
join_handle.join().unwrap();</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.remote_handle" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#505-507">source</a><h4 class="code-header">fn <a href="#method.remote_handle" class="fnname">remote_handle</a>(self) -&gt; (<a class="struct" href="../futures_util/future/future/remote_handle/struct.Remote.html" title="struct futures_util::future::future::remote_handle::Remote">Remote</a>&lt;Self&gt;, <a class="struct" href="../futures_util/future/future/remote_handle/struct.RemoteHandle.html" title="struct futures_util::future::future::remote_handle::RemoteHandle">RemoteHandle</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt;)</h4></section></summary><div class="docblock"><p>Turn this future into a future that yields <code>()</code> on completion and sends
its output to another future on a separate task.</p>
<p>This can be used with spawning executors to easily retrieve the result
of a future executing on a separate task or thread.</p>
<p>This method is only available when the <code>std</code> feature of this
library is activated, and it is activated by default.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.boxed" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#518-520">source</a><h4 class="code-header">fn <a href="#method.boxed" class="fnname">boxed</a>&lt;'a&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self<br>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;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>&lt;Output = Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'a, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: 'a + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</span></h4></section></summary><div class="docblock"><p>Wrap the future in a Box, pinning it.</p>
<p>This method is only available when the <code>std</code> or <code>alloc</code> feature of this
library is activated, and it is activated by default.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.boxed_local" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#532-534">source</a><h4 class="code-header">fn <a href="#method.boxed_local" class="fnname">boxed_local</a>&lt;'a&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self<br>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;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>&lt;Output = Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt; + 'a, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: 'a,</span></h4></section></summary><div class="docblock"><p>Wrap the future in a Box, pinning it.</p>
<p>Similar to <code>boxed</code>, but without the <code>Send</code> requirement.</p>
<p>This method is only available when the <code>std</code> or <code>alloc</code> feature of this
library is activated, and it is activated by default.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.unit_error" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#541-543">source</a><h4 class="code-header">fn <a href="#method.unit_error" class="fnname">unit_error</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/struct.UnitError.html" title="struct futures_util::future::future::UnitError">UnitError</a>&lt;Self&gt;</h4></section></summary><div class="docblock"><p>Turns a <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html"><code>Future&lt;Output = T&gt;</code></a> into a
<a href="futures_core::future::TryFuture"><code>TryFuture&lt;Ok = T, Error = ()</code>&gt;</a>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.never_error" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#550-552">source</a><h4 class="code-header">fn <a href="#method.never_error" class="fnname">never_error</a>(self) -&gt; <a class="struct" href="../futures_util/future/future/struct.NeverError.html" title="struct futures_util::future::future::NeverError">NeverError</a>&lt;Self&gt;</h4></section></summary><div class="docblock"><p>Turns a <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html"><code>Future&lt;Output = T&gt;</code></a> into a
<a href="futures_core::future::TryFuture"><code>TryFuture&lt;Ok = T, Error = Never</code>&gt;</a>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.poll_unpin" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#558-560">source</a><h4 class="code-header">fn <a href="#method.poll_unpin" class="fnname">poll_unpin</a>(&amp;mut self, cx: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a>&lt;'_&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</span></h4></section></summary><div class="docblock"><p>A convenience for calling <code>Future::poll</code> on <code>Unpin</code> future types.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.now_or_never" class="method has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#596-598">source</a><h4 class="code-header">fn <a href="#method.now_or_never" class="fnname">now_or_never</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt;</h4></section></summary><div class="docblock"><p>Evaluates and consumes the future, returning the resulting output if
the future is ready after the first call to <code>Future::poll</code>.</p>
<p>If <code>poll</code> instead returns <code>Poll::Pending</code>, <code>None</code> is returned.</p>
<p>This method is useful in cases where immediacy is more important than
waiting for a result. It is also convenient for quickly obtaining
the value of a future that is known to always resolve immediately.</p>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::{future::ready, future::pending};
<span class="kw">let </span>future_ready = ready(<span class="string">&quot;foobar&quot;</span>);
<span class="kw">let </span>future_pending = pending::&lt;<span class="kw-2">&amp;</span><span class="lifetime">&#39;static </span>str&gt;();
<span class="macro">assert_eq!</span>(future_ready.now_or_never(), <span class="prelude-val">Some</span>(<span class="string">&quot;foobar&quot;</span>));
<span class="macro">assert_eq!</span>(future_pending.now_or_never(), <span class="prelude-val">None</span>);</code></pre></div>
<p>In cases where it is absolutely known that a future should always
resolve immediately and never return <code>Poll::Pending</code>, this method can
be combined with <code>expect()</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>future_ready = ready(<span class="string">&quot;foobar&quot;</span>);
<span class="macro">assert_eq!</span>(future_ready.now_or_never().expect(<span class="string">&quot;Future not ready&quot;</span>), <span class="string">&quot;foobar&quot;</span>);</code></pre></div>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div id="implementors-list"><section id="impl-FutureExt-for-T" class="impl has-srclink"><a class="srclink rightside" href="../src/futures_util/future/future/mod.rs.html#119">source</a><a href="#impl-FutureExt-for-T" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.FutureExt.html" title="trait teaclave_test_utils::FutureExt">FutureExt</a> for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></div><script src="../implementors/futures_util/future/future/trait.FutureExt.js" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="teaclave_test_utils" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>