loole 0.1.2

A safe async/sync multi-producer, multi-consumer channel
Documentation

Loole

A safe async/sync multi-producer multi-consumer channel.

Github Actions Documentation Cargo License

Producers can send and consumers can receive messages asynchronously or synchronously:

  • async send -> async receive
  • sync send -> sync receive
  • async send -> sync receive
  • sync send -> async receive
fn main() {
    let (tx, rx) = loole::unbounded();

    std::thread::spawn(move || {
        for i in (0..10) {
            tx.send(i).unwrap();
        }
    });

    let mut sum = 0;
    while let Ok(i) = rx.recv() {
        sum += i;
    }

    assert_eq!(sum, (0..10).sum());
}

Usage

To use Loole, place the following line under the [dependencies] section in your Cargo.toml:

loole = "0.1.2"

Benchmarks

MPSC

MPSC

MPMC

MPMC

SPSC

SPSC

License

Loole is licensed under either of: