21 releases (8 breaking)

0.9.2 Nov 20, 2020
0.8.4 Sep 2, 2020
0.7.2 Jul 22, 2020
0.7.1 Mar 22, 2020
0.2.0 Jul 31, 2019

#13 in Concurrency

Download history 404/week @ 2020-08-10 264/week @ 2020-08-17 350/week @ 2020-08-24 554/week @ 2020-08-31 1038/week @ 2020-09-07 1446/week @ 2020-09-14 1460/week @ 2020-09-21 2088/week @ 2020-09-28 3243/week @ 2020-10-05 2907/week @ 2020-10-12 2954/week @ 2020-10-19 3132/week @ 2020-10-26 3114/week @ 2020-11-02 4087/week @ 2020-11-09 8040/week @ 2020-11-16 8787/week @ 2020-11-23

10,687 downloads per month
Used in 59 crates (20 directly)

Apache-2.0/MIT

62KB
1.5K SLoC

Flume

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

Cargo Documentation License actions-badge

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

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

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

assert_eq!((0..10).sum(), 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.

Flume benchmarks (crossbeam benchmark suite)

License

Flume is licensed under either of:

Dependencies

~175–700KB
~13K SLoC