Skip to content

Commit e9b9284

Browse files
committed
Only one generic type needed
1 parent ddc745e commit e9b9284

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/stream/stream/cycle.rs

Lines changed: 11 additions & 7 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ extension_trait! {
395395
# })
396396
```
397397
"#]
398-
fn cycle(self) -> Cycle<Self, Self::Item>
398+
fn cycle(self) -> Cycle<Self>
399399
where
400400
Self: Sized,
401401
Self::Item: Clone,

0 commit comments

Comments
 (0)