Revert "Only one generic type needed"

This reverts commit e9b9284863a614b852c22d58205cb983fc26682a.
poc-serde-support
Felipe Sere 5 years ago
parent 9ee804f9ed
commit fbd5bd867d

@ -7,15 +7,11 @@ use crate::task::{Context, Poll};
pin_project! { pin_project! {
/// A stream that will repeatedly yield the same list of elements /// A stream that will repeatedly yield the same list of elements
pub struct Cycle<S> pub struct Cycle<S, T> {
where
S: Stream,
S::Item: Clone,
{
#[pin] #[pin]
source: S, source: S,
index: usize, index: usize,
buffer: Vec<S::Item>, buffer: Vec<T>,
state: CycleState, state: CycleState,
} }
} }
@ -26,12 +22,12 @@ enum CycleState {
FromBuffer, FromBuffer,
} }
impl<S> Cycle<S> impl<S> Cycle<S, S::Item>
where where
S: Stream, S: Stream,
S::Item: Clone, S::Item: Clone,
{ {
pub fn new(source: S) -> Cycle<S> { pub fn new(source: S) -> Cycle<S, S::Item> {
Cycle { Cycle {
source, source,
index: 0, index: 0,
@ -41,10 +37,10 @@ where
} }
} }
impl<S> Stream for Cycle<S> impl<S, T> Stream for Cycle<S, T>
where where
S: Stream, S: Stream<Item = T>,
S::Item: Clone, T: Clone,
{ {
type Item = S::Item; type Item = S::Item;

@ -435,7 +435,7 @@ extension_trait! {
# }) # })
``` ```
"#] "#]
fn cycle(self) -> Cycle<Self> fn cycle(self) -> Cycle<Self, Self::Item>
where where
Self: Sized, Self: Sized,
Self::Item: Clone, Self::Item: Clone,

Loading…
Cancel
Save