Crates.io | num_stream |
lib.rs | num_stream |
version | 0.1.2 |
source | src |
created_at | 2020-04-13 02:38:44.215506 |
updated_at | 2020-04-13 04:08:36.450735 |
description | Rust crate that provides a Stream that yields incrementing numbers at a specified interval |
homepage | |
repository | https://github.com/BroderickCarlin/num_stream |
max_upload_size | |
id | 229584 |
size | 22,991 |
This crate provides a Stream that yields numeric values at a specifed interval and that increments at a specifed rate.
This crate was born out of the desire for a simple configurable stream that would yield ever changing, yet predictable values.
The num_stream method can be used to acquire an instance of a NumStream struct which implements a Futures 0.3 Stream.
use futures::stream::StreamExt;
use num_stream::num_stream;
use std::time::Duration;
use tokio;
#[tokio::main]
async fn main() {
let mut nums = num_stream(0, 3, Duration::from_millis(500));
loop {
println!("Got: {:?}", nums.next().await);
}
}