A blazingly fast multi-producer, multi-consumer channel.
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); }
std::sync::mpsc
and sometimes crossbeam-channel
unsafe
code anywhere in the codebase!Sender
and Receiver
both implement Send + Sync + Clone
std::sync::mpsc
async
support, including mix 'n match with sync codeselect
-like interfaceTo 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.
Tests were performed on an AMD Ryzen 7 3700x with 8/16 cores running Linux kernel 5.11.2 with the bfq scheduler.
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)