30 releases

0.10.9 Aug 25, 2021
0.10.7 Jun 10, 2021
0.10.2 Feb 7, 2021
0.10.1 Dec 30, 2020
0.2.0 Jul 31, 2019

#8 in Concurrency

Download history 13995/week @ 2021-06-01 13753/week @ 2021-06-08 15434/week @ 2021-06-15 14942/week @ 2021-06-22 15991/week @ 2021-06-29 14202/week @ 2021-07-06 16465/week @ 2021-07-13 17174/week @ 2021-07-20 19316/week @ 2021-07-27 15139/week @ 2021-08-03 15128/week @ 2021-08-10 15838/week @ 2021-08-17 17636/week @ 2021-08-24 14281/week @ 2021-08-31 16913/week @ 2021-09-07 20456/week @ 2021-09-14

65,902 downloads per month
Used in 156 crates (81 directly)

Apache-2.0/MIT

69KB
1.5K SLoC

Flume

A blazingly fast multi-producer, multi-consumer channel.

Cargo Documentation License actions-badge

use std::thread;

fn main() {
    println!("Hello, world!");

    let (tx, rx) = flume::unbounded();

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

    let received: u32 = rx.iter().sum();

    assert_eq!((0..10).sum::<u32>(), received);
}

Why Flume?

  • Featureful: Unbounded, bounded and rendezvous queues
  • Fast: Always faster than std::sync::mpsc and sometimes crossbeam-channel
  • Safe: No unsafe code anywhere in the codebase!
  • Flexible: Sender and Receiver both implement Send + Sync + Clone
  • Familiar: Drop-in replacement for std::sync::mpsc
  • Capable: Additional features like MPMC support and send timeouts/deadlines
  • Simple: Few dependencies, minimal codebase, fast to compile
  • Asynchronous: async support, including mix 'n match with sync code
  • Ergonomic: Powerful select-like interface

Usage

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

flume = "x.y"

Benchmarks

Although Flume has its own extensive benchmarks, don't take it from here that Flume is quick. The following graph is from the crossbeam-channel benchmark suite.

Tests were performed on an AMD Ryzen 7 3700x with 8/16 cores running Linux kernel 5.11.2 with the bfq scheduler.

Flume benchmarks (crossbeam benchmark suite)

License

Flume is licensed under either of:

Dependencies

~270–590KB