Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add stream::interval #298

Merged
5 commits merged into from
Oct 15, 2019
Merged

add stream::interval #298

5 commits merged into from
Oct 15, 2019

Conversation

yoshuawuyts
Copy link
Contributor

Adds stream::interval as "unstable", implementing #18 (comment). Had to incorporate #275 for this unfortunately also. This integrates the now defunct futures_timer::Interval code into async_std, building only on the Delay primitive. Thanks!

Closes #275.

cc/ @shaikh-raj

Example

use std::time::Duration;
use futures::prelude::*;

let interval = Interval::new(Duration::from_secs(4));
while let Some(_) = interval.next().await {
    println!("prints every four seconds"));
}

Screenshot

Screenshot_2019-10-09 async_std stream interval - Rust

@yoshuawuyts yoshuawuyts added the enhancement New feature or request label Oct 9, 2019
@yoshuawuyts yoshuawuyts mentioned this pull request Oct 11, 2019
@yoshuawuyts yoshuawuyts added this to the 0.99.10 milestone Oct 13, 2019
Signed-off-by: Yoshua Wuyts <[email protected]>
Signed-off-by: Yoshua Wuyts <[email protected]>
Signed-off-by: Yoshua Wuyts <[email protected]>
Signed-off-by: Yoshua Wuyts <[email protected]>
Signed-off-by: Yoshua Wuyts <[email protected]>
@ghost ghost merged commit e938527 into master Oct 15, 2019
@ghost ghost deleted the interval branch October 15, 2019 13:30
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce dependency on futures_timer
1 participant