1 unstable release
0.1.0 | Jan 21, 2025 |
---|
#1428 in Asynchronous
35KB
724 lines
Chunnel
Async mpmc(multi producer multi consumer) channel.
Usage
This crate provides an async version of the mpmc channel, similar to std::sync::mpmc
or crossbeam_channel
.
Example code:
use chunnel::mpmc::bounded::bounded;
#[tokio::main]
async fn main() {
let (sender, receiver) = bounded::<i32, 16>();
tokio::spawn(async move {
for i in 0..10 {
sender.send(i).await.unwrap();
}
});
let _ = receiver.recv().await.unwrap();
}
Cargo.toml
[dependencies]
chunnel = "0.1"
lib.rs
:
Chunnel
Async mpmc(multi producer multi consumer) channel.
Usage
This crate provides an async version of the mpmc channel, similar to std::sync::mpmc
or crossbeam_channel
.
Example code:
use chunnel::mpmc::bounded::bounded;
#[tokio::main]
async fn main() {
let (sender, receiver) = bounded::<i32, 16>();
tokio::spawn(async move {
for i in 0..10 {
sender.send(i).await.unwrap();
}
});
let _ = receiver.recv().await.unwrap();
}
Cargo.toml
[dependencies]
chunnel = "0.1"