mirror of
https://github.com/async-rs/async-std.git
synced 2025-03-28 20:16:41 +00:00
stub out an example
This commit is contained in:
parent
dea1b67670
commit
a096d5ec2d
1 changed files with 18 additions and 0 deletions
|
@ -18,3 +18,21 @@ impl<T: Copy> Stream for Cycle<T> {
|
||||||
Poll::Pending
|
Poll::Pending
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// Basic usage:
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// # fn main() -> std::io::Result<()> { async_std::task::block_on(async {
|
||||||
|
///
|
||||||
|
/// let values = vec![1,2,3];
|
||||||
|
///
|
||||||
|
/// # Ok(()) }) }
|
||||||
|
///```
|
||||||
|
fn cycle<T: Copy>(values: Vec<T>) -> impl Stream<Item = T> {
|
||||||
|
Cycle {
|
||||||
|
source: values,
|
||||||
|
index: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue