summaryrefslogtreecommitdiffstats
path: root/tokio/src/stream
diff options
context:
space:
mode:
authorArtem Vorotnikov <artem@vorotnikov.me>2019-12-21 00:54:43 +0300
committerCarl Lerche <me@carllerche.com>2019-12-20 13:54:43 -0800
commit3bff5a3ffe68c7bbf94fc91a58633f5a91f4266c (patch)
tree371b73bd17ea2dd7aa0a383cefbc6b48e15e96a5 /tokio/src/stream
parent248bf2144f4fa2792f430acec67bd5763236fabd (diff)
chore: formatting, docs and clippy (#2000)
Diffstat (limited to 'tokio/src/stream')
-rw-r--r--tokio/src/stream/iter.rs6
-rw-r--r--tokio/src/stream/map.rs22
-rw-r--r--tokio/src/stream/mod.rs2
-rw-r--r--tokio/src/stream/next.rs5
4 files changed, 16 insertions, 19 deletions
diff --git a/tokio/src/stream/iter.rs b/tokio/src/stream/iter.rs
index dc06495e..5909b4cf 100644
--- a/tokio/src/stream/iter.rs
+++ b/tokio/src/stream/iter.rs
@@ -30,7 +30,8 @@ impl<I> Unpin for Iter<I> {}
/// # }
/// ```
pub fn iter<I>(i: I) -> Iter<I::IntoIter>
- where I: IntoIterator,
+where
+ I: IntoIterator,
{
Iter {
iter: i.into_iter(),
@@ -38,7 +39,8 @@ pub fn iter<I>(i: I) -> Iter<I::IntoIter>
}
impl<I> Stream for Iter<I>
- where I: Iterator,
+where
+ I: Iterator,
{
type Item = I::Item;
diff --git a/tokio/src/stream/map.rs b/tokio/src/stream/map.rs
index a89769de..cc0c84e0 100644
--- a/tokio/src/stream/map.rs
+++ b/tokio/src/stream/map.rs
@@ -20,15 +20,14 @@ where
St: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- f.debug_struct("Map")
- .field("stream", &self.stream)
- .finish()
+ f.debug_struct("Map").field("stream", &self.stream).finish()
}
}
impl<St, T, F> Map<St, F>
- where St: Stream,
- F: FnMut(St::Item) -> T,
+where
+ St: Stream,
+ F: FnMut(St::Item) -> T,
{
pub(super) fn new(stream: St, f: F) -> Map<St, F> {
Map { stream, f }
@@ -36,17 +35,16 @@ impl<St, T, F> Map<St, F>
}
impl<St, F, T> Stream for Map<St, F>
- where St: Stream,
- F: FnMut(St::Item) -> T,
+where
+ St: Stream,
+ F: FnMut(St::Item) -> T,
{
type Item = T;
- fn poll_next(
- mut self: Pin<&mut Self>,
- cx: &mut Context<'_>,
- ) -> Poll<Option<T>> {
+ fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<T>> {
self.as_mut()
- .project().stream
+ .project()
+ .stream
.poll_next(cx)
.map(|opt| opt.map(|x| (self.as_mut().project().f)(x)))
}
diff --git a/tokio/src/stream/mod.rs b/tokio/src/stream/mod.rs
index 04e6dc06..2d48bc7e 100644
--- a/tokio/src/stream/mod.rs
+++ b/tokio/src/stream/mod.rs
@@ -1,6 +1,6 @@
//! Stream utilities for Tokio.
//!
-//! `Stream`s are an asynchoronous version of standard library's Iterator.
+//! A `Stream` is an asynchronous sequence of values. It can be thought of as an asynchronous version of the standard library's `Iterator` trait.
//!
//! This module provides helpers to work with them.
diff --git a/tokio/src/stream/next.rs b/tokio/src/stream/next.rs
index 3b0a1dd8..5139fbea 100644
--- a/tokio/src/stream/next.rs
+++ b/tokio/src/stream/next.rs
@@ -22,10 +22,7 @@ impl<'a, St: ?Sized + Stream + Unpin> Next<'a, St> {
impl<St: ?Sized + Stream + Unpin> Future for Next<'_, St> {
type Output = Option<St::Item>;
- fn poll(
- mut self: Pin<&mut Self>,
- cx: &mut Context<'_>,
- ) -> Poll<Self::Output> {
+ fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
Pin::new(&mut self.stream).poll_next(cx)
}
}