2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-03-01 15:49:41 +00:00
This commit is contained in:
Felipe Sere 2019-10-29 08:54:15 -05:00
parent 171cc82aed
commit fd09e2f248

View file

@ -22,13 +22,11 @@ enum CycleState {
FromBuffer, FromBuffer,
} }
impl<S, T> Stream for Cycle<S,T> impl<S, T> Stream for Cycle<S, T>
where where
S: Stream<Item = T>, S: Stream<Item = T>,
T: Clone, T: Clone,
{ {
type Item = S::Item; type Item = S::Item;
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
@ -47,7 +45,7 @@ impl<S, T> Stream for Cycle<S,T>
} }
} else { } else {
let mut index = *this.index; let mut index = *this.index;
if index == this.buffer.len() { if index == this.buffer.len() {
index = 0 index = 0
} }
next = Some(this.buffer[index].clone()); next = Some(this.buffer[index].clone());