blob: 0ebfaf7c389182e7de1903c30928cedde85c4ede [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="An extension trait for `Stream`s that provides a variety of convenient combinator functions."><meta name="keywords" content="rust, rustlang, rust-lang, StreamExt"><title>StreamExt in futures::stream - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../../normalize.css"><link rel="stylesheet" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../../ayu.css" disabled><link rel="stylesheet" href="../../dark.css" disabled><link rel="stylesheet" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../main.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../../futures/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../futures/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">StreamExt</a></h2><div class="sidebar-elems"><section><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.all">all</a></li><li><a href="#method.any">any</a></li><li><a href="#method.boxed">boxed</a></li><li><a href="#method.boxed_local">boxed_local</a></li><li><a href="#method.buffer_unordered">buffer_unordered</a></li><li><a href="#method.buffered">buffered</a></li><li><a href="#method.by_ref">by_ref</a></li><li><a href="#method.catch_unwind">catch_unwind</a></li><li><a href="#method.chain">chain</a></li><li><a href="#method.chunks">chunks</a></li><li><a href="#method.collect">collect</a></li><li><a href="#method.concat">concat</a></li><li><a href="#method.count">count</a></li><li><a href="#method.cycle">cycle</a></li><li><a href="#method.enumerate">enumerate</a></li><li><a href="#method.filter">filter</a></li><li><a href="#method.filter_map">filter_map</a></li><li><a href="#method.flat_map">flat_map</a></li><li><a href="#method.flat_map_unordered">flat_map_unordered</a></li><li><a href="#method.flatten">flatten</a></li><li><a href="#method.flatten_unordered">flatten_unordered</a></li><li><a href="#method.fold">fold</a></li><li><a href="#method.for_each">for_each</a></li><li><a href="#method.for_each_concurrent">for_each_concurrent</a></li><li><a href="#method.forward">forward</a></li><li><a href="#method.fuse">fuse</a></li><li><a href="#method.inspect">inspect</a></li><li><a href="#method.into_future">into_future</a></li><li><a href="#method.left_stream">left_stream</a></li><li><a href="#method.map">map</a></li><li><a href="#method.next">next</a></li><li><a href="#method.peekable">peekable</a></li><li><a href="#method.poll_next_unpin">poll_next_unpin</a></li><li><a href="#method.ready_chunks">ready_chunks</a></li><li><a href="#method.right_stream">right_stream</a></li><li><a href="#method.scan">scan</a></li><li><a href="#method.select_next_some">select_next_some</a></li><li><a href="#method.skip">skip</a></li><li><a href="#method.skip_while">skip_while</a></li><li><a href="#method.split">split</a></li><li><a href="#method.take">take</a></li><li><a href="#method.take_until">take_until</a></li><li><a href="#method.take_while">take_while</a></li><li><a href="#method.then">then</a></li><li><a href="#method.unzip">unzip</a></li><li><a href="#method.zip">zip</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In futures::stream</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Trait <a href="../index.html">futures</a>::<wbr><a href="index.html">stream</a>::<wbr><a class="trait" href="#">StreamExt</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#249">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust trait"><code>pub trait StreamExt: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a> {
<details class="rustdoc-toggle type-contents-toggle"><summary class="hideme"><span>Show 46 methods</span></summary> fn <a href="#method.next" class="fnname">next</a>(&amp;mut self) -&gt; <a class="struct" href="struct.Next.html" title="struct futures::stream::Next">Next</a>&lt;'_, Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Next.html" title="struct futures::stream::Next">Next</a>&lt;'_, St&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Next.html" title="struct futures::stream::Next">Next</a>&lt;'_, St&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.into_future" class="fnname">into_future</a>(self) -&gt; <a class="struct" href="struct.StreamFuture.html" title="struct futures::stream::StreamFuture">StreamFuture</a>&lt;Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.StreamFuture.html" title="struct futures::stream::StreamFuture">StreamFuture</a>&lt;St&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.StreamFuture.html" title="struct futures::stream::StreamFuture">StreamFuture</a>&lt;St&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = (<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;, St);</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.map" class="fnname">map</a>&lt;T, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.Map.html" title="struct futures::stream::Map">Map</a>&lt;Self, F&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; T</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.enumerate" class="fnname">enumerate</a>(self) -&gt; <a class="struct" href="struct.Enumerate.html" title="struct futures::stream::Enumerate">Enumerate</a>&lt;Self&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.filter" class="fnname">filter</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.Filter.html" title="struct futures::stream::Filter">Filter</a>&lt;Self, Fut, F&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.filter_map" class="fnname">filter_map</a>&lt;Fut, T, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.FilterMap.html" title="struct futures::stream::FilterMap">FilterMap</a>&lt;Self, Fut, F&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.then" class="fnname">then</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.Then.html" title="struct futures::stream::Then">Then</a>&lt;Self, Fut, F&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.collect" class="fnname">collect</a>&lt;C&gt;(self) -&gt; <a class="struct" href="struct.Collect.html" title="struct futures::stream::Collect">Collect</a>&lt;Self, C&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Collect.html" title="struct futures::stream::Collect">Collect</a>&lt;St, C&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, C&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Collect.html" title="struct futures::stream::Collect">Collect</a>&lt;St, C&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;C: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = C;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.unzip" class="fnname">unzip</a>&lt;A, B, FromA, FromB&gt;(self) -&gt; <a class="struct" href="struct.Unzip.html" title="struct futures::stream::Unzip">Unzip</a>&lt;Self, FromA, FromB&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Unzip.html" title="struct futures::stream::Unzip">Unzip</a>&lt;St, FromA, FromB&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, A, B, FromA, FromB&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Unzip.html" title="struct futures::stream::Unzip">Unzip</a>&lt;St, FromA, FromB&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(A, B)</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;FromA: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;A&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;FromB: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;B&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(FromA, FromB)</a>;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FromA: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;A&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FromB: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;B&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(A, B)</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.concat" class="fnname">concat</a>(self) -&gt; <a class="struct" href="struct.Concat.html" title="struct futures::stream::Concat">Concat</a>&lt;Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Concat.html" title="struct futures::stream::Concat">Concat</a>&lt;St&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Concat.html" title="struct futures::stream::Concat">Concat</a>&lt;St&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;&lt;&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a> 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>&gt;::<a class="associatedtype" 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>&gt; + <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="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;&lt;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a> 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>&gt;::<a class="associatedtype" 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>&gt; + <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="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.count" class="fnname">count</a>(self) -&gt; <a class="struct" href="struct.Count.html" title="struct futures::stream::Count">Count</a>&lt;Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Count.html" title="struct futures::stream::Count">Count</a>&lt;St&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Count.html" title="struct futures::stream::Count">Count</a>&lt;St&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>;</span></code></span></span></span></span> { ... }
<span class="item-spacer"></span> fn <a href="#method.cycle" class="fnname">cycle</a>(self) -&gt; <a class="struct" href="struct.Cycle.html" title="struct futures::stream::Cycle">Cycle</a>&lt;Self&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.fold" class="fnname">fold</a>&lt;T, Fut, F&gt;(self, init: T, f: F) -&gt; <a class="struct" href="struct.Fold.html" title="struct futures::stream::Fold">Fold</a>&lt;Self, Fut, T, F&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Fold.html" title="struct futures::stream::Fold">Fold</a>&lt;St, Fut, T, F&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, Fut, T, F&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Fold.html" title="struct futures::stream::Fold">Fold</a>&lt;St, Fut, T, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(T, &lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = T&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = T;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(T, Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = T&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.any" class="fnname">any</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.Any.html" title="struct futures::stream::Any">Any</a>&lt;Self, Fut, F&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Any.html" title="struct futures::stream::Any">Any</a>&lt;St, Fut, F&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, Fut, F&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Any.html" title="struct futures::stream::Any">Any</a>&lt;St, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.all" class="fnname">all</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.All.html" title="struct futures::stream::All">All</a>&lt;Self, Fut, F&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.All.html" title="struct futures::stream::All">All</a>&lt;St, Fut, F&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, Fut, F&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.All.html" title="struct futures::stream::All">All</a>&lt;St, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.flatten" class="fnname">flatten</a>(self) -&gt; <a class="struct" href="struct.Flatten.html" title="struct futures::stream::Flatten">Flatten</a>&lt;Self&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.flatten_unordered" class="fnname">flatten_unordered</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;limit: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; FlattenUnorderedWithFlowController&lt;Self, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.flat_map" class="fnname">flat_map</a>&lt;U, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.FlatMap.html" title="struct futures::stream::FlatMap">FlatMap</a>&lt;Self, U, F&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; U,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.flat_map_unordered" class="fnname">flat_map_unordered</a>&lt;U, F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;limit: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="struct" href="struct.FlatMapUnordered.html" title="struct futures::stream::FlatMapUnordered">FlatMapUnordered</a>&lt;Self, U, F&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; U</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.scan" class="fnname">scan</a>&lt;S, B, Fut, F&gt;(self, initial_state: S, f: F) -&gt; <a class="struct" href="struct.Scan.html" title="struct futures::stream::Scan">Scan</a>&lt;Self, S, Fut, F&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>S, Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;B&gt;&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.skip_while" class="fnname">skip_while</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.SkipWhile.html" title="struct futures::stream::SkipWhile">SkipWhile</a>&lt;Self, Fut, F&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.take_while" class="fnname">take_while</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.TakeWhile.html" title="struct futures::stream::TakeWhile">TakeWhile</a>&lt;Self, Fut, F&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.take_until" class="fnname">take_until</a>&lt;Fut&gt;(self, fut: Fut) -&gt; <a class="struct" href="struct.TakeUntil.html" title="struct futures::stream::TakeUntil">TakeUntil</a>&lt;Self, Fut&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.for_each" class="fnname">for_each</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.ForEach.html" title="struct futures::stream::ForEach">ForEach</a>&lt;Self, Fut, F&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.ForEach.html" title="struct futures::stream::ForEach">ForEach</a>&lt;St, Fut, F&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, Fut, F&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.ForEach.html" title="struct futures::stream::ForEach">ForEach</a>&lt;St, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.for_each_concurrent" class="fnname">for_each_concurrent</a>&lt;Fut, F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;limit: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="struct" href="struct.ForEachConcurrent.html" title="struct futures::stream::ForEachConcurrent">ForEachConcurrent</a>&lt;Self, Fut, F&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.ForEachConcurrent.html" title="struct futures::stream::ForEachConcurrent">ForEachConcurrent</a>&lt;St, Fut, F&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, Fut, F&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.ForEachConcurrent.html" title="struct futures::stream::ForEachConcurrent">ForEachConcurrent</a>&lt;St, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.take" class="fnname">take</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.Take.html" title="struct futures::stream::Take">Take</a>&lt;Self&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.skip" class="fnname">skip</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.Skip.html" title="struct futures::stream::Skip">Skip</a>&lt;Self&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.fuse" class="fnname">fuse</a>(self) -&gt; <a class="struct" href="struct.Fuse.html" title="struct futures::stream::Fuse">Fuse</a>&lt;Self&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.by_ref" class="fnname">by_ref</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self { ... }
<span class="item-spacer"></span> fn <a href="#method.catch_unwind" class="fnname">catch_unwind</a>(self) -&gt; <a class="struct" href="struct.CatchUnwind.html" title="struct futures::stream::CatchUnwind">CatchUnwind</a>&lt;Self&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.boxed" class="fnname">boxed</a>&lt;'a&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'a, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;P&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;P&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;P&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;P as <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a>: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;&lt;P as <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a> as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: 'a + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.boxed_local" class="fnname">boxed_local</a>&lt;'a&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt; + 'a, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;P&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;P&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;P&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;P as <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a>: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;&lt;P as <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a> as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: 'a</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.buffered" class="fnname">buffered</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.Buffered.html" title="struct futures::stream::Buffered">Buffered</a>&lt;Self&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.buffer_unordered" class="fnname">buffer_unordered</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.BufferUnordered.html" title="struct futures::stream::BufferUnordered">BufferUnordered</a>&lt;Self&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.zip" class="fnname">zip</a>&lt;St&gt;(self, other: St) -&gt; <a class="struct" href="struct.Zip.html" title="struct futures::stream::Zip">Zip</a>&lt;Self, St&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.chain" class="fnname">chain</a>&lt;St&gt;(self, other: St) -&gt; <a class="struct" href="struct.Chain.html" title="struct futures::stream::Chain">Chain</a>&lt;Self, St&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.peekable" class="fnname">peekable</a>(self) -&gt; <a class="struct" href="struct.Peekable.html" title="struct futures::stream::Peekable">Peekable</a>&lt;Self&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.chunks" class="fnname">chunks</a>(self, capacity: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.Chunks.html" title="struct futures::stream::Chunks">Chunks</a>&lt;Self&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.ready_chunks" class="fnname">ready_chunks</a>(self, capacity: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.ReadyChunks.html" title="struct futures::stream::ReadyChunks">ReadyChunks</a>&lt;Self&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.forward" class="fnname">forward</a>&lt;S&gt;(self, sink: S) -&gt; <a class="struct" href="struct.Forward.html" title="struct futures::stream::Forward">Forward</a>&lt;Self, S&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Forward.html" title="struct futures::stream::Forward">Forward</a>&lt;St, Si&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, Si&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Forward.html" title="struct futures::stream::Forward">Forward</a>&lt;St, Si&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Forward&lt;St, Si, &lt;St as <a class="trait" href="trait.TryStream.html" title="trait futures::stream::TryStream">TryStream</a>&gt;::<a class="associatedtype" href="trait.TryStream.html#associatedtype.Ok" title="type futures::stream::TryStream::Ok">Ok</a>&gt;: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.TryStream.html" title="trait futures::stream::TryStream">TryStream</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;Forward&lt;St, Si, &lt;St as <a class="trait" href="trait.TryStream.html" title="trait futures::stream::TryStream">TryStream</a>&gt;::<a class="associatedtype" href="trait.TryStream.html#associatedtype.Ok" title="type futures::stream::TryStream::Ok">Ok</a>&gt; as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="../sink/trait.Sink.html" title="trait futures::sink::Sink">Sink</a>&lt;Self::<a class="associatedtype" href="trait.TryStream.html#associatedtype.Ok" title="type futures::stream::TryStream::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.TryStream.html#associatedtype.Error" title="type futures::stream::TryStream::Error">Error</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="trait.TryStream.html" title="trait futures::stream::TryStream">TryStream</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.split" class="fnname">split</a>&lt;Item&gt;(self) -&gt; (<a class="struct" href="struct.SplitSink.html" title="struct futures::stream::SplitSink">SplitSink</a>&lt;Self, Item&gt;, <a class="struct" href="struct.SplitStream.html" title="struct futures::stream::SplitStream">SplitStream</a>&lt;Self&gt;)<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="../sink/trait.Sink.html" title="trait futures::sink::Sink">Sink</a>&lt;Item&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.inspect" class="fnname">inspect</a>&lt;F&gt;(self, f: F) -&gt; <a class="struct" href="struct.Inspect.html" title="struct futures::stream::Inspect">Inspect</a>&lt;Self, F&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>)</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.left_stream" class="fnname">left_stream</a>&lt;B&gt;(self) -&gt; <a class="enum" href="../future/enum.Either.html" title="enum futures::future::Either">Either</a>&lt;Self, B&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="enum" href="../future/enum.Either.html" title="enum futures::future::Either">Either</a>&lt;A, B&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;A, B&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="enum" href="../future/enum.Either.html" title="enum futures::future::Either">Either</a>&lt;A, B&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = &lt;A as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;A as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.right_stream" class="fnname">right_stream</a>&lt;B&gt;(self) -&gt; <a class="enum" href="../future/enum.Either.html" title="enum futures::future::Either">Either</a>&lt;B, Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="enum" href="../future/enum.Either.html" title="enum futures::future::Either">Either</a>&lt;A, B&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;A, B&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="enum" href="../future/enum.Either.html" title="enum futures::future::Either">Either</a>&lt;A, B&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = &lt;A as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;A as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;</span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.poll_next_unpin" class="fnname">poll_next_unpin</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cx: &amp;mut <a class="struct" href="../task/struct.Context.html" title="struct futures::task::Context">Context</a>&lt;'_&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;) -&gt; <a class="enum" href="../task/enum.Poll.html" title="enum futures::task::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a></span>,
{ ... }
<span class="item-spacer"></span> fn <a href="#method.select_next_some" class="fnname">select_next_some</a>(&amp;mut self) -&gt; <a class="struct" href="struct.SelectNextSome.html" title="struct futures::stream::SelectNextSome">SelectNextSome</a>&lt;'_, Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.SelectNextSome.html" title="struct futures::stream::SelectNextSome">SelectNextSome</a>&lt;'_, St&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.SelectNextSome.html" title="struct futures::stream::SelectNextSome">SelectNextSome</a>&lt;'_, St&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.FusedStream.html" title="trait futures::stream::FusedStream">FusedStream</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>;</span></code></span></span></span></span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> + <a class="trait" href="trait.FusedStream.html" title="trait futures::stream::FusedStream">FusedStream</a></span>,
{ ... }
</details>}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An extension trait for <code>Stream</code>s that provides a variety of convenient
combinator functions.</p>
</div></details><h2 id="provided-methods" class="small-section-header">Provided Methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.next" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#273-275">source</a><h4 class="code-header">fn <a href="#method.next" class="fnname">next</a>(&amp;mut self) -&gt; <a class="struct" href="struct.Next.html" title="struct futures::stream::Next">Next</a>&lt;'_, Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Next.html" title="struct futures::stream::Next">Next</a>&lt;'_, St&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Next.html" title="struct futures::stream::Next">Next</a>&lt;'_, St&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</span></h4></section></summary><div class="docblock"><p>Creates a future that resolves to the next item in the stream.</p>
<p>Note that because <code>next</code> doesn’t take ownership over the stream,
the <a href="trait.Stream.html" title="Stream"><code>Stream</code></a> type must be <a href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="Unpin"><code>Unpin</code></a>. If you want to use <code>next</code> with a
<a href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html"><code>!Unpin</code></a> stream, you’ll first have to pin the stream. This can
be done by boxing the stream using <a href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html#method.pin" title="Box::pin"><code>Box::pin</code></a> or
pinning it to the stack using the <code>pin_mut!</code> macro from the <code>pin_utils</code>
crate.</p>
<h5 id="examples"><a href="#examples">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span><span class="kw-2">mut </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">3</span>);
<span class="macro">assert_eq!</span>(stream.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>(<span class="number">1</span>));
<span class="macro">assert_eq!</span>(stream.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>(<span class="number">2</span>));
<span class="macro">assert_eq!</span>(stream.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>(<span class="number">3</span>));
<span class="macro">assert_eq!</span>(stream.next().<span class="kw">await</span>, <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into_future" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#308-310">source</a><h4 class="code-header">fn <a href="#method.into_future" class="fnname">into_future</a>(self) -&gt; <a class="struct" href="struct.StreamFuture.html" title="struct futures::stream::StreamFuture">StreamFuture</a>&lt;Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.StreamFuture.html" title="struct futures::stream::StreamFuture">StreamFuture</a>&lt;St&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.StreamFuture.html" title="struct futures::stream::StreamFuture">StreamFuture</a>&lt;St&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = (<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;, St);</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</span></h4></section></summary><div class="docblock"><p>Converts this stream into a future of <code>(next_item, tail_of_stream)</code>.
If the stream terminates, then the next item is <a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None" title="None"><code>None</code></a>.</p>
<p>The returned future can be used to compose streams and futures together
by placing everything into the “world of futures”.</p>
<p>Note that because <code>into_future</code> moves the stream, the <a href="trait.Stream.html" title="Stream"><code>Stream</code></a> type
must be <a href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="Unpin"><code>Unpin</code></a>. If you want to use <code>into_future</code> with a
<a href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html"><code>!Unpin</code></a> stream, you’ll first have to pin the stream. This can
be done by boxing the stream using <a href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html#method.pin" title="Box::pin"><code>Box::pin</code></a> or
pinning it to the stack using the <code>pin_mut!</code> macro from the <code>pin_utils</code>
crate.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">3</span>);
<span class="kw">let </span>(item, stream) = stream.into_future().<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">1</span>), item);
<span class="kw">let </span>(item, stream) = stream.into_future().<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">2</span>), item);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.map" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#338-341">source</a><h4 class="code-header">fn <a href="#method.map" class="fnname">map</a>&lt;T, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.Map.html" title="struct futures::stream::Map">Map</a>&lt;Self, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; T,</span></h4></section></summary><div class="docblock"><p>Maps this stream’s items to a different type, returning a new stream of
the resulting type.</p>
<p>The provided closure is executed over all elements of this stream as
they are made available. It is executed inline with calls to
<a href="trait.Stream.html#tymethod.poll_next"><code>poll_next</code></a>.</p>
<p>Note that this function consumes the stream passed into it and returns a
wrapped version of it, similar to the existing <code>map</code> methods in the
standard library.</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">3</span>);
<span class="kw">let </span>stream = stream.map(|x| x + <span class="number">3</span>);
<span class="macro">assert_eq!</span>(<span class="macro">vec!</span>[<span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>], stream.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;().<span class="kw">await</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.enumerate" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#384-386">source</a><h4 class="code-header">fn <a href="#method.enumerate" class="fnname">enumerate</a>(self) -&gt; <a class="struct" href="struct.Enumerate.html" title="struct futures::stream::Enumerate">Enumerate</a>&lt;Self&gt;</h4></section></summary><div class="docblock"><p>Creates a stream which gives the current iteration count as well as
the next value.</p>
<p>The stream returned yields pairs <code>(i, val)</code>, where <code>i</code> is the
current index of iteration and <code>val</code> is the value returned by the
stream.</p>
<p><code>enumerate()</code> keeps its count as a <a href="https://doc.rust-lang.org/nightly/std/primitive.usize.html" title="usize"><code>usize</code></a>. If you want to count by a
different sized integer, the <a href="trait.StreamExt.html#method.zip"><code>zip</code></a> function provides similar
functionality.</p>
<h5 id="overflow-behavior"><a href="#overflow-behavior">Overflow Behavior</a></h5>
<p>The method does no guarding against overflows, so enumerating more than
[<code>prim@usize::max_value()</code>] elements either produces the wrong result or panics. If
debug assertions are enabled, a panic is guaranteed.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>The returned stream might panic if the to-be-returned index would
overflow a <a href="https://doc.rust-lang.org/nightly/std/primitive.usize.html" title="usize"><code>usize</code></a>.</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="macro">vec!</span>[<span class="string">&#39;a&#39;</span>, <span class="string">&#39;b&#39;</span>, <span class="string">&#39;c&#39;</span>]);
<span class="kw">let </span><span class="kw-2">mut </span>stream = stream.enumerate();
<span class="macro">assert_eq!</span>(stream.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>((<span class="number">0</span>, <span class="string">&#39;a&#39;</span>)));
<span class="macro">assert_eq!</span>(stream.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>((<span class="number">1</span>, <span class="string">&#39;b&#39;</span>)));
<span class="macro">assert_eq!</span>(stream.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>((<span class="number">2</span>, <span class="string">&#39;c&#39;</span>)));
<span class="macro">assert_eq!</span>(stream.next().<span class="kw">await</span>, <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.filter" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#417-421">source</a><h4 class="code-header">fn <a href="#method.filter" class="fnname">filter</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.Filter.html" title="struct futures::stream::Filter">Filter</a>&lt;Self, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Filters the values produced by this stream according to the provided
asynchronous predicate.</p>
<p>As values of this stream are made available, the provided predicate <code>f</code>
will be run against them. If the predicate returns a <code>Future</code> which
resolves to <code>true</code>, then the stream will yield the value, but if the
predicate returns a <code>Future</code> which resolves to <code>false</code>, then the value
will be discarded and the next value will be produced.</p>
<p>Note that this function consumes the stream passed into it and returns a
wrapped version of it, similar to the existing <code>filter</code> methods in the
standard library.</p>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future;
<span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">10</span>);
<span class="kw">let </span>events = stream.filter(|x| future::ready(x % <span class="number">2 </span>== <span class="number">0</span>));
<span class="macro">assert_eq!</span>(<span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">4</span>, <span class="number">6</span>, <span class="number">8</span>, <span class="number">10</span>], events.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;().<span class="kw">await</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.filter_map" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#451-455">source</a><h4 class="code-header">fn <a href="#method.filter_map" class="fnname">filter_map</a>&lt;Fut, T, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.FilterMap.html" title="struct futures::stream::FilterMap">FilterMap</a>&lt;Self, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;T&gt;&gt;,</span></h4></section></summary><div class="docblock"><p>Filters the values produced by this stream while simultaneously mapping
them to a different type according to the provided asynchronous closure.</p>
<p>As values of this stream are made available, the provided function will
be run on them. If the future returned by the predicate <code>f</code> resolves to
<a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.Some"><code>Some(item)</code></a> then the stream will yield the value <code>item</code>, but if
it resolves to <a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None" title="None"><code>None</code></a> then the next value will be produced.</p>
<p>Note that this function consumes the stream passed into it and returns a
wrapped version of it, similar to the existing <code>filter_map</code> methods in
the standard library.</p>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">10</span>);
<span class="kw">let </span>events = stream.filter_map(|x| <span class="kw">async move </span>{
<span class="kw">if </span>x % <span class="number">2 </span>== <span class="number">0 </span>{ <span class="prelude-val">Some</span>(x + <span class="number">1</span>) } <span class="kw">else </span>{ <span class="prelude-val">None </span>}
});
<span class="macro">assert_eq!</span>(<span class="macro">vec!</span>[<span class="number">3</span>, <span class="number">5</span>, <span class="number">7</span>, <span class="number">9</span>, <span class="number">11</span>], events.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;().<span class="kw">await</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.then" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#482-486">source</a><h4 class="code-header">fn <a href="#method.then" class="fnname">then</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.Then.html" title="struct futures::stream::Then">Then</a>&lt;Self, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,</span></h4></section></summary><div class="docblock"><p>Computes from this stream’s items new items of a different type using
an asynchronous closure.</p>
<p>The provided closure <code>f</code> will be called with an <code>Item</code> once a value is
ready, it returns a future which will then be run to completion
to produce the next value on this stream.</p>
<p>Note that this function consumes the stream passed into it and returns a
wrapped version of it.</p>
<h5 id="examples-6"><a href="#examples-6">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">3</span>);
<span class="kw">let </span>stream = stream.then(|x| <span class="kw">async move </span>{ x + <span class="number">3 </span>});
<span class="macro">assert_eq!</span>(<span class="macro">vec!</span>[<span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>], stream.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;().<span class="kw">await</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.collect" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#516-518">source</a><h4 class="code-header">fn <a href="#method.collect" class="fnname">collect</a>&lt;C&gt;(self) -&gt; <a class="struct" href="struct.Collect.html" title="struct futures::stream::Collect">Collect</a>&lt;Self, C&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Collect.html" title="struct futures::stream::Collect">Collect</a>&lt;St, C&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, C&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Collect.html" title="struct futures::stream::Collect">Collect</a>&lt;St, C&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;C: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = C;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;C: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Transforms a stream into a collection, returning a
future representing the result of that computation.</p>
<p>The returned future will be resolved when the stream terminates.</p>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::channel::mpsc;
<span class="kw">use </span>futures::stream::StreamExt;
<span class="kw">use </span>std::thread;
<span class="kw">let </span>(tx, rx) = mpsc::unbounded();
thread::spawn(<span class="kw">move </span>|| {
<span class="kw">for </span>i <span class="kw">in </span><span class="number">1</span>..=<span class="number">5 </span>{
tx.unbounded_send(i).unwrap();
}
});
<span class="kw">let </span>output = rx.collect::&lt;Vec&lt;i32&gt;&gt;().<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(output, <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.unzip" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#553-557">source</a><h4 class="code-header">fn <a href="#method.unzip" class="fnname">unzip</a>&lt;A, B, FromA, FromB&gt;(self) -&gt; <a class="struct" href="struct.Unzip.html" title="struct futures::stream::Unzip">Unzip</a>&lt;Self, FromA, FromB&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Unzip.html" title="struct futures::stream::Unzip">Unzip</a>&lt;St, FromA, FromB&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, A, B, FromA, FromB&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Unzip.html" title="struct futures::stream::Unzip">Unzip</a>&lt;St, FromA, FromB&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(A, B)</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;FromA: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;A&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;FromB: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;B&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(FromA, FromB)</a>;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;FromA: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;A&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;FromB: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;B&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(A, B)</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Converts a stream of pairs into a future, which
resolves to pair of containers.</p>
<p><code>unzip()</code> produces a future, which resolves to two
collections: one from the left elements of the pairs,
and one from the right elements.</p>
<p>The returned future will be resolved when the stream terminates.</p>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::channel::mpsc;
<span class="kw">use </span>futures::stream::StreamExt;
<span class="kw">use </span>std::thread;
<span class="kw">let </span>(tx, rx) = mpsc::unbounded();
thread::spawn(<span class="kw">move </span>|| {
tx.unbounded_send((<span class="number">1</span>, <span class="number">2</span>)).unwrap();
tx.unbounded_send((<span class="number">3</span>, <span class="number">4</span>)).unwrap();
tx.unbounded_send((<span class="number">5</span>, <span class="number">6</span>)).unwrap();
});
<span class="kw">let </span>(o1, o2): (Vec&lt;<span class="kw">_</span>&gt;, Vec&lt;<span class="kw">_</span>&gt;) = rx.unzip().<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(o1, <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">3</span>, <span class="number">5</span>]);
<span class="macro">assert_eq!</span>(o2, <span class="macro">vec!</span>[<span class="number">2</span>, <span class="number">4</span>, <span class="number">6</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.concat" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#594-597">source</a><h4 class="code-header">fn <a href="#method.concat" class="fnname">concat</a>(self) -&gt; <a class="struct" href="struct.Concat.html" title="struct futures::stream::Concat">Concat</a>&lt;Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Concat.html" title="struct futures::stream::Concat">Concat</a>&lt;St&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Concat.html" title="struct futures::stream::Concat">Concat</a>&lt;St&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;&lt;&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a> 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>&gt;::<a class="associatedtype" 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>&gt; + <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="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html" title="trait core::iter::traits::collect::Extend">Extend</a>&lt;&lt;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a> 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>&gt;::<a class="associatedtype" 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>&gt; + <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="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a>,</span></h4></section></summary><div class="docblock"><p>Concatenate all items of a stream into a single extendable
destination, returning a future representing the end result.</p>
<p>This combinator will extend the first item with the contents
of all the subsequent results of the stream. If the stream is
empty, the default value will be returned.</p>
<p>Works with all collections that implement the
<a href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.Extend.html"><code>Extend</code></a> trait.</p>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::channel::mpsc;
<span class="kw">use </span>futures::stream::StreamExt;
<span class="kw">use </span>std::thread;
<span class="kw">let </span>(tx, rx) = mpsc::unbounded();
thread::spawn(<span class="kw">move </span>|| {
<span class="kw">for </span>i <span class="kw">in </span>(<span class="number">0</span>..<span class="number">3</span>).rev() {
<span class="kw">let </span>n = i * <span class="number">3</span>;
tx.unbounded_send(<span class="macro">vec!</span>[n + <span class="number">1</span>, n + <span class="number">2</span>, n + <span class="number">3</span>]).unwrap();
}
});
<span class="kw">let </span>result = rx.concat().<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(result, <span class="macro">vec!</span>[<span class="number">7</span>, <span class="number">8</span>, <span class="number">9</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.count" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#627-629">source</a><h4 class="code-header">fn <a href="#method.count" class="fnname">count</a>(self) -&gt; <a class="struct" href="struct.Count.html" title="struct futures::stream::Count">Count</a>&lt;Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Count.html" title="struct futures::stream::Count">Count</a>&lt;St&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Count.html" title="struct futures::stream::Count">Count</a>&lt;St&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>;</span></code></span></span></span></span></h4></section></summary><div class="docblock"><p>Drives the stream to completion, counting the number of items.</p>
<h5 id="overflow-behavior-1"><a href="#overflow-behavior-1">Overflow Behavior</a></h5>
<p>The method does no guarding against overflows, so counting elements of a
stream with more than <a href="https://doc.rust-lang.org/nightly/std/primitive.usize.html#associatedconstant.MAX" title="usize::MAX"><code>usize::MAX</code></a> elements either produces the wrong
result or panics. If debug assertions are enabled, a panic is guaranteed.</p>
<h5 id="panics-1"><a href="#panics-1">Panics</a></h5>
<p>This function might panic if the iterator has more than <a href="https://doc.rust-lang.org/nightly/std/primitive.usize.html#associatedconstant.MAX" title="usize::MAX"><code>usize::MAX</code></a>
elements.</p>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">10</span>);
<span class="kw">let </span>count = stream.count().<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(count, <span class="number">10</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.cycle" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#657-659">source</a><h4 class="code-header">fn <a href="#method.cycle" class="fnname">cycle</a>(self) -&gt; <a class="struct" href="struct.Cycle.html" title="struct futures::stream::Cycle">Cycle</a>&lt;Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</span></h4></section></summary><div class="docblock"><p>Repeats a stream endlessly.</p>
<p>The stream never terminates. Note that you likely want to avoid
usage of <code>collect</code> or such on the returned stream as it will exhaust
available memory as it tries to just fill up all RAM.</p>
<h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>a = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>];
<span class="kw">let </span><span class="kw-2">mut </span>s = stream::iter(a.iter()).cycle();
<span class="macro">assert_eq!</span>(s.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">1</span>));
<span class="macro">assert_eq!</span>(s.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">2</span>));
<span class="macro">assert_eq!</span>(s.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">3</span>));
<span class="macro">assert_eq!</span>(s.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">1</span>));
<span class="macro">assert_eq!</span>(s.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">2</span>));
<span class="macro">assert_eq!</span>(s.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">3</span>));
<span class="macro">assert_eq!</span>(s.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span><span class="number">1</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fold" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#684-688">source</a><h4 class="code-header">fn <a href="#method.fold" class="fnname">fold</a>&lt;T, Fut, F&gt;(self, init: T, f: F) -&gt; <a class="struct" href="struct.Fold.html" title="struct futures::stream::Fold">Fold</a>&lt;Self, Fut, T, F&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Fold.html" title="struct futures::stream::Fold">Fold</a>&lt;St, Fut, T, F&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, Fut, T, F&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Fold.html" title="struct futures::stream::Fold">Fold</a>&lt;St, Fut, T, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(T, &lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = T&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = T;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(T, Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = T&gt;,</span></h4></section></summary><div class="docblock"><p>Execute an accumulating asynchronous computation over a stream,
collecting all the values into one final result.</p>
<p>This combinator will accumulate all values returned by this stream
according to the closure provided. The initial state is also provided to
this method and then is returned again by each execution of the closure.
Once the entire stream has been exhausted the returned future will
resolve to this value.</p>
<h5 id="examples-12"><a href="#examples-12">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>number_stream = stream::iter(<span class="number">0</span>..<span class="number">6</span>);
<span class="kw">let </span>sum = number_stream.fold(<span class="number">0</span>, |acc, x| <span class="kw">async move </span>{ acc + x });
<span class="macro">assert_eq!</span>(sum.<span class="kw">await</span>, <span class="number">15</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.any" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#706-710">source</a><h4 class="code-header">fn <a href="#method.any" class="fnname">any</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.Any.html" title="struct futures::stream::Any">Any</a>&lt;Self, Fut, F&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Any.html" title="struct futures::stream::Any">Any</a>&lt;St, Fut, F&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, Fut, F&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Any.html" title="struct futures::stream::Any">Any</a>&lt;St, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Execute predicate over asynchronous stream, and return <code>true</code> if any element in stream satisfied a predicate.</p>
<h5 id="examples-13"><a href="#examples-13">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>number_stream = stream::iter(<span class="number">0</span>..<span class="number">10</span>);
<span class="kw">let </span>contain_three = number_stream.any(|i| <span class="kw">async move </span>{ i == <span class="number">3 </span>});
<span class="macro">assert_eq!</span>(contain_three.<span class="kw">await</span>, <span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.all" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#728-732">source</a><h4 class="code-header">fn <a href="#method.all" class="fnname">all</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.All.html" title="struct futures::stream::All">All</a>&lt;Self, Fut, F&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.All.html" title="struct futures::stream::All">All</a>&lt;St, Fut, F&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, Fut, F&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.All.html" title="struct futures::stream::All">All</a>&lt;St, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Execute predicate over asynchronous stream, and return <code>true</code> if all element in stream satisfied a predicate.</p>
<h5 id="examples-14"><a href="#examples-14">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>number_stream = stream::iter(<span class="number">0</span>..<span class="number">10</span>);
<span class="kw">let </span>less_then_twenty = number_stream.all(|i| <span class="kw">async move </span>{ i &lt; <span class="number">20 </span>});
<span class="macro">assert_eq!</span>(less_then_twenty.<span class="kw">await</span>, <span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.flatten" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#768-771">source</a><h4 class="code-header">fn <a href="#method.flatten" class="fnname">flatten</a>(self) -&gt; <a class="struct" href="struct.Flatten.html" title="struct futures::stream::Flatten">Flatten</a>&lt;Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,</span></h4></section></summary><div class="docblock"><p>Flattens a stream of streams into just one continuous stream.</p>
<h5 id="examples-15"><a href="#examples-15">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::channel::mpsc;
<span class="kw">use </span>futures::stream::StreamExt;
<span class="kw">use </span>std::thread;
<span class="kw">let </span>(tx1, rx1) = mpsc::unbounded();
<span class="kw">let </span>(tx2, rx2) = mpsc::unbounded();
<span class="kw">let </span>(tx3, rx3) = mpsc::unbounded();
thread::spawn(<span class="kw">move </span>|| {
tx1.unbounded_send(<span class="number">1</span>).unwrap();
tx1.unbounded_send(<span class="number">2</span>).unwrap();
});
thread::spawn(<span class="kw">move </span>|| {
tx2.unbounded_send(<span class="number">3</span>).unwrap();
tx2.unbounded_send(<span class="number">4</span>).unwrap();
});
thread::spawn(<span class="kw">move </span>|| {
tx3.unbounded_send(rx1).unwrap();
tx3.unbounded_send(rx2).unwrap();
});
<span class="kw">let </span>output = rx3.flatten().collect::&lt;Vec&lt;i32&gt;&gt;().<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(output, <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.flatten_unordered" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#819-822">source</a><h4 class="code-header">fn <a href="#method.flatten_unordered" class="fnname">flatten_unordered</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;limit: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;&gt;<br>) -&gt; FlattenUnorderedWithFlowController&lt;Self, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</span></h4></section></summary><div class="docblock"><p>Flattens a stream of streams into just one continuous stream. Polls
inner streams produced by the base stream concurrently.</p>
<p>The only argument is an optional limit on the number of concurrently
polled streams. If this limit is not <code>None</code>, no more than <code>limit</code> streams
will be polled at the same time. The <code>limit</code> argument is of type
<code>Into&lt;Option&lt;usize&gt;&gt;</code>, and so can be provided as either <code>None</code>,
<code>Some(10)</code>, or just <code>10</code>. Note: a limit of zero is interpreted as
no limit at all, and will have the same result as passing in <code>None</code>.</p>
<h5 id="examples-16"><a href="#examples-16">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::channel::mpsc;
<span class="kw">use </span>futures::stream::StreamExt;
<span class="kw">use </span>std::thread;
<span class="kw">let </span>(tx1, rx1) = mpsc::unbounded();
<span class="kw">let </span>(tx2, rx2) = mpsc::unbounded();
<span class="kw">let </span>(tx3, rx3) = mpsc::unbounded();
thread::spawn(<span class="kw">move </span>|| {
tx1.unbounded_send(<span class="number">1</span>).unwrap();
tx1.unbounded_send(<span class="number">2</span>).unwrap();
});
thread::spawn(<span class="kw">move </span>|| {
tx2.unbounded_send(<span class="number">3</span>).unwrap();
tx2.unbounded_send(<span class="number">4</span>).unwrap();
});
thread::spawn(<span class="kw">move </span>|| {
tx3.unbounded_send(rx1).unwrap();
tx3.unbounded_send(rx2).unwrap();
});
<span class="kw">let </span><span class="kw-2">mut </span>output = rx3.flatten_unordered(<span class="prelude-val">None</span>).collect::&lt;Vec&lt;i32&gt;&gt;().<span class="kw">await</span>;
output.sort();
<span class="macro">assert_eq!</span>(output, <span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.flat_map" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#852-856">source</a><h4 class="code-header">fn <a href="#method.flat_map" class="fnname">flat_map</a>&lt;U, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.FlatMap.html" title="struct futures::stream::FlatMap">FlatMap</a>&lt;Self, U, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; U,<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,</span></h4></section></summary><div class="docblock"><p>Maps a stream like <a href="trait.StreamExt.html#method.map" title="StreamExt::map"><code>StreamExt::map</code></a> but flattens nested <code>Stream</code>s.</p>
<p><a href="trait.StreamExt.html#method.map" title="StreamExt::map"><code>StreamExt::map</code></a> is very useful, but if it produces a <code>Stream</code> instead,
you would have to chain combinators like <code>.map(f).flatten()</code> while this
combinator provides ability to write <code>.flat_map(f)</code> instead of chaining.</p>
<p>The provided closure which produces inner streams is executed over all elements
of stream as last inner stream is terminated and next stream item is available.</p>
<p>Note that this function consumes the stream passed into it and returns a
wrapped version of it, similar to the existing <code>flat_map</code> methods in the
standard library.</p>
<h5 id="examples-17"><a href="#examples-17">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">3</span>);
<span class="kw">let </span>stream = stream.flat_map(|x| stream::iter(<span class="macro">vec!</span>[x + <span class="number">3</span>; x]));
<span class="macro">assert_eq!</span>(<span class="macro">vec!</span>[<span class="number">4</span>, <span class="number">5</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">6</span>, <span class="number">6</span>], stream.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;().<span class="kw">await</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.flat_map_unordered" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#901-909">source</a><h4 class="code-header">fn <a href="#method.flat_map_unordered" class="fnname">flat_map_unordered</a>&lt;U, F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;limit: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="struct" href="struct.FlatMapUnordered.html" title="struct futures::stream::FlatMapUnordered">FlatMapUnordered</a>&lt;Self, U, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; U,</span></h4></section></summary><div class="docblock"><p>Maps a stream like <a href="trait.StreamExt.html#method.map" title="StreamExt::map"><code>StreamExt::map</code></a> but flattens nested <code>Stream</code>s
and polls them concurrently, yielding items in any order, as they made
available.</p>
<p><a href="trait.StreamExt.html#method.map" title="StreamExt::map"><code>StreamExt::map</code></a> is very useful, but if it produces <code>Stream</code>s
instead, and you need to poll all of them concurrently, you would
have to use something like <code>for_each_concurrent</code> and merge values
by hand. This combinator provides ability to collect all values
from concurrently polled streams into one stream.</p>
<p>The first argument is an optional limit on the number of concurrently
polled streams. If this limit is not <code>None</code>, no more than <code>limit</code> streams
will be polled at the same time. The <code>limit</code> argument is of type
<code>Into&lt;Option&lt;usize&gt;&gt;</code>, and so can be provided as either <code>None</code>,
<code>Some(10)</code>, or just <code>10</code>. Note: a limit of zero is interpreted as
no limit at all, and will have the same result as passing in <code>None</code>.</p>
<p>The provided closure which produces inner streams is executed over
all elements of stream as next stream item is available and limit
of concurrently processed streams isn’t exceeded.</p>
<p>Note that this function consumes the stream passed into it and
returns a wrapped version of it.</p>
<h5 id="examples-18"><a href="#examples-18">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..<span class="number">5</span>);
<span class="kw">let </span>stream = stream.flat_map_unordered(<span class="number">1</span>, |x| stream::iter(<span class="macro">vec!</span>[x; x]));
<span class="kw">let </span><span class="kw-2">mut </span>values = stream.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;().<span class="kw">await</span>;
values.sort();
<span class="macro">assert_eq!</span>(<span class="macro">vec!</span>[<span class="number">1usize</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">4</span>, <span class="number">4</span>, <span class="number">4</span>], values);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.scan" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#938-942">source</a><h4 class="code-header">fn <a href="#method.scan" class="fnname">scan</a>&lt;S, B, Fut, F&gt;(self, initial_state: S, f: F) -&gt; <a class="struct" href="struct.Scan.html" title="struct futures::stream::Scan">Scan</a>&lt;Self, S, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>S, Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;B&gt;&gt;,</span></h4></section></summary><div class="docblock"><p>Combinator similar to <a href="trait.StreamExt.html#method.fold" title="StreamExt::fold"><code>StreamExt::fold</code></a> that holds internal state
and produces a new stream.</p>
<p>Accepts initial state and closure which will be applied to each element
of the stream until provided closure returns <code>None</code>. Once <code>None</code> is
returned, stream will be terminated.</p>
<h5 id="examples-19"><a href="#examples-19">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future;
<span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">10</span>);
<span class="kw">let </span>stream = stream.scan(<span class="number">0</span>, |state, x| {
<span class="kw-2">*</span>state += x;
future::ready(<span class="kw">if </span><span class="kw-2">*</span>state &lt; <span class="number">10 </span>{ <span class="prelude-val">Some</span>(x) } <span class="kw">else </span>{ <span class="prelude-val">None </span>})
});
<span class="macro">assert_eq!</span>(<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], stream.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;().<span class="kw">await</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.skip_while" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#969-973">source</a><h4 class="code-header">fn <a href="#method.skip_while" class="fnname">skip_while</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.SkipWhile.html" title="struct futures::stream::SkipWhile">SkipWhile</a>&lt;Self, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Skip elements on this stream while the provided asynchronous predicate
resolves to <code>true</code>.</p>
<p>This function, like <code>Iterator::skip_while</code>, will skip elements on the
stream until the predicate <code>f</code> resolves to <code>false</code>. Once one element
returns <code>false</code>, all future elements will be returned from the underlying
stream.</p>
<h5 id="examples-20"><a href="#examples-20">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future;
<span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">10</span>);
<span class="kw">let </span>stream = stream.skip_while(|x| future::ready(<span class="kw-2">*</span>x &lt;= <span class="number">5</span>));
<span class="macro">assert_eq!</span>(<span class="macro">vec!</span>[<span class="number">6</span>, <span class="number">7</span>, <span class="number">8</span>, <span class="number">9</span>, <span class="number">10</span>], stream.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;().<span class="kw">await</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.take_while" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#999-1003">source</a><h4 class="code-header">fn <a href="#method.take_while" class="fnname">take_while</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.TakeWhile.html" title="struct futures::stream::TakeWhile">TakeWhile</a>&lt;Self, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Take elements from this stream while the provided asynchronous predicate
resolves to <code>true</code>.</p>
<p>This function, like <code>Iterator::take_while</code>, will take elements from the
stream until the predicate <code>f</code> resolves to <code>false</code>. Once one element
returns <code>false</code>, it will always return that the stream is done.</p>
<h5 id="examples-21"><a href="#examples-21">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future;
<span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">10</span>);
<span class="kw">let </span>stream = stream.take_while(|x| future::ready(<span class="kw-2">*</span>x &lt;= <span class="number">5</span>));
<span class="macro">assert_eq!</span>(<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], stream.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;().<span class="kw">await</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.take_until" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1044-1047">source</a><h4 class="code-header">fn <a href="#method.take_until" class="fnname">take_until</a>&lt;Fut&gt;(self, fut: Fut) -&gt; <a class="struct" href="struct.TakeUntil.html" title="struct futures::stream::TakeUntil">TakeUntil</a>&lt;Self, Fut&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,</span></h4></section></summary><div class="docblock"><p>Take elements from this stream until the provided future resolves.</p>
<p>This function will take elements from the stream until the provided
stopping future <code>fut</code> resolves. Once the <code>fut</code> future becomes ready,
this stream combinator will always return that the stream is done.</p>
<p>The stopping future may return any type. Once the stream is stopped
the result of the stopping future may be accessed with <code>TakeUntil::take_result()</code>.
The stream may also be resumed with <code>TakeUntil::take_future()</code>.
See the documentation of <a href="struct.TakeUntil.html" title="TakeUntil"><code>TakeUntil</code></a> for more information.</p>
<h5 id="examples-22"><a href="#examples-22">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future;
<span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">use </span>futures::task::Poll;
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">10</span>);
<span class="kw">let </span><span class="kw-2">mut </span>i = <span class="number">0</span>;
<span class="kw">let </span>stop_fut = future::poll_fn(|_cx| {
i += <span class="number">1</span>;
<span class="kw">if </span>i &lt;= <span class="number">5 </span>{
Poll::Pending
} <span class="kw">else </span>{
Poll::Ready(())
}
});
<span class="kw">let </span>stream = stream.take_until(stop_fut);
<span class="macro">assert_eq!</span>(<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], stream.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;().<span class="kw">await</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.for_each" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1085-1089">source</a><h4 class="code-header">fn <a href="#method.for_each" class="fnname">for_each</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="struct.ForEach.html" title="struct futures::stream::ForEach">ForEach</a>&lt;Self, Fut, F&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.ForEach.html" title="struct futures::stream::ForEach">ForEach</a>&lt;St, Fut, F&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, Fut, F&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.ForEach.html" title="struct futures::stream::ForEach">ForEach</a>&lt;St, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Runs this stream to completion, executing the provided asynchronous
closure for each element on the stream.</p>
<p>The closure provided will be called for each item this stream produces,
yielding a future. That future will then be executed to completion
before moving on to the next item.</p>
<p>The returned value is a <code>Future</code> where the <code>Output</code> type is <code>()</code>; it is
executed entirely for its side effects.</p>
<p>To process each item in the stream and produce another stream instead
of a single future, use <code>then</code> instead.</p>
<h5 id="examples-23"><a href="#examples-23">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::future;
<span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span><span class="kw-2">mut </span>x = <span class="number">0</span>;
{
<span class="kw">let </span>fut = stream::repeat(<span class="number">1</span>).take(<span class="number">3</span>).for_each(|item| {
x += item;
future::ready(())
});
fut.<span class="kw">await</span>;
}
<span class="macro">assert_eq!</span>(x, <span class="number">3</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.for_each_concurrent" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1141-1149">source</a><h4 class="code-header">fn <a href="#method.for_each_concurrent" class="fnname">for_each_concurrent</a>&lt;Fut, F&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;limit: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;f: F<br>) -&gt; <a class="struct" href="struct.ForEachConcurrent.html" title="struct futures::stream::ForEachConcurrent">ForEachConcurrent</a>&lt;Self, Fut, F&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.ForEachConcurrent.html" title="struct futures::stream::ForEachConcurrent">ForEachConcurrent</a>&lt;St, Fut, F&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, Fut, F&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.ForEachConcurrent.html" title="struct futures::stream::ForEachConcurrent">ForEachConcurrent</a>&lt;St, Fut, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Runs this stream to completion, executing the provided asynchronous
closure for each element on the stream concurrently as elements become
available.</p>
<p>This is similar to <a href="trait.StreamExt.html#method.for_each" title="StreamExt::for_each"><code>StreamExt::for_each</code></a>, but the futures
produced by the closure are run concurrently (but not in parallel–
this combinator does not introduce any threads).</p>
<p>The closure provided will be called for each item this stream produces,
yielding a future. That future will then be executed to completion
concurrently with the other futures produced by the closure.</p>
<p>The first argument is an optional limit on the number of concurrent
futures. If this limit is not <code>None</code>, no more than <code>limit</code> futures
will be run concurrently. The <code>limit</code> argument is of type
<code>Into&lt;Option&lt;usize&gt;&gt;</code>, and so can be provided as either <code>None</code>,
<code>Some(10)</code>, or just <code>10</code>. Note: a limit of zero is interpreted as
no limit at all, and will have the same result as passing in <code>None</code>.</p>
<p>This method is only available when the <code>std</code> or <code>alloc</code> feature of this
library is activated, and it is activated by default.</p>
<h5 id="examples-24"><a href="#examples-24">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::channel::oneshot;
<span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>(tx1, rx1) = oneshot::channel();
<span class="kw">let </span>(tx2, rx2) = oneshot::channel();
<span class="kw">let </span>(tx3, rx3) = oneshot::channel();
<span class="kw">let </span>fut = stream::iter(<span class="macro">vec!</span>[rx1, rx2, rx3]).for_each_concurrent(
<span class="comment">/* limit */ </span><span class="number">2</span>,
|rx| <span class="kw">async move </span>{
rx.<span class="kw">await</span>.unwrap();
}
);
tx1.send(()).unwrap();
tx2.send(()).unwrap();
tx3.send(()).unwrap();
fut.<span class="kw">await</span>;</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.take" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1170-1172">source</a><h4 class="code-header">fn <a href="#method.take" class="fnname">take</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.Take.html" title="struct futures::stream::Take">Take</a>&lt;Self&gt;</h4></section></summary><div class="docblock"><p>Creates a new stream of at most <code>n</code> items of the underlying stream.</p>
<p>Once <code>n</code> items have been yielded from this stream then it will always
return that the stream is done.</p>
<h5 id="examples-25"><a href="#examples-25">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">10</span>).take(<span class="number">3</span>);
<span class="macro">assert_eq!</span>(<span class="macro">vec!</span>[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], stream.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;().<span class="kw">await</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.skip" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1193-1195">source</a><h4 class="code-header">fn <a href="#method.skip" class="fnname">skip</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.Skip.html" title="struct futures::stream::Skip">Skip</a>&lt;Self&gt;</h4></section></summary><div class="docblock"><p>Creates a new stream which skips <code>n</code> items of the underlying stream.</p>
<p>Once <code>n</code> items have been skipped from this stream then it will always
return the remaining items on this stream.</p>
<h5 id="examples-26"><a href="#examples-26">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="number">1</span>..=<span class="number">10</span>).skip(<span class="number">5</span>);
<span class="macro">assert_eq!</span>(<span class="macro">vec!</span>[<span class="number">6</span>, <span class="number">7</span>, <span class="number">8</span>, <span class="number">9</span>, <span class="number">10</span>], stream.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;().<span class="kw">await</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fuse" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1239-1241">source</a><h4 class="code-header">fn <a href="#method.fuse" class="fnname">fuse</a>(self) -&gt; <a class="struct" href="struct.Fuse.html" title="struct futures::stream::Fuse">Fuse</a>&lt;Self&gt;</h4></section></summary><div class="docblock"><p>Fuse a stream such that <a href="trait.Stream.html#tymethod.poll_next"><code>poll_next</code></a> will never
again be called once it has finished. This method can be used to turn
any <code>Stream</code> into a <code>FusedStream</code>.</p>
<p>Normally, once a stream has returned <a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None" title="None"><code>None</code></a> from
<a href="trait.Stream.html#tymethod.poll_next"><code>poll_next</code></a> any further calls could exhibit bad
behavior such as block forever, panic, never return, etc. If it is known
that <a href="trait.Stream.html#tymethod.poll_next"><code>poll_next</code></a> may be called after stream
has already finished, then this method can be used to ensure that it has
defined semantics.</p>
<p>The <a href="trait.Stream.html#tymethod.poll_next"><code>poll_next</code></a> method of a <code>fuse</code>d stream
is guaranteed to return <a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None" title="None"><code>None</code></a> after the underlying stream has
finished.</p>
<h5 id="examples-27"><a href="#examples-27">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::executor::block_on_stream;
<span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">use </span>futures::task::Poll;
<span class="kw">let </span><span class="kw-2">mut </span>x = <span class="number">0</span>;
<span class="kw">let </span>stream = stream::poll_fn(|<span class="kw">_</span>| {
x += <span class="number">1</span>;
<span class="kw">match </span>x {
<span class="number">0</span>..=<span class="number">2 </span>=&gt; Poll::Ready(<span class="prelude-val">Some</span>(x)),
<span class="number">3 </span>=&gt; Poll::Ready(<span class="prelude-val">None</span>),
<span class="kw">_ </span>=&gt; <span class="macro">panic!</span>(<span class="string">&quot;should not happen&quot;</span>)
}
}).fuse();
<span class="kw">let </span><span class="kw-2">mut </span>iter = block_on_stream(stream);
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">1</span>), iter.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="number">2</span>), iter.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, iter.next());
<span class="macro">assert_eq!</span>(<span class="prelude-val">None</span>, iter.next());
<span class="comment">// ...</span></code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.by_ref" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1272">source</a><h4 class="code-header">fn <a href="#method.by_ref" class="fnname">by_ref</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self</h4></section></summary><div class="docblock"><p>Borrows a stream, rather than consuming it.</p>
<p>This is useful to allow applying stream adaptors while still retaining
ownership of the original stream.</p>
<h5 id="examples-28"><a href="#examples-28">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span><span class="kw-2">mut </span>stream = stream::iter(<span class="number">1</span>..<span class="number">5</span>);
<span class="kw">let </span>sum = stream.by_ref()
.take(<span class="number">2</span>)
.fold(<span class="number">0</span>, |a, b| <span class="kw">async move </span>{ a + b })
.<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(sum, <span class="number">3</span>);
<span class="comment">// You can use the stream again
</span><span class="kw">let </span>sum = stream.take(<span class="number">2</span>)
.fold(<span class="number">0</span>, |a, b| <span class="kw">async move </span>{ a + b })
.<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(sum, <span class="number">7</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.catch_unwind" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1317-1319">source</a><h4 class="code-header">fn <a href="#method.catch_unwind" class="fnname">catch_unwind</a>(self) -&gt; <a class="struct" href="struct.CatchUnwind.html" title="struct futures::stream::CatchUnwind">CatchUnwind</a>&lt;Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</span></h4></section></summary><div class="docblock"><p>Catches unwinding panics while polling the stream.</p>
<p>Caught panic (if any) will be the last element of the resulting stream.</p>
<p>In general, panics within a stream can propagate all the way out to the
task level. This combinator makes it possible to halt unwinding within
the stream itself. It’s most commonly used within task executors. This
method should not be used for error handling.</p>
<p>Note that this method requires the <code>UnwindSafe</code> bound from the standard
library. This isn’t always applied automatically, and the standard
library provides an <code>AssertUnwindSafe</code> wrapper type to apply it
after-the fact. To assist using this method, the <a href="trait.Stream.html" title="Stream"><code>Stream</code></a> trait is
also implemented for <code>AssertUnwindSafe&lt;St&gt;</code> where <code>St</code> implements
<a href="trait.Stream.html" title="Stream"><code>Stream</code></a>.</p>
<p>This method is only available when the <code>std</code> feature of this
library is activated, and it is activated by default.</p>
<h5 id="examples-29"><a href="#examples-29">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream = stream::iter(<span class="macro">vec!</span>[<span class="prelude-val">Some</span>(<span class="number">10</span>), <span class="prelude-val">None</span>, <span class="prelude-val">Some</span>(<span class="number">11</span>)]);
<span class="comment">// Panic on second element
</span><span class="kw">let </span>stream_panicking = stream.map(|o| o.unwrap());
<span class="comment">// Collect all the results
</span><span class="kw">let </span>stream = stream_panicking.catch_unwind();
<span class="kw">let </span>results: Vec&lt;<span class="prelude-ty">Result</span>&lt;i32, <span class="kw">_</span>&gt;&gt; = stream.collect().<span class="kw">await</span>;
<span class="kw">match </span>results[<span class="number">0</span>] {
<span class="prelude-val">Ok</span>(<span class="number">10</span>) =&gt; {}
<span class="kw">_ </span>=&gt; <span class="macro">panic!</span>(<span class="string">&quot;unexpected result!&quot;</span>),
}
<span class="macro">assert!</span>(results[<span class="number">1</span>].is_err());
<span class="macro">assert_eq!</span>(results.len(), <span class="number">2</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.boxed" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1329-1331">source</a><h4 class="code-header">fn <a href="#method.boxed" class="fnname">boxed</a>&lt;'a&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;self<br>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'a, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;P&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;P&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;P&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;P as <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a>: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;&lt;P as <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a> as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: 'a + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</span></h4></section></summary><div class="docblock"><p>Wrap the stream in a Box, pinning it.</p>
<p>This method is only available when the <code>std</code> or <code>alloc</code> feature of this
library is activated, and it is activated by default.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.boxed_local" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1343-1345">source</a><h4 class="code-header">fn <a href="#method.boxed_local" class="fnname">boxed_local</a>&lt;'a&gt;(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt; + 'a, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;P&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;P&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a>&lt;P&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.DerefMut.html" title="trait core::ops::deref::DerefMut">DerefMut</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;P as <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a>: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;&lt;P as <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a> as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: 'a,</span></h4></section></summary><div class="docblock"><p>Wrap the stream in a Box, pinning it.</p>
<p>Similar to <code>boxed</code>, but without the <code>Send</code> requirement.</p>
<p>This method is only available when the <code>std</code> or <code>alloc</code> feature of this
library is activated, and it is activated by default.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.buffered" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1364-1367">source</a><h4 class="code-header">fn <a href="#method.buffered" class="fnname">buffered</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.Buffered.html" title="struct futures::stream::Buffered">Buffered</a>&lt;Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,</span></h4></section></summary><div class="docblock"><p>An adaptor for creating a buffered list of pending futures.</p>
<p>If this stream’s item can be converted into a future, then this adaptor
will buffer up to at most <code>n</code> futures and then return the outputs in the
same order as the underlying stream. No more than <code>n</code> futures will be
buffered at any point in time, and less than <code>n</code> may also be buffered
depending on the state of each future.</p>
<p>The returned stream will be a stream of each future’s output.</p>
<p>This method is only available when the <code>std</code> or <code>alloc</code> feature of this
library is activated, and it is activated by default.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.buffer_unordered" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1409-1412">source</a><h4 class="code-header">fn <a href="#method.buffer_unordered" class="fnname">buffer_unordered</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.BufferUnordered.html" title="struct futures::stream::BufferUnordered">BufferUnordered</a>&lt;Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,</span></h4></section></summary><div class="docblock"><p>An adaptor for creating a buffered list of pending futures (unordered).</p>
<p>If this stream’s item can be converted into a future, then this adaptor
will buffer up to <code>n</code> futures and then return the outputs in the order
in which they complete. No more than <code>n</code> futures will be buffered at
any point in time, and less than <code>n</code> may also be buffered depending on
the state of each future.</p>
<p>The returned stream will be a stream of each future’s output.</p>
<p>This method is only available when the <code>std</code> or <code>alloc</code> feature of this
library is activated, and it is activated by default.</p>
<h5 id="examples-30"><a href="#examples-30">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::channel::oneshot;
<span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>(send_one, recv_one) = oneshot::channel();
<span class="kw">let </span>(send_two, recv_two) = oneshot::channel();
<span class="kw">let </span>stream_of_futures = stream::iter(<span class="macro">vec!</span>[recv_one, recv_two]);
<span class="kw">let </span><span class="kw-2">mut </span>buffered = stream_of_futures.buffer_unordered(<span class="number">10</span>);
send_two.send(<span class="number">2i32</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(buffered.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>(<span class="prelude-val">Ok</span>(<span class="number">2i32</span>)));
send_one.send(<span class="number">1i32</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(buffered.next().<span class="kw">await</span>, <span class="prelude-val">Some</span>(<span class="prelude-val">Ok</span>(<span class="number">1i32</span>)));
<span class="macro">assert_eq!</span>(buffered.next().<span class="kw">await</span>, <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.zip" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1439-1442">source</a><h4 class="code-header">fn <a href="#method.zip" class="fnname">zip</a>&lt;St&gt;(self, other: St) -&gt; <a class="struct" href="struct.Zip.html" title="struct futures::stream::Zip">Zip</a>&lt;Self, St&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>,</span></h4></section></summary><div class="docblock"><p>An adapter for zipping two streams together.</p>
<p>The zipped stream waits for both streams to produce an item, and then
returns that pair. If either stream ends then the zipped stream will
also end.</p>
<h5 id="examples-31"><a href="#examples-31">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream1 = stream::iter(<span class="number">1</span>..=<span class="number">3</span>);
<span class="kw">let </span>stream2 = stream::iter(<span class="number">5</span>..=<span class="number">10</span>);
<span class="kw">let </span>vec = stream1.zip(stream2)
.collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;()
.<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(<span class="macro">vec!</span>[(<span class="number">1</span>, <span class="number">5</span>), (<span class="number">2</span>, <span class="number">6</span>), (<span class="number">3</span>, <span class="number">7</span>)], vec);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.chain" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1470-1473">source</a><h4 class="code-header">fn <a href="#method.chain" class="fnname">chain</a>&lt;St&gt;(self, other: St) -&gt; <a class="struct" href="struct.Chain.html" title="struct futures::stream::Chain">Chain</a>&lt;Self, St&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Adapter for chaining two streams.</p>
<p>The resulting stream emits elements from the first stream, and when
first stream reaches the end, emits the elements from the second stream.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::stream::{<span class="self">self</span>, StreamExt};
<span class="kw">let </span>stream1 = stream::iter(<span class="macro">vec!</span>[<span class="prelude-val">Ok</span>(<span class="number">10</span>), <span class="prelude-val">Err</span>(<span class="bool-val">false</span>)]);
<span class="kw">let </span>stream2 = stream::iter(<span class="macro">vec!</span>[<span class="prelude-val">Err</span>(<span class="bool-val">true</span>), <span class="prelude-val">Ok</span>(<span class="number">20</span>)]);
<span class="kw">let </span>stream = stream1.chain(stream2);
<span class="kw">let </span>result: Vec&lt;<span class="kw">_</span>&gt; = stream.collect().<span class="kw">await</span>;
<span class="macro">assert_eq!</span>(result, <span class="macro">vec!</span>[
<span class="prelude-val">Ok</span>(<span class="number">10</span>),
<span class="prelude-val">Err</span>(<span class="bool-val">false</span>),
<span class="prelude-val">Err</span>(<span class="bool-val">true</span>),
<span class="prelude-val">Ok</span>(<span class="number">20</span>),
]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.peekable" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1481-1483">source</a><h4 class="code-header">fn <a href="#method.peekable" class="fnname">peekable</a>(self) -&gt; <a class="struct" href="struct.Peekable.html" title="struct futures::stream::Peekable">Peekable</a>&lt;Self&gt;</h4></section></summary><div class="docblock"><p>Creates a new stream which exposes a <code>peek</code> method.</p>
<p>Calling <code>peek</code> returns a reference to the next item in the stream.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.chunks" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1507-1509">source</a><h4 class="code-header">fn <a href="#method.chunks" class="fnname">chunks</a>(self, capacity: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.Chunks.html" title="struct futures::stream::Chunks">Chunks</a>&lt;Self&gt;</h4></section></summary><div class="docblock"><p>An adaptor for chunking up items of the stream inside a vector.</p>
<p>This combinator will attempt to pull items from this stream and buffer
them into a local vector. At most <code>capacity</code> items will get buffered
before they’re yielded from the returned stream.</p>
<p>Note that the vectors returned from this iterator may not always have
<code>capacity</code> elements. If the underlying stream ended and only a partial
vector was created, it’ll be returned. Additionally if an error happens
from the underlying stream then the currently buffered items will be
yielded.</p>
<p>This method is only available when the <code>std</code> or <code>alloc</code> feature of this
library is activated, and it is activated by default.</p>
<h5 id="panics-2"><a href="#panics-2">Panics</a></h5>
<p>This method will panic if <code>capacity</code> is zero.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ready_chunks" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1532-1534">source</a><h4 class="code-header">fn <a href="#method.ready_chunks" class="fnname">ready_chunks</a>(self, capacity: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.ReadyChunks.html" title="struct futures::stream::ReadyChunks">ReadyChunks</a>&lt;Self&gt;</h4></section></summary><div class="docblock"><p>An adaptor for chunking up ready items of the stream inside a vector.</p>
<p>This combinator will attempt to pull ready items from this stream and
buffer them into a local vector. At most <code>capacity</code> items will get
buffered before they’re yielded from the returned stream. If underlying
stream returns <code>Poll::Pending</code>, and collected chunk is not empty, it will
be immediately returned.</p>
<p>If the underlying stream ended and only a partial vector was created,
it will be returned.</p>
<p>This method is only available when the <code>std</code> or <code>alloc</code> feature of this
library is activated, and it is activated by default.</p>
<h5 id="panics-3"><a href="#panics-3">Panics</a></h5>
<p>This method will panic if <code>capacity</code> is zero.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.forward" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1552-1555">source</a><h4 class="code-header">fn <a href="#method.forward" class="fnname">forward</a>&lt;S&gt;(self, sink: S) -&gt; <a class="struct" href="struct.Forward.html" title="struct futures::stream::Forward">Forward</a>&lt;Self, S&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.Forward.html" title="struct futures::stream::Forward">Forward</a>&lt;St, Si&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St, Si&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.Forward.html" title="struct futures::stream::Forward">Forward</a>&lt;St, Si&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Forward&lt;St, Si, &lt;St as <a class="trait" href="trait.TryStream.html" title="trait futures::stream::TryStream">TryStream</a>&gt;::<a class="associatedtype" href="trait.TryStream.html#associatedtype.Ok" title="type futures::stream::TryStream::Ok">Ok</a>&gt;: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.TryStream.html" title="trait futures::stream::TryStream">TryStream</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;Forward&lt;St, Si, &lt;St as <a class="trait" href="trait.TryStream.html" title="trait futures::stream::TryStream">TryStream</a>&gt;::<a class="associatedtype" href="trait.TryStream.html#associatedtype.Ok" title="type futures::stream::TryStream::Ok">Ok</a>&gt; as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="../sink/trait.Sink.html" title="trait futures::sink::Sink">Sink</a>&lt;Self::<a class="associatedtype" href="trait.TryStream.html#associatedtype.Ok" title="type futures::stream::TryStream::Ok">Ok</a>, Error = Self::<a class="associatedtype" href="trait.TryStream.html#associatedtype.Error" title="type futures::stream::TryStream::Error">Error</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="trait.TryStream.html" title="trait futures::stream::TryStream">TryStream</a>,</span></h4></section></summary><div class="docblock"><p>A future that completes after the given stream has been fully processed
into the sink and the sink has been flushed and closed.</p>
<p>This future will drive the stream to keep producing items until it is
exhausted, sending each item to the sink. It will complete once the
stream is exhausted, the sink has received and flushed all items, and
the sink is closed. Note that neither the original stream nor provided
sink will be output by this future. Pass the sink by <code>Pin&lt;&amp;mut S&gt;</code>
(for example, via <code>forward(&amp;mut sink)</code> inside an <code>async</code> fn/block) in
order to preserve access to the <code>Sink</code>. If the stream produces an error,
that error will be returned by this future without flushing/closing the sink.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.split" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1576-1578">source</a><h4 class="code-header">fn <a href="#method.split" class="fnname">split</a>&lt;Item&gt;(self) -&gt; (<a class="struct" href="struct.SplitSink.html" title="struct futures::stream::SplitSink">SplitSink</a>&lt;Self, Item&gt;, <a class="struct" href="struct.SplitStream.html" title="struct futures::stream::SplitStream">SplitStream</a>&lt;Self&gt;)<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="../sink/trait.Sink.html" title="trait futures::sink::Sink">Sink</a>&lt;Item&gt;,</span></h4></section></summary><div class="docblock"><p>Splits this <code>Stream + Sink</code> object into separate <code>Sink</code> and <code>Stream</code>
objects.</p>
<p>This can be useful when you want to split ownership between tasks, or
allow direct interaction between the two objects (e.g. via
<code>Sink::send_all</code>).</p>
<p>This method is only available when the <code>std</code> or <code>alloc</code> feature of this
library is activated, and it is activated by default.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.inspect" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1592-1595">source</a><h4 class="code-header">fn <a href="#method.inspect" class="fnname">inspect</a>&lt;F&gt;(self, f: F) -&gt; <a class="struct" href="struct.Inspect.html" title="struct futures::stream::Inspect">Inspect</a>&lt;Self, F&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>),</span></h4></section></summary><div class="docblock"><p>Do something with each item of this stream, afterwards passing it on.</p>
<p>This is similar to the <code>Iterator::inspect</code> method in the standard
library where it allows easily inspecting each value as it passes
through the stream, for example to debug what’s going on.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.left_stream" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1605-1608">source</a><h4 class="code-header">fn <a href="#method.left_stream" class="fnname">left_stream</a>&lt;B&gt;(self) -&gt; <a class="enum" href="../future/enum.Either.html" title="enum futures::future::Either">Either</a>&lt;Self, B&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="enum" href="../future/enum.Either.html" title="enum futures::future::Either">Either</a>&lt;A, B&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;A, B&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="enum" href="../future/enum.Either.html" title="enum futures::future::Either">Either</a>&lt;A, B&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = &lt;A as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;A as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Wrap this stream in an <code>Either</code> stream, making it the left-hand variant
of that <code>Either</code>.</p>
<p>This can be used in combination with the <code>right_stream</code> method to write <code>if</code>
statements that evaluate to different streams in different branches.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.right_stream" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1618-1621">source</a><h4 class="code-header">fn <a href="#method.right_stream" class="fnname">right_stream</a>&lt;B&gt;(self) -&gt; <a class="enum" href="../future/enum.Either.html" title="enum futures::future::Either">Either</a>&lt;B, Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="enum" href="../future/enum.Either.html" title="enum futures::future::Either">Either</a>&lt;A, B&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;A, B&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="enum" href="../future/enum.Either.html" title="enum futures::future::Either">Either</a>&lt;A, B&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&lt;Output = &lt;A as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>&gt;,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;A as <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a>&gt;::<a class="associatedtype" href="../future/trait.Future.html#associatedtype.Output" title="type futures::future::Future::Output">Output</a>;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&lt;Item = Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Wrap this stream in an <code>Either</code> stream, making it the right-hand variant
of that <code>Either</code>.</p>
<p>This can be used in combination with the <code>left_stream</code> method to write <code>if</code>
statements that evaluate to different streams in different branches.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.poll_next_unpin" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1628-1630">source</a><h4 class="code-header">fn <a href="#method.poll_next_unpin" class="fnname">poll_next_unpin</a>(&amp;mut self, cx: &amp;mut <a class="struct" href="../task/struct.Context.html" title="struct futures::task::Context">Context</a>&lt;'_&gt;) -&gt; <a class="enum" href="../task/enum.Poll.html" title="enum futures::task::Poll">Poll</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>&gt;&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</span></h4></section></summary><div class="docblock"><p>A convenience method for calling <a href="trait.Stream.html#tymethod.poll_next" title="Stream::poll_next"><code>Stream::poll_next</code></a> on <a href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="Unpin"><code>Unpin</code></a>
stream types.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.select_next_some" class="method has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#1685-1687">source</a><h4 class="code-header">fn <a href="#method.select_next_some" class="fnname">select_next_some</a>(&amp;mut self) -&gt; <a class="struct" href="struct.SelectNextSome.html" title="struct futures::stream::SelectNextSome">SelectNextSome</a>&lt;'_, Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><span class="notable-traits-tooltiptext"><span class="docblock"><span class="notable">Notable traits for <a class="struct" href="struct.SelectNextSome.html" title="struct futures::stream::SelectNextSome">SelectNextSome</a>&lt;'_, St&gt;</span><code class="content"><span class="where fmt-newline">impl&lt;St&gt; <a class="trait" href="../future/trait.Future.html" title="trait futures::future::Future">Future</a> for <a class="struct" href="struct.SelectNextSome.html" title="struct futures::stream::SelectNextSome">SelectNextSome</a>&lt;'_, St&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;St: <a class="trait" href="trait.FusedStream.html" title="trait futures::stream::FusedStream">FusedStream</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></span><span class="where fmt-newline"> type <a href="../future/trait.Future.html#associatedtype.Output" class="associatedtype">Output</a> = &lt;St as <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a>&gt;::<a class="associatedtype" href="trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>;</span></code></span></span></span></span><span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> + <a class="trait" href="trait.FusedStream.html" title="trait futures::stream::FusedStream">FusedStream</a>,</span></h4></section></summary><div class="docblock"><p>Returns a <a href="../future/trait.Future.html" title="Future"><code>Future</code></a> that resolves when the next item in this stream is
ready.</p>
<p>This is similar to the <a href="trait.StreamExt.html#method.next" title="StreamExt::next"><code>next</code></a> method, but it won’t
resolve to <a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None" title="None"><code>None</code></a> if used on an empty <a href="trait.Stream.html" title="Stream"><code>Stream</code></a>. Instead, the
returned future type will return <code>true</code> from
<a href="../future/trait.FusedFuture.html#tymethod.is_terminated"><code>FusedFuture::is_terminated</code></a> when the <a href="trait.Stream.html" title="Stream"><code>Stream</code></a> is empty, allowing
<a href="trait.StreamExt.html#method.select_next_some" title="StreamExt::select_next_some"><code>select_next_some</code></a> to be easily used with
the <a href="../macro.select.html"><code>select!</code></a> macro.</p>
<p>If the future is polled after this <a href="trait.Stream.html" title="Stream"><code>Stream</code></a> is empty it will panic.
Using the future with a <a href="../future/trait.FusedFuture.html"><code>FusedFuture</code></a>-aware primitive like the
<a href="../macro.select.html"><code>select!</code></a> macro will prevent this.</p>
<h5 id="examples-32"><a href="#examples-32">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>futures::{future, select};
<span class="kw">use </span>futures::stream::{StreamExt, FuturesUnordered};
<span class="kw">let </span><span class="kw-2">mut </span>fut = future::ready(<span class="number">1</span>);
<span class="kw">let </span><span class="kw-2">mut </span>async_tasks = FuturesUnordered::new();
<span class="kw">let </span><span class="kw-2">mut </span>total = <span class="number">0</span>;
<span class="kw">loop </span>{
<span class="macro">select! </span>{
num = fut =&gt; {
<span class="comment">// First, the `ready` future completes.
</span>total += num;
<span class="comment">// Then we spawn a new task onto `async_tasks`,
</span>async_tasks.push(<span class="kw">async </span>{ <span class="number">5 </span>});
},
<span class="comment">// On the next iteration of the loop, the task we spawned
// completes.
</span>num = async_tasks.select_next_some() =&gt; {
total += num;
}
<span class="comment">// Finally, both the `ready` future and `async_tasks` have
// finished, so we enter the `complete` branch.
</span>complete =&gt; <span class="kw">break</span>,
}
}
<span class="macro">assert_eq!</span>(total, <span class="number">6</span>);</code></pre></div>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div id="implementors-list"><section id="impl-StreamExt-for-T" class="impl has-srclink"><a class="srclink rightside" href="../../src/futures_util/stream/stream/mod.rs.html#245">source</a><a href="#impl-StreamExt-for-T" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.StreamExt.html" title="trait futures::stream::StreamExt">StreamExt</a> for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="trait.Stream.html" title="trait futures::stream::Stream">Stream</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></div><script src="../../implementors/futures_util/stream/stream/trait.StreamExt.js" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="futures" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>