Async/stream extensions to crossbeam-channel on top of Futures 0.3 Stream. It is primarily intended for usage with Tokio.
First, add this to your Cargo.toml
:
toml
[dependencies]
channel-async = "0.3.0-alpha.1"
Next, add this to your crate:
```rust use futures::{FutureExt, TryFutureExt};
let mut rt = tokio::runtime::Runtime::new().expect("Failed to create runtime");
let (tx, rx) = channelasync::unbounded(Duration::frommillis(100));
let send_fut = async move { for i in 1..100 { await!(tx.send(i))?; } Ok(()) };
rt.spawn(sendfut.maperr(|e| { error!("Failed to send: {:?}", e); () }).boxed().compat());
let recvfut = rx .tryfold(vec![], |mut agg, v| { agg.push(v); futures::future::ready(Ok(agg)) }) .boxed() .compat();
let rcvd = rt.blockon(recvfut); ```
This project is licensed under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in tls-async by you, shall be licensed as MIT, without any additional terms or conditions.