mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-12-02 00:14:33 +01:00
284 lines
No EOL
73 KiB
HTML
284 lines
No EOL
73 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Adapters specific to `Result`-returning futures"><title>TryFutureExt in futures_util::future - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-492a78a4a87dcc01.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="futures_util" data-themes="" data-resource-suffix="" data-rustdoc-version="1.82.0 (f6e511eec 2024-10-15)" data-channel="1.82.0" data-search-js="search-a99f1315e7cc5121.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-921df33f47b8780c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-3b12f09e550e0385.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../futures_util/index.html">futures_<wbr>util</a><span class="version">0.3.31</span></h2></div><h2 class="location"><a href="#">TryFuture<wbr>Ext</a></h2><div class="sidebar-elems"><section><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.and_then">and_then</a></li><li><a href="#method.err_into">err_into</a></li><li><a href="#method.inspect_err">inspect_err</a></li><li><a href="#method.inspect_ok">inspect_ok</a></li><li><a href="#method.into_future">into_future</a></li><li><a href="#method.map_err">map_err</a></li><li><a href="#method.map_ok">map_ok</a></li><li><a href="#method.map_ok_or_else">map_ok_or_else</a></li><li><a href="#method.ok_into">ok_into</a></li><li><a href="#method.or_else">or_else</a></li><li><a href="#method.try_flatten">try_flatten</a></li><li><a href="#method.try_flatten_stream">try_flatten_stream</a></li><li><a href="#method.try_poll_unpin">try_poll_unpin</a></li><li><a href="#method.unwrap_or_else">unwrap_or_else</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In futures_<wbr>util::<wbr>future</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Trait <a href="../index.html">futures_util</a>::<wbr><a href="index.html">future</a>::<wbr><a class="trait" href="#">TryFutureExt</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../src/futures_util/future/try_future/mod.rs.html#137-625">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub trait TryFutureExt: <a class="trait" href="trait.TryFuture.html" title="trait futures_util::future::TryFuture">TryFuture</a> {
|
||
<details class="toggle type-contents-toggle"><summary class="hideme"><span>Show 14 methods</span></summary> // Provided methods
|
||
fn <a href="#method.map_ok" class="fn">map_ok</a><T, F>(self, f: F) -> <a class="struct" href="struct.MapOk.html" title="struct futures_util::future::MapOk">MapOk</a><Self, F> <a href="#" class="tooltip" data-notable-ty="MapOk<Self, F>">ⓘ</a>
|
||
<span class="where">where F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>) -> T,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.map_ok_or_else" class="fn">map_ok_or_else</a><T, E, F>(self, e: E, f: F) -> <a class="struct" href="struct.MapOkOrElse.html" title="struct futures_util::future::MapOkOrElse">MapOkOrElse</a><Self, F, E> <a href="#" class="tooltip" data-notable-ty="MapOkOrElse<Self, F, E>">ⓘ</a>
|
||
<span class="where">where F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>) -> T,
|
||
E: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>) -> T,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.map_err" class="fn">map_err</a><E, F>(self, f: F) -> <a class="struct" href="struct.MapErr.html" title="struct futures_util::future::MapErr">MapErr</a><Self, F> <a href="#" class="tooltip" data-notable-ty="MapErr<Self, F>">ⓘ</a>
|
||
<span class="where">where F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>) -> E,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.err_into" class="fn">err_into</a><E>(self) -> <a class="struct" href="struct.ErrInto.html" title="struct futures_util::future::ErrInto">ErrInto</a><Self, E> <a href="#" class="tooltip" data-notable-ty="ErrInto<Self, E>">ⓘ</a>
|
||
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><E></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.ok_into" class="fn">ok_into</a><U>(self) -> <a class="struct" href="struct.OkInto.html" title="struct futures_util::future::OkInto">OkInto</a><Self, U> <a href="#" class="tooltip" data-notable-ty="OkInto<Self, U>">ⓘ</a>
|
||
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.and_then" class="fn">and_then</a><Fut, F>(self, f: F) -> <a class="struct" href="struct.AndThen.html" title="struct futures_util::future::AndThen">AndThen</a><Self, Fut, F> <a href="#" class="tooltip" data-notable-ty="AndThen<Self, Fut, F>">ⓘ</a>
|
||
<span class="where">where F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>) -> Fut,
|
||
Fut: <a class="trait" href="trait.TryFuture.html" title="trait futures_util::future::TryFuture">TryFuture</a><Error = Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>>,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.or_else" class="fn">or_else</a><Fut, F>(self, f: F) -> <a class="struct" href="struct.OrElse.html" title="struct futures_util::future::OrElse">OrElse</a><Self, Fut, F> <a href="#" class="tooltip" data-notable-ty="OrElse<Self, Fut, F>">ⓘ</a>
|
||
<span class="where">where F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>) -> Fut,
|
||
Fut: <a class="trait" href="trait.TryFuture.html" title="trait futures_util::future::TryFuture">TryFuture</a><Ok = Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>>,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.inspect_ok" class="fn">inspect_ok</a><F>(self, f: F) -> <a class="struct" href="struct.InspectOk.html" title="struct futures_util::future::InspectOk">InspectOk</a><Self, F> <a href="#" class="tooltip" data-notable-ty="InspectOk<Self, F>">ⓘ</a>
|
||
<span class="where">where F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>),
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.inspect_err" class="fn">inspect_err</a><F>(self, f: F) -> <a class="struct" href="struct.InspectErr.html" title="struct futures_util::future::InspectErr">InspectErr</a><Self, F> <a href="#" class="tooltip" data-notable-ty="InspectErr<Self, F>">ⓘ</a>
|
||
<span class="where">where F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>),
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.try_flatten" class="fn">try_flatten</a>(self) -> <a class="struct" href="struct.TryFlatten.html" title="struct futures_util::future::TryFlatten">TryFlatten</a><Self, Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>> <a href="#" class="tooltip" data-notable-ty="TryFlatten<Self, Self::Ok>">ⓘ</a>
|
||
<span class="where">where Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>: <a class="trait" href="trait.TryFuture.html" title="trait futures_util::future::TryFuture">TryFuture</a><Error = Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>>,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.try_flatten_stream" class="fn">try_flatten_stream</a>(self) -> <a class="struct" href="struct.TryFlattenStream.html" title="struct futures_util::future::TryFlattenStream">TryFlattenStream</a><Self>
|
||
<span class="where">where Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>: <a class="trait" href="../stream/trait.TryStream.html" title="trait futures_util::stream::TryStream">TryStream</a><Error = Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>>,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.unwrap_or_else" class="fn">unwrap_or_else</a><F>(self, f: F) -> <a class="struct" href="struct.UnwrapOrElse.html" title="struct futures_util::future::UnwrapOrElse">UnwrapOrElse</a><Self, F> <a href="#" class="tooltip" data-notable-ty="UnwrapOrElse<Self, F>">ⓘ</a>
|
||
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>) -> Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.into_future" class="fn">into_future</a>(self) -> <a class="struct" href="struct.IntoFuture.html" title="struct futures_util::future::IntoFuture">IntoFuture</a><Self> <a href="#" class="tooltip" data-notable-ty="IntoFuture<Self>">ⓘ</a>
|
||
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.try_poll_unpin" class="fn">try_poll_unpin</a>(
|
||
&mut self,
|
||
cx: &mut <a class="struct" href="https://doc.rust-lang.org/1.82.0/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/1.82.0/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>>>
|
||
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a></span> { ... }
|
||
</details>}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Adapters specific to <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html" title="enum core::result::Result"><code>Result</code></a>-returning futures</p>
|
||
</div></details><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.map_ok" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#217-223">source</a><h4 class="code-header">fn <a href="#method.map_ok" class="fn">map_ok</a><T, F>(self, f: F) -> <a class="struct" href="struct.MapOk.html" title="struct futures_util::future::MapOk">MapOk</a><Self, F> <a href="#" class="tooltip" data-notable-ty="MapOk<Self, F>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>) -> T,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Maps this future’s success value to a different value.</p>
|
||
<p>This method can be used to change the <a href="trait.TryFuture.html#associatedtype.Ok" title="associated type futures_util::future::TryFuture::Ok"><code>Ok</code></a> type of the
|
||
future into a different type. It is similar to the <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#method.map" title="method core::result::Result::map"><code>Result::map</code></a>
|
||
method. You can use this method to chain along a computation once the
|
||
future has been resolved.</p>
|
||
<p>The provided closure <code>f</code> will only be called if this future is resolved
|
||
to an <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#variant.Ok" title="variant core::result::Result::Ok"><code>Ok</code></a>. If it resolves to an <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Err</code></a>, panics, or is dropped, then
|
||
the provided closure will never be invoked.</p>
|
||
<p>Note that this method consumes the future it is called on and returns a
|
||
wrapped version of it.</p>
|
||
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
|
||
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="prelude-val">Ok</span>::<i32, i32>(<span class="number">1</span>) };
|
||
<span class="kw">let </span>future = future.map_ok(|x| x + <span class="number">3</span>);
|
||
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, <span class="prelude-val">Ok</span>(<span class="number">4</span>));</code></pre></div>
|
||
<p>Calling <a href="trait.TryFutureExt.html#method.map_ok" title="method futures_util::future::TryFutureExt::map_ok"><code>map_ok</code></a> on an errored future has no
|
||
effect:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
|
||
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="prelude-val">Err</span>::<i32, i32>(<span class="number">1</span>) };
|
||
<span class="kw">let </span>future = future.map_ok(|x| x + <span class="number">3</span>);
|
||
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, <span class="prelude-val">Err</span>(<span class="number">1</span>));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.map_ok_or_else" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#257-264">source</a><h4 class="code-header">fn <a href="#method.map_ok_or_else" class="fn">map_ok_or_else</a><T, E, F>(self, e: E, f: F) -> <a class="struct" href="struct.MapOkOrElse.html" title="struct futures_util::future::MapOkOrElse">MapOkOrElse</a><Self, F, E> <a href="#" class="tooltip" data-notable-ty="MapOkOrElse<Self, F, E>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>) -> T,
|
||
E: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>) -> T,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Maps this future’s success value to a different value, and permits for error handling resulting in the same type.</p>
|
||
<p>This method can be used to coalesce your <a href="trait.TryFuture.html#associatedtype.Ok" title="associated type futures_util::future::TryFuture::Ok"><code>Ok</code></a> type and <a href="trait.TryFuture.html#associatedtype.Error" title="associated type futures_util::future::TryFuture::Error"><code>Error</code></a> into another type,
|
||
where that type is the same for both outcomes.</p>
|
||
<p>The provided closure <code>f</code> will only be called if this future is resolved
|
||
to an <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#variant.Ok" title="variant core::result::Result::Ok"><code>Ok</code></a>. If it resolves to an <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Err</code></a>, panics, or is dropped, then
|
||
the provided closure will never be invoked.</p>
|
||
<p>The provided closure <code>e</code> will only be called if this future is resolved
|
||
to an <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Err</code></a>. If it resolves to an <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#variant.Ok" title="variant core::result::Result::Ok"><code>Ok</code></a>, panics, or is dropped, then
|
||
the provided closure will never be invoked.</p>
|
||
<p>Note that this method consumes the future it is called on and returns a
|
||
wrapped version of it.</p>
|
||
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
|
||
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="prelude-val">Ok</span>::<i32, i32>(<span class="number">5</span>) };
|
||
<span class="kw">let </span>future = future.map_ok_or_else(|x| x * <span class="number">2</span>, |x| x + <span class="number">3</span>);
|
||
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, <span class="number">8</span>);
|
||
|
||
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="prelude-val">Err</span>::<i32, i32>(<span class="number">5</span>) };
|
||
<span class="kw">let </span>future = future.map_ok_or_else(|x| x * <span class="number">2</span>, |x| x + <span class="number">3</span>);
|
||
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, <span class="number">10</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.map_err" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#308-314">source</a><h4 class="code-header">fn <a href="#method.map_err" class="fn">map_err</a><E, F>(self, f: F) -> <a class="struct" href="struct.MapErr.html" title="struct futures_util::future::MapErr">MapErr</a><Self, F> <a href="#" class="tooltip" data-notable-ty="MapErr<Self, F>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>) -> E,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Maps this future’s error value to a different value.</p>
|
||
<p>This method can be used to change the <a href="trait.TryFuture.html#associatedtype.Error" title="associated type futures_util::future::TryFuture::Error"><code>Error</code></a> type
|
||
of the future into a different type. It is similar to the
|
||
<a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#method.map_err" title="method core::result::Result::map_err"><code>Result::map_err</code></a> method. You can use this method for example to
|
||
ensure that futures have the same <a href="trait.TryFuture.html#associatedtype.Error" title="associated type futures_util::future::TryFuture::Error"><code>Error</code></a> type when
|
||
using <a href="crate::select"><code>select!</code></a> or <a href="crate::join"><code>join!</code></a>.</p>
|
||
<p>The provided closure <code>f</code> will only be called if this future is resolved
|
||
to an <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Err</code></a>. If it resolves to an <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#variant.Ok" title="variant core::result::Result::Ok"><code>Ok</code></a>, panics, or is dropped, then
|
||
the provided closure will never be invoked.</p>
|
||
<p>Note that this method consumes the future it is called on and returns a
|
||
wrapped version of it.</p>
|
||
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
|
||
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="prelude-val">Err</span>::<i32, i32>(<span class="number">1</span>) };
|
||
<span class="kw">let </span>future = future.map_err(|x| x + <span class="number">3</span>);
|
||
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, <span class="prelude-val">Err</span>(<span class="number">4</span>));</code></pre></div>
|
||
<p>Calling <a href="trait.TryFutureExt.html#method.map_err" title="method futures_util::future::TryFutureExt::map_err"><code>map_err</code></a> on a successful future has
|
||
no effect:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
|
||
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="prelude-val">Ok</span>::<i32, i32>(<span class="number">1</span>) };
|
||
<span class="kw">let </span>future = future.map_err(|x| x + <span class="number">3</span>);
|
||
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, <span class="prelude-val">Ok</span>(<span class="number">1</span>));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.err_into" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#341-347">source</a><h4 class="code-header">fn <a href="#method.err_into" class="fn">err_into</a><E>(self) -> <a class="struct" href="struct.ErrInto.html" title="struct futures_util::future::ErrInto">ErrInto</a><Self, E> <a href="#" class="tooltip" data-notable-ty="ErrInto<Self, E>">ⓘ</a><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><E>,</div></h4></section></summary><div class="docblock"><p>Maps this future’s <a href="trait.TryFuture.html#associatedtype.Error" title="associated type futures_util::future::TryFuture::Error"><code>Error</code></a> to a new error type
|
||
using the <a href="std::convert::Into"><code>Into</code></a> trait.</p>
|
||
<p>This method does for futures what the <code>?</code>-operator does for
|
||
<a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html" title="enum core::result::Result"><code>Result</code></a>: It lets the compiler infer the type of the resulting
|
||
error. Just as <a href="trait.TryFutureExt.html#method.map_err" title="method futures_util::future::TryFutureExt::map_err"><code>map_err</code></a>, this is useful for
|
||
example to ensure that futures have the same <a href="trait.TryFuture.html#associatedtype.Error" title="associated type futures_util::future::TryFuture::Error"><code>Error</code></a>
|
||
type when using <a href="crate::select"><code>select!</code></a> or <a href="crate::join"><code>join!</code></a>.</p>
|
||
<p>Note that this method consumes the future it is called on and returns a
|
||
wrapped version of it.</p>
|
||
<h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
|
||
<span class="kw">let </span>future_err_u8 = <span class="kw">async </span>{ <span class="prelude-val">Err</span>::<(), u8>(<span class="number">1</span>) };
|
||
<span class="kw">let </span>future_err_i32 = future_err_u8.err_into::<i32>();</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.ok_into" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#351-357">source</a><h4 class="code-header">fn <a href="#method.ok_into" class="fn">ok_into</a><U>(self) -> <a class="struct" href="struct.OkInto.html" title="struct futures_util::future::OkInto">OkInto</a><Self, U> <a href="#" class="tooltip" data-notable-ty="OkInto<Self, U>">ⓘ</a><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U>,</div></h4></section></summary><div class="docblock"><p>Maps this future’s <a href="trait.TryFuture.html#associatedtype.Ok" title="associated type futures_util::future::TryFuture::Ok"><code>Ok</code></a> to a new type
|
||
using the <a href="std::convert::Into"><code>Into</code></a> trait.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.and_then" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#395-402">source</a><h4 class="code-header">fn <a href="#method.and_then" class="fn">and_then</a><Fut, F>(self, f: F) -> <a class="struct" href="struct.AndThen.html" title="struct futures_util::future::AndThen">AndThen</a><Self, Fut, F> <a href="#" class="tooltip" data-notable-ty="AndThen<Self, Fut, F>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>) -> Fut,
|
||
Fut: <a class="trait" href="trait.TryFuture.html" title="trait futures_util::future::TryFuture">TryFuture</a><Error = Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>>,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Executes another future after this one resolves successfully. The
|
||
success value is passed to a closure to create this subsequent future.</p>
|
||
<p>The provided closure <code>f</code> will only be called if this future is resolved
|
||
to an <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#variant.Ok" title="variant core::result::Result::Ok"><code>Ok</code></a>. If this future resolves to an <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Err</code></a>, panics, or is
|
||
dropped, then the provided closure will never be invoked. The
|
||
<a href="trait.TryFuture.html#associatedtype.Error" title="associated type futures_util::future::TryFuture::Error"><code>Error</code></a> type of this future and the future
|
||
returned by <code>f</code> have to match.</p>
|
||
<p>Note that this method consumes the future it is called on and returns a
|
||
wrapped version of it.</p>
|
||
<h5 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
|
||
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="prelude-val">Ok</span>::<i32, i32>(<span class="number">1</span>) };
|
||
<span class="kw">let </span>future = future.and_then(|x| <span class="kw">async move </span>{ <span class="prelude-val">Ok</span>::<i32, i32>(x + <span class="number">3</span>) });
|
||
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, <span class="prelude-val">Ok</span>(<span class="number">4</span>));</code></pre></div>
|
||
<p>Calling <a href="trait.TryFutureExt.html#method.and_then" title="method futures_util::future::TryFutureExt::and_then"><code>and_then</code></a> on an errored future has no
|
||
effect:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
|
||
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="prelude-val">Err</span>::<i32, i32>(<span class="number">1</span>) };
|
||
<span class="kw">let </span>future = future.and_then(|x| <span class="kw">async move </span>{ <span class="prelude-val">Err</span>::<i32, i32>(x + <span class="number">3</span>) });
|
||
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, <span class="prelude-val">Err</span>(<span class="number">1</span>));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.or_else" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#440-447">source</a><h4 class="code-header">fn <a href="#method.or_else" class="fn">or_else</a><Fut, F>(self, f: F) -> <a class="struct" href="struct.OrElse.html" title="struct futures_util::future::OrElse">OrElse</a><Self, Fut, F> <a href="#" class="tooltip" data-notable-ty="OrElse<Self, Fut, F>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>) -> Fut,
|
||
Fut: <a class="trait" href="trait.TryFuture.html" title="trait futures_util::future::TryFuture">TryFuture</a><Ok = Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>>,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Executes another future if this one resolves to an error. The
|
||
error value is passed to a closure to create this subsequent future.</p>
|
||
<p>The provided closure <code>f</code> will only be called if this future is resolved
|
||
to an <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#variant.Err" title="variant core::result::Result::Err"><code>Err</code></a>. If this future resolves to an <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#variant.Ok" title="variant core::result::Result::Ok"><code>Ok</code></a>, panics, or is
|
||
dropped, then the provided closure will never be invoked. The
|
||
<a href="trait.TryFuture.html#associatedtype.Ok" title="associated type futures_util::future::TryFuture::Ok"><code>Ok</code></a> type of this future and the future returned by <code>f</code>
|
||
have to match.</p>
|
||
<p>Note that this method consumes the future it is called on and returns a
|
||
wrapped version of it.</p>
|
||
<h5 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
|
||
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="prelude-val">Err</span>::<i32, i32>(<span class="number">1</span>) };
|
||
<span class="kw">let </span>future = future.or_else(|x| <span class="kw">async move </span>{ <span class="prelude-val">Err</span>::<i32, i32>(x + <span class="number">3</span>) });
|
||
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, <span class="prelude-val">Err</span>(<span class="number">4</span>));</code></pre></div>
|
||
<p>Calling <a href="trait.TryFutureExt.html#method.or_else" title="method futures_util::future::TryFutureExt::or_else"><code>or_else</code></a> on a successful future has
|
||
no effect:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
|
||
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="prelude-val">Ok</span>::<i32, i32>(<span class="number">1</span>) };
|
||
<span class="kw">let </span>future = future.or_else(|x| <span class="kw">async move </span>{ <span class="prelude-val">Ok</span>::<i32, i32>(x + <span class="number">3</span>) });
|
||
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, <span class="prelude-val">Ok</span>(<span class="number">1</span>));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.inspect_ok" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#467-473">source</a><h4 class="code-header">fn <a href="#method.inspect_ok" class="fn">inspect_ok</a><F>(self, f: F) -> <a class="struct" href="struct.InspectOk.html" title="struct futures_util::future::InspectOk">InspectOk</a><Self, F> <a href="#" class="tooltip" data-notable-ty="InspectOk<Self, F>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>),
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Do something with the success value 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_ok</code>.</p>
|
||
<h5 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
|
||
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="prelude-val">Ok</span>::<<span class="kw">_</span>, ()>(<span class="number">1</span>) };
|
||
<span class="kw">let </span>new_future = future.inspect_ok(|<span class="kw-2">&</span>x| <span class="macro">println!</span>(<span class="string">"about to resolve: {}"</span>, x));
|
||
<span class="macro">assert_eq!</span>(new_future.<span class="kw">await</span>, <span class="prelude-val">Ok</span>(<span class="number">1</span>));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.inspect_err" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#493-499">source</a><h4 class="code-header">fn <a href="#method.inspect_err" class="fn">inspect_err</a><F>(self, f: F) -> <a class="struct" href="struct.InspectErr.html" title="struct futures_util::future::InspectErr">InspectErr</a><Self, F> <a href="#" class="tooltip" data-notable-ty="InspectErr<Self, F>">ⓘ</a><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>),
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Do something with the error value 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_err</code>.</p>
|
||
<h5 id="examples-7"><a class="doc-anchor" href="#examples-7">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
|
||
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="prelude-val">Err</span>::<(), <span class="kw">_</span>>(<span class="number">1</span>) };
|
||
<span class="kw">let </span>new_future = future.inspect_err(|<span class="kw-2">&</span>x| <span class="macro">println!</span>(<span class="string">"about to error: {}"</span>, x));
|
||
<span class="macro">assert_eq!</span>(new_future.<span class="kw">await</span>, <span class="prelude-val">Err</span>(<span class="number">1</span>));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_flatten" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#505-511">source</a><h4 class="code-header">fn <a href="#method.try_flatten" class="fn">try_flatten</a>(self) -> <a class="struct" href="struct.TryFlatten.html" title="struct futures_util::future::TryFlatten">TryFlatten</a><Self, Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>> <a href="#" class="tooltip" data-notable-ty="TryFlatten<Self, Self::Ok>">ⓘ</a><div class="where">where
|
||
Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>: <a class="trait" href="trait.TryFuture.html" title="trait futures_util::future::TryFuture">TryFuture</a><Error = Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>>,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Flatten the execution of this future when the successful result of this
|
||
future is another future.</p>
|
||
<p>This is equivalent to <code>future.and_then(|x| x)</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_flatten_stream" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#538-546">source</a><h4 class="code-header">fn <a href="#method.try_flatten_stream" class="fn">try_flatten_stream</a>(self) -> <a class="struct" href="struct.TryFlattenStream.html" title="struct futures_util::future::TryFlattenStream">TryFlattenStream</a><Self><div class="where">where
|
||
Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>: <a class="trait" href="../stream/trait.TryStream.html" title="trait futures_util::stream::TryStream">TryStream</a><Error = Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>>,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></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-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
<span class="kw">use </span>futures::stream::{<span class="self">self</span>, TryStreamExt};
|
||
|
||
<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>].into_iter().map(<span class="prelude-val">Ok</span>);
|
||
<span class="kw">let </span>future_of_a_stream = <span class="kw">async </span>{ <span class="prelude-val">Ok</span>::<<span class="kw">_</span>, ()>(stream::iter(stream_items)) };
|
||
|
||
<span class="kw">let </span>stream = future_of_a_stream.try_flatten_stream();
|
||
<span class="kw">let </span>list = stream.try_collect::<Vec<<span class="kw">_</span>>>().<span class="kw">await</span>;
|
||
<span class="macro">assert_eq!</span>(list, <span class="prelude-val">Ok</span>(<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="toggle method-toggle" open><summary><section id="method.unwrap_or_else" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#570-576">source</a><h4 class="code-header">fn <a href="#method.unwrap_or_else" class="fn">unwrap_or_else</a><F>(self, f: F) -> <a class="struct" href="struct.UnwrapOrElse.html" title="struct futures_util::future::UnwrapOrElse">UnwrapOrElse</a><Self, F> <a href="#" class="tooltip" data-notable-ty="UnwrapOrElse<Self, F>">ⓘ</a><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>) -> Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>,</div></h4></section></summary><div class="docblock"><p>Unwraps this future’s output, producing a future with this future’s
|
||
<a href="trait.TryFuture.html#associatedtype.Ok" title="associated type futures_util::future::TryFuture::Ok"><code>Ok</code></a> type as its
|
||
<a href="std::future::Future::Output"><code>Output</code></a> type.</p>
|
||
<p>If this future is resolved successfully, the returned future will
|
||
contain the original future’s success value as output. Otherwise, the
|
||
closure <code>f</code> is called with the error value to produce an alternate
|
||
success value.</p>
|
||
<p>This method is similar to the <a href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html#method.unwrap_or_else" title="method core::result::Result::unwrap_or_else"><code>Result::unwrap_or_else</code></a> method.</p>
|
||
<h5 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::TryFutureExt;
|
||
|
||
<span class="kw">let </span>future = <span class="kw">async </span>{ <span class="prelude-val">Err</span>::<(), <span class="kw-2">&</span>str>(<span class="string">"Boom!"</span>) };
|
||
<span class="kw">let </span>future = future.unwrap_or_else(|<span class="kw">_</span>| ());
|
||
<span class="macro">assert_eq!</span>(future.<span class="kw">await</span>, ());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_future" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#610-615">source</a><h4 class="code-header">fn <a href="#method.into_future" class="fn">into_future</a>(self) -> <a class="struct" href="struct.IntoFuture.html" title="struct futures_util::future::IntoFuture">IntoFuture</a><Self> <a href="#" class="tooltip" data-notable-ty="IntoFuture<Self>">ⓘ</a><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Wraps a <a href="trait.TryFuture.html" title="trait futures_util::future::TryFuture"><code>TryFuture</code></a> into a type that implements
|
||
<a href="std::future::Future"><code>Future</code></a>.</p>
|
||
<p><a href="trait.TryFuture.html" title="trait futures_util::future::TryFuture"><code>TryFuture</code></a>s currently do not implement the
|
||
<a href="std::future::Future"><code>Future</code></a> trait due to limitations of the
|
||
compiler.</p>
|
||
<h5 id="examples-10"><a class="doc-anchor" href="#examples-10">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future::{Future, TryFuture, TryFutureExt};
|
||
|
||
<span class="kw">fn </span>make_try_future() -> <span class="kw">impl </span>TryFuture<<span class="prelude-val">Ok </span>= T, Error = E> { <span class="comment">// ... }
|
||
</span><span class="kw">fn </span>take_future(future: <span class="kw">impl </span>Future<Output = <span class="prelude-ty">Result</span><T, E>>) { <span class="comment">/* ... */ </span>}
|
||
|
||
take_future(make_try_future().into_future());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_poll_unpin" class="method"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#619-624">source</a><h4 class="code-header">fn <a href="#method.try_poll_unpin" class="fn">try_poll_unpin</a>(
|
||
&mut self,
|
||
cx: &mut <a class="struct" href="https://doc.rust-lang.org/1.82.0/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/1.82.0/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Ok" title="type futures_util::future::TryFuture::Ok">Ok</a>, Self::<a class="associatedtype" href="trait.TryFuture.html#associatedtype.Error" title="type futures_util::future::TryFuture::Error">Error</a>>><div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</div></h4></section></summary><div class="docblock"><p>A convenience method for calling <a href="trait.TryFuture.html#tymethod.try_poll" title="method futures_util::future::TryFuture::try_poll"><code>TryFuture::try_poll</code></a> on <a href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin"><code>Unpin</code></a>
|
||
future types.</p>
|
||
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-TryFutureExt-for-Fut" class="impl"><a class="src rightside" href="../../src/futures_util/future/try_future/mod.rs.html#134">source</a><a href="#impl-TryFutureExt-for-Fut" class="anchor">§</a><h3 class="code-header">impl<Fut: ?<a class="trait" href="https://doc.rust-lang.org/1.82.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.TryFuture.html" title="trait futures_util::future::TryFuture">TryFuture</a>> <a class="trait" href="trait.TryFutureExt.html" title="trait futures_util::future::TryFutureExt">TryFutureExt</a> for Fut</h3></section></div><script src="../../trait.impl/futures_util/future/try_future/trait.TryFutureExt.js" async></script><script type="text/json" id="notable-traits-data">{"AndThen<Self, Fut, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.AndThen.html\" title=\"struct futures_util::future::AndThen\">AndThen</a><Fut1, Fut2, F></code></h3><pre><code><div class=\"where\">impl<Fut1, Fut2, F> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.AndThen.html\" title=\"struct futures_util::future::AndThen\">AndThen</a><Fut1, Fut2, F><div class=\"where\">where\n <a class=\"struct\" href=\"struct.TryFlatten.html\" title=\"struct futures_util::future::TryFlatten\">TryFlatten</a><<a class=\"struct\" href=\"struct.MapOk.html\" title=\"struct futures_util::future::MapOk\">MapOk</a><Fut1, F>, Fut2>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <<a class=\"struct\" href=\"struct.TryFlatten.html\" title=\"struct futures_util::future::TryFlatten\">TryFlatten</a><<a class=\"struct\" href=\"struct.MapOk.html\" title=\"struct futures_util::future::MapOk\">MapOk</a><Fut1, F>, Fut2> as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div>","ErrInto<Self, E>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.ErrInto.html\" title=\"struct futures_util::future::ErrInto\">ErrInto</a><Fut, E></code></h3><pre><code><div class=\"where\">impl<Fut, E> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.ErrInto.html\" title=\"struct futures_util::future::ErrInto\">ErrInto</a><Fut, E><div class=\"where\">where\n <a class=\"struct\" href=\"struct.MapErr.html\" title=\"struct futures_util::future::MapErr\">MapErr</a><Fut, IntoFn<E>>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <<a class=\"struct\" href=\"struct.MapErr.html\" title=\"struct futures_util::future::MapErr\">MapErr</a><Fut, IntoFn<E>> as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div>","InspectErr<Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.InspectErr.html\" title=\"struct futures_util::future::InspectErr\">InspectErr</a><Fut, F></code></h3><pre><code><div class=\"where\">impl<Fut, F> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.InspectErr.html\" title=\"struct futures_util::future::InspectErr\">InspectErr</a><Fut, F><div class=\"where\">where\n <a class=\"struct\" href=\"struct.Inspect.html\" title=\"struct futures_util::future::Inspect\">Inspect</a><<a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut>, InspectErrFn<F>>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <<a class=\"struct\" href=\"struct.Inspect.html\" title=\"struct futures_util::future::Inspect\">Inspect</a><<a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut>, InspectErrFn<F>> as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div>","InspectOk<Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.InspectOk.html\" title=\"struct futures_util::future::InspectOk\">InspectOk</a><Fut, F></code></h3><pre><code><div class=\"where\">impl<Fut, F> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.InspectOk.html\" title=\"struct futures_util::future::InspectOk\">InspectOk</a><Fut, F><div class=\"where\">where\n <a class=\"struct\" href=\"struct.Inspect.html\" title=\"struct futures_util::future::Inspect\">Inspect</a><<a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut>, InspectOkFn<F>>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <<a class=\"struct\" href=\"struct.Inspect.html\" title=\"struct futures_util::future::Inspect\">Inspect</a><<a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut>, InspectOkFn<F>> as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div>","IntoFuture<Self>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut></code></h3><pre><code><div class=\"where\">impl<Fut: <a class=\"trait\" href=\"trait.TryFuture.html\" title=\"trait futures_util::future::TryFuture\">TryFuture</a>> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <a class=\"enum\" href=\"https://doc.rust-lang.org/1.82.0/core/result/enum.Result.html\" title=\"enum core::result::Result\">Result</a><Fut::<a class=\"associatedtype\" href=\"trait.TryFuture.html#associatedtype.Ok\" title=\"type futures_util::future::TryFuture::Ok\">Ok</a>, Fut::<a class=\"associatedtype\" href=\"trait.TryFuture.html#associatedtype.Error\" title=\"type futures_util::future::TryFuture::Error\">Error</a>>;</div>","MapErr<Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.MapErr.html\" title=\"struct futures_util::future::MapErr\">MapErr</a><Fut, F></code></h3><pre><code><div class=\"where\">impl<Fut, F> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.MapErr.html\" title=\"struct futures_util::future::MapErr\">MapErr</a><Fut, F><div class=\"where\">where\n <a class=\"struct\" href=\"struct.Map.html\" title=\"struct futures_util::future::Map\">Map</a><<a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut>, MapErrFn<F>>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <<a class=\"struct\" href=\"struct.Map.html\" title=\"struct futures_util::future::Map\">Map</a><<a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut>, MapErrFn<F>> as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div>","MapOk<Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.MapOk.html\" title=\"struct futures_util::future::MapOk\">MapOk</a><Fut, F></code></h3><pre><code><div class=\"where\">impl<Fut, F> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.MapOk.html\" title=\"struct futures_util::future::MapOk\">MapOk</a><Fut, F><div class=\"where\">where\n <a class=\"struct\" href=\"struct.Map.html\" title=\"struct futures_util::future::Map\">Map</a><<a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut>, MapOkFn<F>>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <<a class=\"struct\" href=\"struct.Map.html\" title=\"struct futures_util::future::Map\">Map</a><<a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut>, MapOkFn<F>> as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div>","MapOkOrElse<Self, F, E>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.MapOkOrElse.html\" title=\"struct futures_util::future::MapOkOrElse\">MapOkOrElse</a><Fut, F, G></code></h3><pre><code><div class=\"where\">impl<Fut, F, G> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.MapOkOrElse.html\" title=\"struct futures_util::future::MapOkOrElse\">MapOkOrElse</a><Fut, F, G><div class=\"where\">where\n <a class=\"struct\" href=\"struct.Map.html\" title=\"struct futures_util::future::Map\">Map</a><<a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut>, ChainFn<MapOkFn<F>, ChainFn<MapErrFn<G>, MergeResultFn>>>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <<a class=\"struct\" href=\"struct.Map.html\" title=\"struct futures_util::future::Map\">Map</a><<a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut>, ChainFn<MapOkFn<F>, ChainFn<MapErrFn<G>, MergeResultFn>>> as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div>","OkInto<Self, U>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.OkInto.html\" title=\"struct futures_util::future::OkInto\">OkInto</a><Fut, E></code></h3><pre><code><div class=\"where\">impl<Fut, E> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.OkInto.html\" title=\"struct futures_util::future::OkInto\">OkInto</a><Fut, E><div class=\"where\">where\n <a class=\"struct\" href=\"struct.MapOk.html\" title=\"struct futures_util::future::MapOk\">MapOk</a><Fut, IntoFn<E>>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <<a class=\"struct\" href=\"struct.MapOk.html\" title=\"struct futures_util::future::MapOk\">MapOk</a><Fut, IntoFn<E>> as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div>","OrElse<Self, Fut, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.OrElse.html\" title=\"struct futures_util::future::OrElse\">OrElse</a><Fut1, Fut2, F></code></h3><pre><code><div class=\"where\">impl<Fut1, Fut2, F> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.OrElse.html\" title=\"struct futures_util::future::OrElse\">OrElse</a><Fut1, Fut2, F><div class=\"where\">where\n TryFlattenErr<<a class=\"struct\" href=\"struct.MapErr.html\" title=\"struct futures_util::future::MapErr\">MapErr</a><Fut1, F>, Fut2>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <TryFlattenErr<<a class=\"struct\" href=\"struct.MapErr.html\" title=\"struct futures_util::future::MapErr\">MapErr</a><Fut1, F>, Fut2> as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div>","TryFlatten<Self, Self::Ok>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.TryFlatten.html\" title=\"struct futures_util::future::TryFlatten\">TryFlatten</a><Fut1, Fut2></code></h3><pre><code><div class=\"where\">impl<Fut1, Fut2> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.TryFlatten.html\" title=\"struct futures_util::future::TryFlatten\">TryFlatten</a><Fut1, Fut2><div class=\"where\">where\n TryFlatten<Fut1, Fut2>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <TryFlatten<Fut1, Fut2> as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div>","UnwrapOrElse<Self, F>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.UnwrapOrElse.html\" title=\"struct futures_util::future::UnwrapOrElse\">UnwrapOrElse</a><Fut, F></code></h3><pre><code><div class=\"where\">impl<Fut, F> <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"struct.UnwrapOrElse.html\" title=\"struct futures_util::future::UnwrapOrElse\">UnwrapOrElse</a><Fut, F><div class=\"where\">where\n <a class=\"struct\" href=\"struct.Map.html\" title=\"struct futures_util::future::Map\">Map</a><<a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut>, UnwrapOrElseFn<F>>: <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>,</div></div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" class=\"associatedtype\">Output</a> = <<a class=\"struct\" href=\"struct.Map.html\" title=\"struct futures_util::future::Map\">Map</a><<a class=\"struct\" href=\"struct.IntoFuture.html\" title=\"struct futures_util::future::IntoFuture\">IntoFuture</a><Fut>, UnwrapOrElseFn<F>> as <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a>>::<a class=\"associatedtype\" href=\"https://doc.rust-lang.org/1.82.0/core/future/future/trait.Future.html#associatedtype.Output\" title=\"type core::future::future::Future::Output\">Output</a>;</div>"}</script></section></div></main></body></html> |