Skip to content

Instantly share code, notes, and snippets.

@Archina
Last active September 18, 2018 18:05
Show Gist options
  • Save Archina/6e6d98f6972eca50eca4dcd064c0f016 to your computer and use it in GitHub Desktop.
Save Archina/6e6d98f6972eca50eca4dcd064c0f016 to your computer and use it in GitHub Desktop.
extern crate futures;
extern crate tokio;
use futures::{Future, Stream};
use tokio::timer::*;
use std::time::{Duration, Instant};
fn main() {
let ten_millis = Duration::from_millis(150);
let interval_a = Interval::new(Instant::now(), ten_millis);
let interval_b = Interval::new(Instant::now(), ten_millis);
let task = interval_a
.for_each(|_x| {
println!("");
println!("TestString");
Ok(())
})
.map_err(|_| (()) );
tokio::run(task);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment