We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa91d7f commit dea1b67Copy full SHA for dea1b67
src/stream/stream/cycle.rs
@@ -0,0 +1,20 @@
1
+use std::pin::Pin;
2
+
3
+use pin_project_lite::pin_project;
4
5
+use crate::stream::Stream;
6
+use crate::task::{Context, Poll};
7
8
+/// A stream that will repeatedly yield the same list of elements
9
+pub struct Cycle<T> {
10
+ source: Vec<T>,
11
+ index: usize,
12
+}
13
14
+impl<T: Copy> Stream for Cycle<T> {
15
+ type Item = T;
16
17
+ fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
18
+ Poll::Pending
19
+ }
20
src/stream/stream/mod.rs
@@ -24,9 +24,10 @@
24
mod all;
25
mod any;
26
mod chain;
27
-mod cmp;
28
-mod copied;
29
mod enumerate;
+mod cycle;
+mod copied;
30
+mod cmp;
31
mod eq;
32
mod filter;
33
mod filter_map;
0 commit comments