diff options
author | Carl Lerche <me@carllerche.com> | 2020-01-07 11:40:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-07 11:40:37 -0800 |
commit | 10398b20c02ca14289de66d175bf98bd0c06ada6 (patch) | |
tree | 90e7c576d430eb6f7e5e2c6f881a8343117ddf76 /tokio/src/stream/mod.rs | |
parent | 780d6f91a0b56c9cbfca01a9a4694f21eb670f96 (diff) |
docs: minor tweaks to `StreamExt` API docs (#2066)
Diffstat (limited to 'tokio/src/stream/mod.rs')
-rw-r--r-- | tokio/src/stream/mod.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tokio/src/stream/mod.rs b/tokio/src/stream/mod.rs index 94ed6bd1..b427e3c4 100644 --- a/tokio/src/stream/mod.rs +++ b/tokio/src/stream/mod.rs @@ -39,7 +39,8 @@ pub use futures_core::Stream; /// An extension trait for `Stream`s that provides a variety of convenient /// combinator functions. pub trait StreamExt: Stream { - /// Creates a future that resolves to the next item in the stream. + /// Consumes and returns the next value in the stream or `None` if the + /// stream is finished. /// /// Equivalent to: /// @@ -76,8 +77,14 @@ pub trait StreamExt: Stream { Next::new(self) } - /// Creates a future that attempts to resolve the next item in the stream. - /// If an error is encountered before the next item, the error is returned instead. + /// Consumes and returns the next item in the stream. If an error is + /// encountered before the next item, the error is returned instead. + /// + /// Equivalent to: + /// + /// ```ignore + /// async fn try_next(&mut self) -> Result<Option<T>, E>; + /// ``` /// /// This is similar to the [`next`](StreamExt::next) combinator, /// but returns a [`Result<Option<T>, E>`](Result) rather than @@ -273,6 +280,7 @@ pub trait StreamExt: Stream { } /// Tests if every element of the stream matches a predicate. + /// /// `all()` takes a closure that returns `true` or `false`. It applies /// this closure to each element of the stream, and if they all return /// `true`, then so does `all`. If any of them return `false`, it |