mirror of
https://github.com/actix/actix-website
synced 2024-11-24 00:41:07 +01:00
53 lines
13 KiB
HTML
53 lines
13 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>Cheatsheet for Futures</title>
|
|
</head>
|
|
<body><pre style="margin: 0"><code style="background: transparent"><span style="color: #8e908c">// Constructing leaf futures</span>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/fn.empty.html">empty</a> () -> <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/fn.ok.html">ok</a> (<var>T</var>) -> <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/fn.err.html">err</a> (<var>E</var>) -> <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/fn.result.html">result</a>(<span style="color: #4271ae">Result</span><<var>T</var>, <var>E</var>>) -> <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>
|
|
|
|
<span style="color: #8e908c">// General future constructor</span>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/fn.poll_fn.html">poll_fn</a>(<span style="color: #8959a8">FnMut</span>(<span style="color: #3e999f">thread_local!</span>(<span style="color: #4271ae">Task</span>)) -> <span style="color: #4271ae">Poll</span><<var>T</var>, <var>E</var>>) -> <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>
|
|
|
|
<span style="color: #8e908c">// Mapping futures</span>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.map">Future::map</a> (<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>, <span style="color: #8959a8">FnOnce</span>(<var>T</var>) -> <var>U</var>) -> <span style="color: #c82829">Future</span><<var>U</var>, <var>E</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.map_err">Future::map_err</a> (<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>, <span style="color: #8959a8">FnOnce</span>(<var>E</var>) -> <var>F</var>) -> <span style="color: #c82829">Future</span><<var>T</var>, <var>F</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.from_err">Future::from_err</a>(<span style="color: #c82829">Future</span><<var>T</var>, <span style="color: #4271ae">Into</span><<var>E</var>>>) -> <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>
|
|
|
|
<span style="color: #8e908c">// Chaining (sequencing) futures</span>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.then">Future::then</a> (<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>, <span style="color: #8959a8">FnOnce</span>(<span style="color: #4271ae">Result</span><<var>T</var>, <var>E</var>>) -> <span style="color: #c82829">IntoFuture</span><<var>U</var>, <var>F</var>>) -> <span style="color: #c82829">Future</span><<var>U</var>, <var>F</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.and_then">Future::and_then</a>(<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>, <span style="color: #8959a8">FnOnce</span>(<var>T</var>) -> <span style="color: #c82829">IntoFuture</span><<var>U</var>, <var>E</var>>) -> <span style="color: #c82829">Future</span><<var>U</var>, <var>E</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.or_else">Future::or_else</a> (<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>, <span style="color: #8959a8">FnOnce</span>(<var>E</var>) -> <span style="color: #c82829">IntoFuture</span><<var>T</var>, <var>F</var>>) -> <span style="color: #c82829">Future</span><<var>T</var>, <var>F</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.flatten">Future::flatten</a> (<span style="color: #c82829">Future</span><<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>, <span style="color: #4271ae">Into</span><<var>E</var>>>) -> <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>
|
|
|
|
<span style="color: #8e908c">// Joining (waiting) futures</span>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.join">Future::join</a> (<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>, <span style="color: #c82829">IntoFuture</span><<var>U</var>, <var>E</var>>) -> <span style="color: #c82829">Future</span><(<var>T</var>, <var>U</var>), <var>E</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.join3">Future::join3</a>(<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>, <span style="color: #c82829">IntoFuture</span><<var>U</var>, <var>E</var>>, <span style="color: #c82829">IntoFuture</span><<var>V</var>, <var>E</var>>) -> <span style="color: #c82829">Future</span><(<var>T</var>, <var>U</var>, <var>V</var>), <var>E</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.join4">Future::join4</a>(<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>, <span style="color: #c82829">IntoFuture</span><<var>U</var>, <var>E</var>>, <span style="color: #c82829">IntoFuture</span><<var>V</var>, <var>E</var>>, <span style="color: #c82829">IntoFuture</span><<var>W</var>, <var>E</var>>) -> <span style="color: #c82829">Future</span><(<var>T</var>, <var>U</var>, <var>V</var>, <var>W</var>), <var>E</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.join5">Future::join5</a>(<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>, <span style="color: #c82829">IntoFuture</span><<var>U</var>, <var>E</var>>, <span style="color: #c82829">IntoFuture</span><<var>V</var>, <var>E</var>>, <span style="color: #c82829">IntoFuture</span><<var>W</var>, <var>E</var>>, <span style="color: #c82829">IntoFuture</span><<var>X</var>, <var>E</var>>) -> <span style="color: #c82829">Future</span><(<var>T</var>, <var>U</var>, <var>V</var>, <var>W</var>, <var>X</var>), <var>E</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/fn.join_all.html">join_all</a> (<span style="color: #4271ae">IntoIterator</span><<span style="color: #c82829">IntoFuture</span><<var>T</var>, <var>E</var>>>) -> <span style="color: #c82829">Future</span><<span style="color: #4271ae">Vec</span><<var>T</var>>, <var>E</var>>
|
|
|
|
<span style="color: #8e908c">// Selecting (racing) futures</span>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.select">Future::select</a> (<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>, <span style="color: #c82829">IntoFuture</span><<var>T</var>, <var>E</var>>) -> <span style="color: #c82829">Future</span><(<var>T</var>, <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>), (<var>E</var>, <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>)>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.select2">Future::select2</a>(<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>, <span style="color: #c82829">IntoFuture</span><<var>U</var>, <var>F</var>>) -> <span style="color: #c82829">Future</span><<span style="color: #4271ae">Either</span><(<var>T</var>, <span style="color: #c82829">Future</span><<var>U</var>, <var>F</var>>), (<var>U</var>, <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>)>, <span style="color: #4271ae">Either</span><(<var>E</var>, <span style="color: #c82829">Future</span><<var>U</var>, <var>F</var>>), (<var>F</var>, <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>)>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/fn.select_all.html">select_all</a> (<span style="color: #4271ae">IntoIterator</span><<span style="color: #c82829">IntoFuture</span><<var>T</var>, <var>E</var>>>) -> <span style="color: #c82829">Future</span><(<var>T</var>, <span style="color: #4271ae">usize</span>, <span style="color: #4271ae">Vec</span><<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>>), (<var>E</var>, <span style="color: #4271ae">usize</span>, <span style="color: #4271ae">Vec</span><<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>>)>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/fn.select_ok.html">select_ok</a> (<span style="color: #4271ae">IntoIterator</span><<span style="color: #c82829">IntoFuture</span><<var>T</var>, <var>E</var>>>) -> <span style="color: #c82829">Future</span><(<var>T</var>, <span style="color: #4271ae">Vec</span><<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>>), <var>E</var>>
|
|
|
|
<span style="color: #8e908c">// Utility</span>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/fn.lazy.html">lazy</a> (<span style="color: #8959a8">FnOnce</span>() -> <span style="color: #c82829">IntoFuture</span><<var>T</var>, <var>E</var>>) -> <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/fn.loop_fn.html">loop_fn</a> (<var>S</var>, <span style="color: #8959a8">FnMut</span>(<var>S</var>) -> <span style="color: #c82829">IntoFuture</span><<span style="color: #4271ae">Loop</span><<var>T</var>, <var>S</var>>, <var>E</var>>) -> <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>
|
|
|
|
<span style="color: #8e908c">// Miscellaneous</span>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.into_stream">Future::into_stream</a> (<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>) -> <span style="color: #4271ae">Stream</span><<var>T</var>, <var>E</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.flatten_stream">Future::flatten_stream</a>(<span style="color: #c82829">Future</span><<span style="color: #4271ae">Stream</span><<var>T</var>, <var>E</var>>, <var>E</var>>) -> <span style="color: #4271ae">Stream</span><<var>T</var>, <var>E</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.fuse">Future::fuse</a> (<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>) -> <span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.catch_unwind">Future::catch_unwind</a> (<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>+<span style="color: #4271ae">UnwindSafe</span>) -> <span style="color: #c82829">Future</span><<span style="color: #4271ae">Result</span><<var>T</var>, <var>E</var>>, <span style="color: #4271ae">Any</span>+<span style="color: #4271ae">Send</span>>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.shared">Future::shared</a> (<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>) -> <span style="color: #c82829">Future</span><<span style="color: #4271ae">SharedItem</span><<var>T</var>>, <span style="color: #4271ae">SharedError</span><<var>E</var>>>+<span style="color: #4271ae">Clone</span>
|
|
<span style="color: #8959a8">fn</span> <a href="https://docs.rs/futures/0.1.13/futures/future/trait.Future.html#method.wait">Future::wait</a> (<span style="color: #c82829">Future</span><<var>T</var>, <var>E</var>>) -> <span style="color: #4271ae">Result</span><<var>T</var>, <var>E</var>>
|
|
</code></pre></body>
|
|
</html> |