1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use crate::stream::{IntoStream, Merge};
use futures_core::Stream;
use super::{chain::tuple::Chain2, merge::tuple::Merge2, zip::tuple::Zip2, Chain, Zip};
pub trait StreamExt: Stream {
fn merge<T, S2>(self, other: S2) -> Merge2<T, Self, S2::IntoStream>
where
Self: Stream<Item = T> + Sized,
S2: IntoStream<Item = T>;
fn chain<T, S2>(self, other: S2) -> Chain2<Self, S2::IntoStream>
where
Self: Stream<Item = T> + Sized,
S2: IntoStream<Item = T>;
fn zip<T, S2>(self, other: S2) -> Zip2<Self, S2::IntoStream>
where
Self: Stream<Item = T> + Sized,
S2: IntoStream<Item = T>;
}
impl<S1> StreamExt for S1
where
S1: Stream,
{
fn merge<T, S2>(self, other: S2) -> Merge2<T, S1, S2::IntoStream>
where
S1: Stream<Item = T>,
S2: IntoStream<Item = T>,
{
Merge::merge((self, other))
}
fn chain<T, S2>(self, other: S2) -> Chain2<Self, S2::IntoStream>
where
Self: Stream<Item = T> + Sized,
S2: IntoStream<Item = T>,
{
Chain::chain((self, other.into_stream()))
}
fn zip<T, S2>(self, other: S2) -> Zip2<Self, S2::IntoStream>
where
Self: Stream<Item = T> + Sized,
S2: IntoStream<Item = T>,
{
Zip::zip((self, other.into_stream()))
}
}