Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. use futures::Stream;
  2.  
  3. fn main() -> Result<(), Box<std::error::Error>> {
  4. let matches = Box::new(clap::App::new("foo")
  5. .arg(clap::Arg::with_name("FILE").multiple(true).required(true))
  6. .get_matches_from(vec!["foo", "a", "b", "c"]));
  7. let matches = Box::leak(matches);
  8.  
  9. let files = matches.values_of("FILE").unwrap();
  10.  
  11. let stream = futures::stream::iter_ok::<_, ()>(files)
  12. .for_each(|x| {
  13. println!("x: {}", x);
  14. futures::future::ok(())
  15. });
  16.  
  17. tokio::run(stream);
  18.  
  19. Ok(())
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement