Skip to content

Rust crate that provides a Stream that yields incrementing numbers at a specified interval

License

Notifications You must be signed in to change notification settings

BroderickCarlin/num_stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Num Stream

Latest Version License Downloads

This crate provides a Stream that yields numeric values at a specifed interval and that increments at a specifed rate.

API Documentation

crates.io


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.

Example

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);
    }
}

License

Licensed under Apache License, Version 2.0

About

Rust crate that provides a Stream that yields incrementing numbers at a specified interval

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages