Guest User

Untitled

a guest
May 23rd, 2018
84
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.  
  10. fn main() {
  11. let f = hello("world").and_then(|msg| {
  12. Ok(println!("{}", msg))
  13. });
  14.  
  15. tokio::run(f);
  16. }
Add Comment
Please, Sign In to add comment