Skip to content

Commit 8138afb

Browse files
committed
feat: Add Stream trait for Flatten
1 parent cd86208 commit 8138afb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/stream/stream/flatten.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ impl<S: Stream<Item: IntoStream>> Flatten<S> {
5454
}
5555
}
5656

57+
impl<S, U> Stream for Flatten<S>
58+
where
59+
S: Stream<Item: IntoStream<IntoStream = U, Item = U::Item>> + std::marker::Unpin,
60+
U: Stream + std::marker::Unpin,
61+
{
62+
type Item = U::Item;
63+
64+
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
65+
self.as_mut().inner().poll_next(cx)
66+
}
67+
}
68+
69+
5770
/// Real logic of both `Flatten` and `FlatMap` which simply delegate to
5871
/// this type.
5972
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)