feat: Add Stream trait for Flatten

yoshuawuyts-patch-1
k-nasa 5 years ago
parent cd862083a5
commit 8138afbfad

@ -54,6 +54,19 @@ impl<S: Stream<Item: IntoStream>> Flatten<S> {
}
}
impl<S, U> Stream for Flatten<S>
where
S: Stream<Item: IntoStream<IntoStream = U, Item = U::Item>> + std::marker::Unpin,
U: Stream + std::marker::Unpin,
{
type Item = U::Item;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
self.as_mut().inner().poll_next(cx)
}
}
/// Real logic of both `Flatten` and `FlatMap` which simply delegate to
/// this type.
#[derive(Clone, Debug)]

Loading…
Cancel
Save