A blazingly fast multi-producer, multi-consumer channel.
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);
- Featureful: Unbounded, bounded and rendezvous queues
- Fast: Always faster than
std::sync::mpsc
and sometimescrossbeam-channel
- Safe: No
unsafe
code anywhere in the codebase! - Flexible:
Sender
andReceiver
both implementSend + 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
To use Flume, place the following line under the [dependencies]
section in your Cargo.toml
:
flume = "x.y"
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 is licensed under either of:
-
Apache License 2.0, (http://www.apache.org/licenses/LICENSE-2.0)
-
MIT license (http://opensource.org/licenses/MIT)