File tree 2 files changed +8
-12
lines changed
2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -7,15 +7,11 @@ use crate::task::{Context, Poll};
7
7
8
8
pin_project ! {
9
9
/// A stream that will repeatedly yield the same list of elements
10
- pub struct Cycle <S >
11
- where
12
- S : Stream ,
13
- S :: Item : Clone ,
14
- {
10
+ pub struct Cycle <S , T > {
15
11
#[ pin]
16
12
source: S ,
17
13
index: usize ,
18
- buffer: Vec <S :: Item >,
14
+ buffer: Vec <T >,
19
15
state: CycleState ,
20
16
}
21
17
}
@@ -26,12 +22,12 @@ enum CycleState {
26
22
FromBuffer ,
27
23
}
28
24
29
- impl < S > Cycle < S >
25
+ impl < S > Cycle < S , S :: Item >
30
26
where
31
27
S : Stream ,
32
28
S :: Item : Clone ,
33
29
{
34
- pub fn new ( source : S ) -> Cycle < S > {
30
+ pub fn new ( source : S ) -> Cycle < S , S :: Item > {
35
31
Cycle {
36
32
source,
37
33
index : 0 ,
@@ -41,10 +37,10 @@ where
41
37
}
42
38
}
43
39
44
- impl < S > Stream for Cycle < S >
40
+ impl < S , T > Stream for Cycle < S , T >
45
41
where
46
- S : Stream ,
47
- S :: Item : Clone ,
42
+ S : Stream < Item = T > ,
43
+ T : Clone ,
48
44
{
49
45
type Item = S :: Item ;
50
46
Original file line number Diff line number Diff line change @@ -435,7 +435,7 @@ extension_trait! {
435
435
# })
436
436
```
437
437
"# ]
438
- fn cycle( self ) -> Cycle <Self >
438
+ fn cycle( self ) -> Cycle <Self , Self :: Item >
439
439
where
440
440
Self : Sized ,
441
441
Self :: Item : Clone ,
You can’t perform that action at this time.
0 commit comments