#channel #async #multi-consumer #non-blocking

chunnel

Async mpmc(multi producer multi consumer) channel

1 unstable release

0.1.0 Jan 21, 2025

#926 in Asynchronous

Download history 48/week @ 2025-01-15 47/week @ 2025-01-22

95 downloads per month

MIT license

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"

No runtime deps