daily pastebin goal
87%
SHARE
TWEET

Untitled

a guest May 23rd, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top