Skip to content

Commit fbd5bd8

Browse files
committed
Revert "Only one generic type needed"
This reverts commit e9b9284.
1 parent 9ee804f commit fbd5bd8

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/stream/stream/cycle.rs

+7-11
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@ 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>
11-
where
12-
S: Stream,
13-
S::Item: Clone,
14-
{
10+
pub struct Cycle<S, T> {
1511
#[pin]
1612
source: S,
1713
index: usize,
18-
buffer: Vec<S::Item>,
14+
buffer: Vec<T>,
1915
state: CycleState,
2016
}
2117
}
@@ -26,12 +22,12 @@ enum CycleState {
2622
FromBuffer,
2723
}
2824

29-
impl<S> Cycle<S>
25+
impl<S> Cycle<S, S::Item>
3026
where
3127
S: Stream,
3228
S::Item: Clone,
3329
{
34-
pub fn new(source: S) -> Cycle<S> {
30+
pub fn new(source: S) -> Cycle<S, S::Item> {
3531
Cycle {
3632
source,
3733
index: 0,
@@ -41,10 +37,10 @@ where
4137
}
4238
}
4339

44-
impl<S> Stream for Cycle<S>
40+
impl<S, T> Stream for Cycle<S, T>
4541
where
46-
S: Stream,
47-
S::Item: Clone,
42+
S: Stream<Item = T>,
43+
T: Clone,
4844
{
4945
type Item = S::Item;
5046

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>
438+
fn cycle(self) -> Cycle<Self, Self::Item>
439439
where
440440
Self: Sized,
441441
Self::Item: Clone,

0 commit comments

Comments
 (0)