mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
36 lines
8.8 KiB
HTML
36 lines
8.8 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="API documentation for the Rust `join_all` fn in crate `futures`."><meta name="keywords" content="rust, rustlang, rust-lang, join_all"><title>futures::prelude::future::join_all - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../../ayu.css" disabled ><script id="default-settings"></script><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
|
||
<link rel="alternate icon" type="image/png" href="../../../favicon-16x16.png">
|
||
<link rel="alternate icon" type="image/png" href="../../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../../futures/index.html'><div class='logo-container rust-logo'><img src='../../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../../index.html">futures</a>::<wbr><a href="../index.html">prelude</a>::<wbr><a href="index.html">future</a></p><div id="sidebar-vars" data-name="join_all" data-ty="fn" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" class="help-button">?</button>
|
||
<a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Function <a href="../../index.html">futures</a>::<wbr><a href="../index.html">prelude</a>::<wbr><a href="index.html">future</a>::<wbr><a class="fn" href="">join_all</a></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../../src/futures_util/future/join_all.rs.html#82-85" title="goto source code">[src]</a></span></h1><pre class="rust fn">pub fn join_all<I>(i: I) -> <a class="struct" href="../../../futures/future/struct.JoinAll.html" title="struct futures::future::JoinAll">JoinAll</a><<I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>><span class="notable-traits"><span class="notable-traits-tooltip">ⓘ<div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../../../futures/future/struct.JoinAll.html" title="struct futures::future::JoinAll">JoinAll</a><F></h3><code class="content"><span class="where fmt-newline">impl<F> <a class="trait" href="../../../futures/future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="../../../futures/future/struct.JoinAll.html" title="struct futures::future::JoinAll">JoinAll</a><F> <span class="where fmt-newline">where<br> F: <a class="trait" href="../../../futures/future/trait.Future.html" title="trait futures::future::Future">Future</a>, </span></span><span class="where fmt-newline"> type <a href="../../../futures/future/trait.Future.html#associatedtype.Output" class="type">Output</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<F as <a class="trait" href="../../../futures/future/trait.Future.html" title="trait futures::future::Future">Future</a>>::<a class="type" href="../../../futures/future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>>;</span></code></span></div></span></span> <span class="where fmt-newline">where<br> I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,<br> <I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="../../../futures/future/trait.Future.html" title="trait futures::future::Future">Future</a>, </span></pre><div class="docblock"><p>Creates a future which represents a collection of the outputs of the futures
|
||
given.</p>
|
||
<p>The returned future will drive execution for all of its underlying futures,
|
||
collecting the results into a destination <code>Vec<T></code> in the same order as they
|
||
were provided.</p>
|
||
<p>This function 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>
|
||
<h1 id="see-also" class="section-header"><a href="#see-also">See Also</a></h1>
|
||
<p>This is purposefully a very simple API for basic use-cases. In a lot of
|
||
cases you will want to use the more powerful
|
||
<a href="../../../futures/stream/struct.FuturesOrdered.html" title="crate::stream::FuturesOrdered"><code>FuturesOrdered</code></a> APIs, or, if order does
|
||
not matter, <a href="../../../futures/stream/struct.FuturesUnordered.html" title="crate::stream::FuturesUnordered"><code>FuturesUnordered</code></a>.</p>
|
||
<p>Some examples for additional functionality provided by these are:</p>
|
||
<ul>
|
||
<li>
|
||
<p>Adding new futures to the set even after it has been started.</p>
|
||
</li>
|
||
<li>
|
||
<p>Only polling the specific futures that have been woken. In cases where
|
||
you have a lot of futures this will result in much more efficient polling.</p>
|
||
</li>
|
||
</ul>
|
||
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">futures</span>::<span class="ident">future</span>::<span class="ident">join_all</span>;
|
||
|
||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">foo</span>(<span class="ident">i</span>: <span class="ident">u32</span>) <span class="op">-</span><span class="op">></span> <span class="ident">u32</span> { <span class="ident">i</span> }
|
||
|
||
<span class="kw">let</span> <span class="ident">futures</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="ident">foo</span>(<span class="number">1</span>), <span class="ident">foo</span>(<span class="number">2</span>), <span class="ident">foo</span>(<span class="number">3</span>)];
|
||
|
||
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">join_all</span>(<span class="ident">futures</span>).<span class="kw">await</span>, [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);</pre></div>
|
||
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="futures"></div>
|
||
<script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html> |