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