Skip to content

Commit 9ee804f

Browse files
committed
Only one generic type needed
1 parent eaa5658 commit 9ee804f

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/stream/stream/cycle.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ use crate::task::{Context, Poll};
77

88
pin_project! {
99
/// 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+
{
1115
#[pin]
1216
source: S,
1317
index: usize,
14-
buffer: Vec<T>,
18+
buffer: Vec<S::Item>,
1519
state: CycleState,
1620
}
1721
}
@@ -22,12 +26,12 @@ enum CycleState {
2226
FromBuffer,
2327
}
2428

25-
impl<S> Cycle<S, S::Item>
29+
impl<S> Cycle<S>
2630
where
2731
S: Stream,
2832
S::Item: Clone,
2933
{
30-
pub fn new(source: S) -> Cycle<S, S::Item> {
34+
pub fn new(source: S) -> Cycle<S> {
3135
Cycle {
3236
source,
3337
index: 0,
@@ -37,10 +41,10 @@ where
3741
}
3842
}
3943

40-
impl<S, T> Stream for Cycle<S, T>
44+
impl<S> Stream for Cycle<S>
4145
where
42-
S: Stream<Item = T>,
43-
T: Clone,
46+
S: Stream,
47+
S::Item: Clone,
4448
{
4549
type Item = S::Item;
4650

src/stream/stream/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ extension_trait! {
435435
# })
436436
```
437437
"#]
438-
fn cycle(self) -> Cycle<Self, Self::Item>
438+
fn cycle(self) -> Cycle<Self>
439439
where
440440
Self: Sized,
441441
Self::Item: Clone,

0 commit comments

Comments
 (0)