Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate futures;
- extern crate tokio;
- use futures::channel::mpsc::Receiver;
- use futures::stream::StreamExt;
- use tokio::prelude::{
- future::{loop_fn, Loop},
- Future, Stream,
- };
- fn receiverz(mut rx: Receiver<Vec<String>>) -> impl Future<Item = (), Error = ()> {
- loop_fn(rx, |rx| {
- rx.then(|event| {
- println!("RECEIVED events {:?}", event);
- if true {
- Ok(Loop::Continue(rx))
- } else {
- Ok(Loop::Break(()))
- }
- })
- })
- }
- fn main() {}
Add Comment
Please, Sign In to add comment