Created
February 22, 2018 01:32
-
-
Save saethlin/fb5dddc657fe03188e22c07ea2fea143 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate futures; | |
extern crate tokio; | |
use futures::future::lazy; | |
use tokio::executor::current_thread; | |
fn main() { | |
let data = vec![1, 2, 3, 4, 5]; | |
current_thread::run(move |_| { | |
for num in data.iter() { | |
current_thread::spawn(lazy(move || { | |
println!("printing {}", num); | |
Ok(()) | |
})); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment