rtic/dev/api/futures_util/stream/index.html

27 lines
31 KiB
HTML
Raw Normal View History

<!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="Asynchronous streams."><title>futures_util::stream - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b0742ba02757f159.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="futures_util" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0 (90b35a623 2024-11-26)" data-channel="1.83.0" data-search-js="search-f0d225181b97f9a4.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-f070b9041d14864c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../futures_util/index.html">futures_<wbr>util</a><span class="version">0.3.31</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module stream</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate futures_<wbr>util</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">futures_util</a></span><h1>Module <span>stream</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/futures_util/stream/mod.rs.html#1-148">source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Asynchronous streams.</p>
<p>This module contains:</p>
<ul>
<li>The <a href="trait.Stream.html" title="trait futures_util::stream::Stream"><code>Stream</code></a> trait, for objects that can asynchronously produce a
sequence of values.</li>
<li>The <a href="trait.StreamExt.html" title="trait futures_util::stream::StreamExt"><code>StreamExt</code></a> and <a href="trait.TryStreamExt.html" title="trait futures_util::stream::TryStreamExt"><code>TryStreamExt</code></a> trait, which provides adapters for
chaining and composing streams.</li>
<li>Top-level stream constructors like <a href="fn.iter.html" title="fn futures_util::stream::iter"><code>iter</code></a> which creates a
stream from an iterator.</li>
</ul>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.All.html" title="struct futures_util::stream::All">All</a></div><div class="desc docblock-short">Future for the <a href="trait.StreamExt.html#method.all" title="method futures_util::stream::StreamExt::all"><code>all</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.AndThen.html" title="struct futures_util::stream::AndThen">AndThen</a></div><div class="desc docblock-short">Stream for the <a href="trait.TryStreamExt.html#method.and_then" title="method futures_util::stream::TryStreamExt::and_then"><code>and_then</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Any.html" title="struct futures_util::stream::Any">Any</a></div><div class="desc docblock-short">Future for the <a href="trait.StreamExt.html#method.any" title="method futures_util::stream::StreamExt::any"><code>any</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Chain.html" title="struct futures_util::stream::Chain">Chain</a></div><div class="desc docblock-short">Stream for the <a href="trait.StreamExt.html#method.chain" title="method futures_util::stream::StreamExt::chain"><code>chain</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Collect.html" title="struct futures_util::stream::Collect">Collect</a></div><div class="desc docblock-short">Future for the <a href="trait.StreamExt.html#method.collect" title="method futures_util::stream::StreamExt::collect"><code>collect</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Concat.html" title="struct futures_util::stream::Concat">Concat</a></div><div class="desc docblock-short">Future for the <a href="trait.StreamExt.html#method.concat" title="method futures_util::stream::StreamExt::concat"><code>concat</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Count.html" title="struct futures_util::stream::Count">Count</a></div><div class="desc docblock-short">Future for the <a href="trait.StreamExt.html#method.count" title="method futures_util::stream::StreamExt::count"><code>count</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Cycle.html" title="struct futures_util::stream::Cycle">Cycle</a></div><div class="desc docblock-short">Stream for the <a href="trait.StreamExt.html#method.cycle" title="method futures_util::stream::StreamExt::cycle"><code>cycle</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Empty.html" title="struct futures_util::stream::Empty">Empty</a></div><div class="desc docblock-short">Stream for the <a href="fn.empty.html" title="fn futures_util::stream::empty"><code>empty</code></a> function.</div></li><li><div class="item-name"><a class="struct" href="struct.Enumerate.html" title="struct futures_util::stream::Enumerate">Enumerate</a></div><div class="desc docblock-short">Stream for the <a href="trait.StreamExt.html#method.enumerate" title="method futures_util::stream::StreamExt::enumerate"><code>enumerate</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.ErrInto.html" title="struct futures_util::stream::ErrInto">ErrInto</a></div><div class="desc docblock-short">Stream for the <a href="trait.TryStreamExt.html#method.err_into" title="method futures_util::stream::TryStreamExt::err_into"><code>err_into</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Filter.html" title="struct futures_util::stream::Filter">Filter</a></div><div class="desc docblock-short">Stream for the <a href="trait.StreamExt.html#method.filter" title="method futures_util::stream::StreamExt::filter"><code>filter</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.FilterMap.html" title="struct futures_util::stream::FilterMap">Filter<wbr>Map</a></div><div c
applying the provided closure <code>F: FnMut() -&gt; A</code>.</div></li><li><div class="item-name"><a class="struct" href="struct.Scan.html" title="struct futures_util::stream::Scan">Scan</a></div><div class="desc docblock-short">Stream for the <a href="trait.StreamExt.html#method.scan" title="method futures_util::stream::StreamExt::scan"><code>scan</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Select.html" title="struct futures_util::stream::Select">Select</a></div><div class="desc docblock-short">Stream for the <a href="fn.select.html" title="fn futures_util::stream::select"><code>select()</code></a> function.</div></li><li><div class="item-name"><a class="struct" href="struct.SelectNextSome.html" title="struct futures_util::stream::SelectNextSome">Select<wbr>Next<wbr>Some</a></div><div class="desc docblock-short">Future for the <a href="trait.StreamExt.html#method.select_next_some" title="method futures_util::stream::StreamExt::select_next_some"><code>select_next_some</code></a>
method.</div></li><li><div class="item-name"><a class="struct" href="struct.SelectWithStrategy.html" title="struct futures_util::stream::SelectWithStrategy">Select<wbr>With<wbr>Strategy</a></div><div class="desc docblock-short">Stream for the <a href="fn.select_with_strategy.html" title="fn futures_util::stream::select_with_strategy"><code>select_with_strategy()</code></a> function. See function docs for details.</div></li><li><div class="item-name"><a class="struct" href="struct.Skip.html" title="struct futures_util::stream::Skip">Skip</a></div><div class="desc docblock-short">Stream for the <a href="trait.StreamExt.html#method.skip" title="method futures_util::stream::StreamExt::skip"><code>skip</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.SkipWhile.html" title="struct futures_util::stream::SkipWhile">Skip<wbr>While</a></div><div class="desc docblock-short">Stream for the <a href="trait.StreamExt.html#method.skip_while" title="method futures_util::stream::StreamExt::skip_while"><code>skip_while</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.StreamFuture.html" title="struct futures_util::stream::StreamFuture">Stream<wbr>Future</a></div><div class="desc docblock-short">Future for the <a href="trait.StreamExt.html#method.into_future" title="method futures_util::stream::StreamExt::into_future"><code>into_future</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Take.html" title="struct futures_util::stream::Take">Take</a></div><div class="desc docblock-short">Stream for the <a href="trait.StreamExt.html#method.take" title="method futures_util::stream::StreamExt::take"><code>take</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.TakeUntil.html" title="struct futures_util::stream::TakeUntil">Take<wbr>Until</a></div><div class="desc docblock-short">Stream for the <a href="trait.StreamExt.html#method.take_until" title="method futures_util::stream::StreamExt::take_until"><code>take_until</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.TakeWhile.html" title="struct futures_util::stream::TakeWhile">Take<wbr>While</a></div><div class="desc docblock-short">Stream for the <a href="trait.StreamExt.html#method.take_while" title="method futures_util::stream::StreamExt::take_while"><code>take_while</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Then.html" title="struct futures_util::stream::Then">Then</a></div><div class="desc docblock-short">Stream for the <a href="trait.StreamExt.html#method.then" title="method futures_util::stream::StreamExt::then"><code>then</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.TryAll.html" title="struct futures_util::stream::TryAll">TryAll</a></div><div class="desc docblock-short">Future for the <a href="trait.TryStreamExt.html#method.try_all" title="method futures_util::stream::TryStreamExt::try_all"><code>try_all</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.TryAny.html" title="struct futures_util::stream::TryAny">TryAny</a></div><div class="desc docblock-short">Future for the <a href="trait.TryStreamExt.html#method.try_any" title="method futures_util::stream::TryStreamExt::try_any"><code>try_any</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.TryCollect.html" title="struct futures_util::stream::TryCollect">TryCollect</a></div><div class="desc docblock-short">Future for the <a href="trait.TryStreamExt.html#method.try_collect" title="method futures_util::stream::TryStreamExt::try_collect"><code>try_collect</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.TryConcat.html" title="struct futures_util::stream::TryConcat">TryConcat</a></div><div class="desc docblock-short">Future for the <a href="trait.TryStreamExt.html#method.try_concat" title="method futures_util::stream::TryStreamExt::try_concat"><code>try_concat</code></
method.</div></li><li><div class="item-name"><a class="struct" href="struct.TryFilterMap.html" title="struct futures_util::stream::TryFilterMap">TryFilter<wbr>Map</a></div><div class="desc docblock-short">Stream for the <a href="trait.TryStreamExt.html#method.try_filter_map" title="method futures_util::stream::TryStreamExt::try_filter_map"><code>try_filter_map</code></a>
method.</div></li><li><div class="item-name"><a class="struct" href="struct.TryFlatten.html" title="struct futures_util::stream::TryFlatten">TryFlatten</a></div><div class="desc docblock-short">Stream for the <a href="trait.TryStreamExt.html#method.try_flatten" title="method futures_util::stream::TryStreamExt::try_flatten"><code>try_flatten</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.TryFold.html" title="struct futures_util::stream::TryFold">TryFold</a></div><div class="desc docblock-short">Future for the <a href="trait.TryStreamExt.html#method.try_fold" title="method futures_util::stream::TryStreamExt::try_fold"><code>try_fold</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.TryForEach.html" title="struct futures_util::stream::TryForEach">TryFor<wbr>Each</a></div><div class="desc docblock-short">Future for the <a href="trait.TryStreamExt.html#method.try_for_each" title="method futures_util::stream::TryStreamExt::try_for_each"><code>try_for_each</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.TryNext.html" title="struct futures_util::stream::TryNext">TryNext</a></div><div class="desc docblock-short">Future for the <a href="trait.TryStreamExt.html#method.try_next" title="method futures_util::stream::TryStreamExt::try_next"><code>try_next</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.TrySkipWhile.html" title="struct futures_util::stream::TrySkipWhile">TrySkip<wbr>While</a></div><div class="desc docblock-short">Stream for the <a href="trait.TryStreamExt.html#method.try_skip_while" title="method futures_util::stream::TryStreamExt::try_skip_while"><code>try_skip_while</code></a>
method.</div></li><li><div class="item-name"><a class="struct" href="struct.TryTakeWhile.html" title="struct futures_util::stream::TryTakeWhile">TryTake<wbr>While</a></div><div class="desc docblock-short">Stream for the <a href="trait.TryStreamExt.html#method.try_take_while" title="method futures_util::stream::TryStreamExt::try_take_while"><code>try_take_while</code></a>
method.</div></li><li><div class="item-name"><a class="struct" href="struct.TryUnfold.html" title="struct futures_util::stream::TryUnfold">TryUnfold</a></div><div class="desc docblock-short">Stream for the <a href="fn.try_unfold.html" title="fn futures_util::stream::try_unfold"><code>try_unfold</code></a> function.</div></li><li><div class="item-name"><a class="struct" href="struct.Unfold.html" title="struct futures_util::stream::Unfold">Unfold</a></div><div class="desc docblock-short">Stream for the <a href="fn.unfold.html" title="fn futures_util::stream::unfold"><code>unfold</code></a> function.</div></li><li><div class="item-name"><a class="struct" href="struct.Unzip.html" title="struct futures_util::stream::Unzip">Unzip</a></div><div class="desc docblock-short">Future for the <a href="trait.StreamExt.html#method.unzip" title="method futures_util::stream::StreamExt::unzip"><code>unzip</code></a> method.</div></li><li><div class="item-name"><a class="struct" href="struct.Zip.html" title="struct futures_util::stream::Zip">Zip</a></div><div class="desc docblock-short">Stream for the <a href="trait.StreamExt.html#method.zip" title="method futures_util::stream::StreamExt::zip"><code>zip</code></a> method.</div></li></ul><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.PollNext.html" title="enum futures_util::stream::PollNext">Poll<wbr>Next</a></div><div class="desc docblock-short">Type to tell <a href="struct.SelectWithStrategy.html" title="struct futures_util::stream::SelectWithStrategy"><code>SelectWithStrategy</code></a> which stream to poll next.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.FusedStream.html" title="trait futures_util::stream::FusedStream">Fused<wbr>Stream</a></div><div class="desc docblock-short">A stream which tracks whether or not the underlying stream
should no longer be polled.</div></li><li><div class="item-name"><a class="trait" href="trait.Stream.html" title="trait futures_util::stream::Stream">Stream</a></div><div class="desc docblock-short">A stream of values produced asynchronously.</div></li><li><div class="item-name"><a class="trait" href="trait.StreamExt.html" title="trait futures_util::stream::StreamExt">Stream<wbr>Ext</a></div><div class="desc docblock-short">An extension trait for <code>Stream</code>s that provides a variety of convenient
combinator functions.</div></li><li><div class="item-name"><a class="trait" href="trait.TryStream.html" title="trait futures_util::stream::TryStream">TryStream</a></div><div class="desc docblock-short">A convenience for streams that return <code>Result</code> values that includes
a variety of adapters tailored to such futures.</div></li><li><div class="item-name"><a class="trait" href="trait.TryStreamExt.html" title="trait futures_util::stream::TryStreamExt">TryStream<wbr>Ext</a></div><div class="desc docblock-short">Adapters specific to <code>Result</code>-returning streams</div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.empty.html" title="fn futures_util::stream::empty">empty</a></div><div class="desc docblock-short">Creates a stream which contains no elements.</div></li><li><div class="item-name"><a class="fn" href="fn.iter.html" title="fn futures_util::stream::iter">iter</a></div><div class="desc docblock-short">Converts an <code>Iterator</code> into a <code>Stream</code> which is always ready
to yield the next value.</div></li><li><div class="item-name"><a class="fn" href="fn.once.html" title="fn futures_util::stream::once">once</a></div><div class="desc docblock-short">Creates a stream of a single element.</div></li><li><div class="item-name"><a class="fn" href="fn.pending.html" title="fn futures_util::stream::pending">pending</a></div><div class="desc docblock-short">Creates a stream which never returns any elements.</div></li><li><div class="item-name"><a class="fn" href="fn.poll_fn.html" title="fn futures_util::stream::poll_fn">poll_fn</a></div><div class="desc docblock-short">Creates a new stream wrapping a function returning <code>Poll&lt;Option&lt;T&gt;&gt;</code>.</div></li><li><div class="item-name"><a class="fn" href="fn.poll_immediate.html" title="fn futures_util::stream::poll_immediate">poll_<wbr>immediate</a></div><div class="desc docblock-short">Creates a new stream that always immediately returns <a href="https://doc.rust-lang.org/1.83.0/core/task/poll/enum.Poll.html#variant.Ready" title="variant core::task::poll::Poll::Ready">Poll::Ready</a> when awaiting it.</div></li><li><div class="item-name"><a class="fn" href="fn.repeat.html" title="fn futures_util::stream::repeat">repeat</a></div><div class="desc docblock-short">Create a stream which produces the same item repeatedly.</div></li><li><div class="item-name"><a class="fn" href="fn.repeat_with.html" title="fn futures_util::stream::repeat_with">repeat_<wbr>with</a></div><div class="desc docblock-short">Creates a new stream that repeats elements of type <code>A</code> endlessly by
applying the provided closure, the repeater, <code>F: FnMut() -&gt; A</code>.</div></li><li><div class="item-name"><a class="fn" href="fn.select.html" title="fn futures_util::stream::select">select</a></div><div class="desc docblock-short">This function will attempt to pull items from both streams. Each
stream will be polled in a round-robin fashion, and whenever a stream is
ready to yield an item that item is yielded.</div></li><li><div class="item-name"><a class="fn" href="fn.select_with_strategy.html" title="fn futures_util::stream::select_with_strategy">select_<wbr>with_<wbr>strategy</a></div><div class="desc docblock-short">This function will attempt to pull items from both streams. You provide a
closure to tell <a href="struct.SelectWithStrategy.html" title="struct futures_util::stream::SelectWithStrategy"><code>SelectWithStrategy</code></a> which stream to poll. The closure can
store state on <code>SelectWithStrategy</code> to which it will receive a <code>&amp;mut</code> on every
invocation. This allows basing the strategy on prior choices.</div></li><li><div class="item-name"><a class="fn" href="fn.try_unfold.html" title="fn futures_util::stream::try_unfold">try_<wbr>unfold</a></div><div class="desc docblock-short">Creates a <code>TryStream</code> from a seed and a closure returning a <code>TryFuture</code>.</div></li><li><div class="item-name"><a class="fn" href="fn.unfold.html" title="fn futures_util::stream::unfold">unfold</a></div><div class="desc docblock-short">Creates a <code>Stream</code> from a seed and a closure returning a <code>Future</code>.</div></li></ul></section></div></main></body></html>