Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate tokio;
- use tokio::prelude::*;
- fn hello(name: &str) -> impl Future<Item = String, Error = ()> {
- future::ok(format!("Hello, {}", name))
- }
- fn main() {
- let f = hello("world").and_then(|msg| {
- Ok(println!("{}", msg))
- });
- tokio::run(f);
- }
Add Comment
Please, Sign In to add comment