Auto Generated Documentation

This commit is contained in:
github-actions[bot]
2021-03-14 20:06:11 +00:00
parent fcf47cbac9
commit 799a22692f
11450 changed files with 65837 additions and 83717 deletions
+14 -15
View File
@@ -1,7 +1,7 @@
<!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>futures_util::stream::StreamExt - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `StreamExt` trait in crate `futures_util`."><meta name="keywords" content="rust, rustlang, rust-lang, StreamExt"><title>futures_util::stream::StreamExt - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../futures_util/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Trait StreamExt</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.concat">concat</a><a href="#method.map">map</a><a href="#method.next">next</a><a href="#method.flatten">flatten</a><a href="#method.fuse">fuse</a><a href="#method.then">then</a><a href="#method.inspect">inspect</a><a href="#method.into_future">into_future</a><a href="#method.take">take</a><a href="#method.chain">chain</a><a href="#method.collect">collect</a><a href="#method.unzip">unzip</a><a href="#method.cycle">cycle</a><a href="#method.enumerate">enumerate</a><a href="#method.filter">filter</a><a href="#method.filter_map">filter_map</a><a href="#method.fold">fold</a><a href="#method.for_each">for_each</a><a href="#method.select_next_some">select_next_some</a><a href="#method.skip">skip</a><a href="#method.skip_while">skip_while</a><a href="#method.take_while">take_while</a><a href="#method.take_until">take_until</a><a href="#method.zip">zip</a><a href="#method.scan">scan</a><a href="#method.flat_map">flat_map</a><a href="#method.by_ref">by_ref</a><a href="#method.peekable">peekable</a><a href="#method.left_stream">left_stream</a><a href="#method.right_stream">right_stream</a><a href="#method.poll_next_unpin">poll_next_unpin</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class="location"><a href="../index.html">futures_util</a>::<wbr><a href="index.html">stream</a></p><div id="sidebar-vars" data-name="StreamExt" data-ty="trait" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Trait <a href="../index.html">futures_util</a>::<wbr><a href="index.html">stream</a>::<wbr><a class="trait" href="">StreamExt</a></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#212-1472" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust trait">pub trait StreamExt: <a class="trait" href="../../futures_util/stream/trait.Stream.html" title="trait futures_util::stream::Stream">Stream</a> {
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../futures_util/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Trait StreamExt</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.by_ref">by_ref</a><a href="#method.chain">chain</a><a href="#method.collect">collect</a><a href="#method.concat">concat</a><a href="#method.cycle">cycle</a><a href="#method.enumerate">enumerate</a><a href="#method.filter">filter</a><a href="#method.filter_map">filter_map</a><a href="#method.flat_map">flat_map</a><a href="#method.flatten">flatten</a><a href="#method.fold">fold</a><a href="#method.for_each">for_each</a><a href="#method.fuse">fuse</a><a href="#method.inspect">inspect</a><a href="#method.into_future">into_future</a><a href="#method.left_stream">left_stream</a><a href="#method.map">map</a><a href="#method.next">next</a><a href="#method.peekable">peekable</a><a href="#method.poll_next_unpin">poll_next_unpin</a><a href="#method.right_stream">right_stream</a><a href="#method.scan">scan</a><a href="#method.select_next_some">select_next_some</a><a href="#method.skip">skip</a><a href="#method.skip_while">skip_while</a><a href="#method.take">take</a><a href="#method.take_until">take_until</a><a href="#method.take_while">take_while</a><a href="#method.then">then</a><a href="#method.unzip">unzip</a><a href="#method.zip">zip</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class="location"><a href="../index.html">futures_util</a>::<wbr><a href="index.html">stream</a></p><script>window.sidebarCurrent = {name: "StreamExt", ty: "trait", relpath: ""};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#212-1472" title="goto source code">[src]</a></span><span class="in-band">Trait <a href="../index.html">futures_util</a>::<wbr><a href="index.html">stream</a>::<wbr><a class="trait" href="">StreamExt</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust trait">pub trait StreamExt: <a class="trait" href="../../futures_util/stream/trait.Stream.html" title="trait futures_util::stream::Stream">Stream</a> {
fn <a href="#method.next" class="fnname">next</a>(&amp;mut self) -&gt; <a class="struct" href="../../futures_util/stream/struct.Next.html" title="struct futures_util::stream::Next">Next</a>&lt;'_, Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../../futures_util/stream/struct.Next.html" title="struct futures_util::stream::Next">Next</a>&lt;'_, St&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;St:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../../futures_util/stream/trait.Stream.html" title="trait futures_util::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>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a> for <a class="struct" href="../../futures_util/stream/struct.Next.html" title="struct futures_util::stream::Next">Next</a>&lt;'_, St&gt;</span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" class="type">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;St::<a class="type" href="../../futures_util/stream/trait.Stream.html#associatedtype.Item" title="type futures_util::stream::Stream::Item">Item</a>&gt;;</span></code></span></div></span></span><br>&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>,
{ ... }
<div class="item-spacer"></div> fn <a href="#method.into_future" class="fnname">into_future</a>(self) -&gt; <a class="struct" href="../../futures_util/stream/struct.StreamFuture.html" title="struct futures_util::stream::StreamFuture">StreamFuture</a>&lt;Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../../futures_util/stream/struct.StreamFuture.html" title="struct futures_util::stream::StreamFuture">StreamFuture</a>&lt;St&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;St:&nbsp;<a class="trait" href="../../futures_util/stream/trait.Stream.html" title="trait futures_util::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>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a> for <a class="struct" href="../../futures_util/stream/struct.StreamFuture.html" title="struct futures_util::stream::StreamFuture">StreamFuture</a>&lt;St&gt;</span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" class="type">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;St::<a class="type" href="../../futures_util/stream/trait.Stream.html#associatedtype.Item" title="type futures_util::stream::Stream::Item">Item</a>&gt;, St<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>;</span></code></span></div></span></span><br>&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.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a></span>,
@@ -66,9 +66,9 @@
}</pre></div><div class="docblock"><p>An extension trait for <code>Stream</code>s that provides a variety of convenient
combinator functions.</p>
</div><h2 id="provided-methods" class="small-section-header">Provided methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><h3 id="method.next" class="method"><code>fn <a href="#method.next" class="fnname">next</a>(&amp;mut self) -&gt; <a class="struct" href="../../futures_util/stream/struct.Next.html" title="struct futures_util::stream::Next">Next</a>&lt;'_, Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../../futures_util/stream/struct.Next.html" title="struct futures_util::stream::Next">Next</a>&lt;'_, St&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;St:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../../futures_util/stream/trait.Stream.html" title="trait futures_util::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>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a> for <a class="struct" href="../../futures_util/stream/struct.Next.html" title="struct futures_util::stream::Next">Next</a>&lt;'_, St&gt;</span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" class="type">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;St::<a class="type" href="../../futures_util/stream/trait.Stream.html#associatedtype.Item" title="type futures_util::stream::Stream::Item">Item</a>&gt;;</span></code></span></div></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>,&nbsp;</span></code><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#236-241" title="goto source code">[src]</a></h3><div class="docblock"><p>Creates a future that resolves to the next item in the stream.</p>
<p>Note that because <code>next</code> doesnt take ownership over the stream,
<p>Note that because <code>next</code> doesn't take ownership over the stream,
the <a href="../../futures_util/stream/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, youll first have to pin the stream. This can
<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 [<code>Box::pin</code>] or
pinning it to the stack using the <code>pin_mut!</code> macro from the <code>pin_utils</code>
crate.</p>
@@ -85,10 +85,10 @@ crate.</p>
</div><h3 id="method.into_future" class="method"><code>fn <a href="#method.into_future" class="fnname">into_future</a>(self) -&gt; <a class="struct" href="../../futures_util/stream/struct.StreamFuture.html" title="struct futures_util::stream::StreamFuture">StreamFuture</a>&lt;Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../../futures_util/stream/struct.StreamFuture.html" title="struct futures_util::stream::StreamFuture">StreamFuture</a>&lt;St&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;St:&nbsp;<a class="trait" href="../../futures_util/stream/trait.Stream.html" title="trait futures_util::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>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a> for <a class="struct" href="../../futures_util/stream/struct.StreamFuture.html" title="struct futures_util::stream::StreamFuture">StreamFuture</a>&lt;St&gt;</span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" class="type">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;St::<a class="type" href="../../futures_util/stream/trait.Stream.html#associatedtype.Item" title="type futures_util::stream::Stream::Item">Item</a>&gt;, St<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>;</span></code></span></div></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.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,&nbsp;</span></code><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#271-276" title="goto source code">[src]</a></h3><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>
by placing everything into the &quot;world of futures&quot;.</p>
<p>Note that because <code>into_future</code> moves the stream, the <a href="../../futures_util/stream/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, youll first have to pin the stream. This can
<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 [<code>Box::pin</code>] or
pinning it to the stack using the <code>pin_mut!</code> macro from the <code>pin_utils</code>
crate.</p>
@@ -103,7 +103,7 @@ crate.</p>
<span class="kw">let</span> (<span class="ident">item</span>, <span class="ident">stream</span>) <span class="op">=</span> <span class="ident">stream</span>.<span class="ident">into_future</span>().<span class="kw">await</span>;
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="prelude-val">Some</span>(<span class="number">2</span>), <span class="ident">item</span>);</pre></div>
</div><h3 id="method.map" class="method"><code>fn <a href="#method.map" class="fnname">map</a>&lt;T, F&gt;(self, f: F) -&gt; <a class="struct" href="../../futures_util/stream/struct.Map.html" title="struct futures_util::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="type" href="../../futures_util/stream/trait.Stream.html#associatedtype.Item" title="type futures_util::stream::Stream::Item">Item</a>) -&gt; T,<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#301-307" title="goto source code">[src]</a></h3><div class="docblock"><p>Maps this streams items to a different type, returning a new stream of
</div><h3 id="method.map" class="method"><code>fn <a href="#method.map" class="fnname">map</a>&lt;T, F&gt;(self, f: F) -&gt; <a class="struct" href="../../futures_util/stream/struct.Map.html" title="struct futures_util::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="type" href="../../futures_util/stream/trait.Stream.html#associatedtype.Item" title="type futures_util::stream::Stream::Item">Item</a>) -&gt; T,<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#301-307" title="goto source code">[src]</a></h3><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
@@ -124,7 +124,7 @@ 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
<p><code>enumerate()</code> keeps its count as a <a href="https://doc.rust-lang.org/std/primitive.usize.html" title="usize"><code>usize</code></a>. If you want to count by a
different sized integer, the <a href="../../futures_util/stream/trait.StreamExt.html#method.zip"><code>zip</code></a> function provides similar
functionality.</p>
<h1 id="overflow-behavior" class="section-header"><a href="#overflow-behavior">Overflow Behavior</a></h1>
@@ -133,7 +133,7 @@ functionality.</p>
debug assertions are enabled, a panic is guaranteed.</p>
<h1 id="panics" class="section-header"><a href="#panics">Panics</a></h1>
<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>
overflow a <a href="https://doc.rust-lang.org/std/primitive.usize.html" title="usize"><code>usize</code></a>.</p>
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">futures</span>::<span class="ident">stream</span>::{<span class="self">self</span>, <span class="ident">StreamExt</span>};
@@ -184,7 +184,7 @@ the standard library.</p>
});
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="macro">vec</span><span class="macro">!</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>], <span class="ident">evens</span>.<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="kw">_</span><span class="op">&gt;</span><span class="op">&gt;</span>().<span class="kw">await</span>);</pre></div>
</div><h3 id="method.then" class="method"><code>fn <a href="#method.then" class="fnname">then</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="../../futures_util/stream/struct.Then.html" title="struct futures_util::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="type" href="../../futures_util/stream/trait.Stream.html#associatedtype.Item" title="type futures_util::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#445-452" title="goto source code">[src]</a></h3><div class="docblock"><p>Computes from this streams items new items of a different type using
</div><h3 id="method.then" class="method"><code>fn <a href="#method.then" class="fnname">then</a>&lt;Fut, F&gt;(self, f: F) -&gt; <a class="struct" href="../../futures_util/stream/struct.Then.html" title="struct futures_util::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="type" href="../../futures_util/stream/trait.Stream.html#associatedtype.Item" title="type futures_util::stream::Stream::Item">Item</a>) -&gt; Fut,<br>&nbsp;&nbsp;&nbsp;&nbsp;Fut: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#445-452" title="goto source code">[src]</a></h3><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
@@ -556,7 +556,7 @@ first stream reaches the end, emits the elements from the second stream.</p>
</div><h3 id="method.inspect" class="method"><code>fn <a href="#method.inspect" class="fnname">inspect</a>&lt;F&gt;(self, f: F) -&gt; <a class="struct" href="../../futures_util/stream/struct.Inspect.html" title="struct futures_util::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="type" href="../../futures_util/stream/trait.Stream.html#associatedtype.Item" title="type futures_util::stream::Stream::Item">Item</a>),<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#1375-1381" title="goto source code">[src]</a></h3><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 whats going on.</p>
through the stream, for example to debug what's going on.</p>
</div><h3 id="method.left_stream" class="method"><code>fn <a href="#method.left_stream" class="fnname">left_stream</a>&lt;B&gt;(self) -&gt; <a class="enum" href="../../futures_util/future/enum.Either.html" title="enum futures_util::future::Either">Either</a>&lt;Self, B&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="enum" href="../../futures_util/future/enum.Either.html" title="enum futures_util::future::Either">Either</a>&lt;A, B&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;A, B&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a> for <a class="enum" href="../../futures_util/future/enum.Either.html" title="enum futures_util::future::Either">Either</a>&lt;A, B&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a>&lt;Output = A::<a class="type" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>&gt;,&nbsp;</span></span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" class="type">Output</a> = A::<a class="type" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" title="type core::future::future::Future::Output">Output</a>;</span></code></span></div></span></span> <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;B: <a class="trait" href="../../futures_util/stream/trait.Stream.html" title="trait futures_util::stream::Stream">Stream</a>&lt;Item = Self::<a class="type" href="../../futures_util/stream/trait.Stream.html#associatedtype.Item" title="type futures_util::stream::Stream::Item">Item</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#1388-1394" title="goto source code">[src]</a></h3><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>
@@ -569,7 +569,7 @@ statements that evaluate to different streams in different branches.</p>
stream types.</p>
</div><h3 id="method.select_next_some" class="method"><code>fn <a href="#method.select_next_some" class="fnname">select_next_some</a>(&amp;mut self) -&gt; <a class="struct" href="../../futures_util/stream/struct.SelectNextSome.html" title="struct futures_util::stream::SelectNextSome">SelectNextSome</a>&lt;'_, Self&gt;<span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../../futures_util/stream/struct.SelectNextSome.html" title="struct futures_util::stream::SelectNextSome">SelectNextSome</a>&lt;'_, St&gt;</h3><code class="content"><span class="where fmt-newline">impl&lt;St:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="../../futures_util/stream/trait.FusedStream.html" title="trait futures_util::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>&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a> for <a class="struct" href="../../futures_util/stream/struct.SelectNextSome.html" title="struct futures_util::stream::SelectNextSome">SelectNextSome</a>&lt;'_, St&gt;</span><span class="where fmt-newline"> type <a href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html#associatedtype.Output" class="type">Output</a> = St::<a class="type" href="../../futures_util/stream/trait.Stream.html#associatedtype.Item" title="type futures_util::stream::Stream::Item">Item</a>;</span></code></span></div></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="../../futures_util/stream/trait.FusedStream.html" title="trait futures_util::stream::FusedStream">FusedStream</a>,&nbsp;</span></code><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#1466-1471" title="goto source code">[src]</a></h3><div class="docblock"><p>Returns a <a href="https://doc.rust-lang.org/nightly/core/future/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="../../futures_util/stream/trait.StreamExt.html#method.next" title="StreamExt::next"><code>next</code></a> method, but it wont
<p>This is similar to the <a href="../../futures_util/stream/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="../../futures_util/stream/trait.Stream.html" title="Stream"><code>Stream</code></a>. Instead, the
returned future type will return <code>true</code> from
<a href="../../futures_util/future/trait.FusedFuture.html#tymethod.is_terminated"><code>FusedFuture::is_terminated</code></a> when the <a href="../../futures_util/stream/trait.Stream.html" title="Stream"><code>Stream</code></a> is empty, allowing
@@ -605,5 +605,4 @@ Using the future with a <a href="../../futures_util/future/trait.FusedFuture.htm
}
}
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">total</span>, <span class="number">6</span>);</pre></div>
</div></div><span class="loading-content">Loading content...</span><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><h3 id="impl-StreamExt" class="impl"><code class="in-band">impl&lt;T:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; <a class="trait" href="../../futures_util/stream/trait.StreamExt.html" title="trait futures_util::stream::StreamExt">StreamExt</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../futures_util/stream/trait.Stream.html" title="trait futures_util::stream::Stream">Stream</a>,&nbsp;</span></code><a href="#impl-StreamExt" class="anchor"></a><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#208" title="goto source code">[src]</a></h3><div class="impl-items"></div></div><span class="loading-content">Loading content...</span><script type="text/javascript" src="../../implementors/futures_util/stream/trait.StreamExt.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="futures_util"></div>
<script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
</div></div><span class="loading-content">Loading content...</span><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><h3 id="impl-StreamExt" class="impl"><code class="in-band">impl&lt;T:&nbsp;?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>&gt; StreamExt for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../../futures_util/stream/trait.Stream.html" title="trait futures_util::stream::Stream">Stream</a>,&nbsp;</span></code><a href="#impl-StreamExt" class="anchor"></a><a class="srclink" href="../../src/futures_util/stream/stream/mod.rs.html#208" title="goto source code">[src]</a></h3><div class="impl-items"></div></div><span class="loading-content">Loading content...</span><script type="text/javascript" src="../../implementors/futures_util/stream/trait.StreamExt.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "futures_util";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>