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.8"
Next, add this to your crate:
```rust use futures::{FutureExt, TryFutureExt};
async fn runchannels() { let (tx, rx) = channelasync::unbounded(Duration::from_millis(100));
let send_fut = async move {
for i in 1..100 {
tx.send(i).await.expect("Failed to send");
}
};
tokio::spawn(send_fut);
let recv_fut = async move {
let rcvd: Vec<_> = rx.collect().await;
rcvd
};
let rcvd = recv_fut.await;
println!("Received {} messages", rcvd.len());
} ```
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.