Guest User

Untitled

a guest
May 23rd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. extern crate tokio;
  2.  
  3. use tokio::prelude::*;
  4.  
  5. fn hello(name: &str) -> impl Future<Item = String, Error = ()> {
  6. future::ok(format!("Hello, {}", name))
  7. }
  8.  
  9. fn main() {
  10. let f = hello("world").and_then(|msg| {
  11. Ok(println!("{}", msg))
  12. });
  13.  
  14. tokio::run(f);
  15. }
Add Comment
Please, Sign In to add comment