Flume
A safe, blazingly fast multi-producer, multi-consumer channel for Rust
Repository Health
Technical Analysis
Flume is a Rust channel library offering a drop-in, ergonomic alternative to std::sync::mpsc with true multi-producer, multi-consumer (MPMC) semantics. It supports unbounded, bounded, and rendezvous queues, is implemented with zero unsafe code, and works across both synchronous threads and async runtimes.
Benchmarks consistently show flume outperforming the standard library’s channel and, in many workloads, crossbeam-channel as well, while keeping its dependency footprint and compile times minimal. A select!-like macro lets code wait on multiple channels at once, and senders/receivers are Clone + Send + Sync for flexible fan-in/fan-out patterns.
What You Get
- Unbounded, bounded, and rendezvous channel variants behind one consistent API
- Zero
unsafecode in the core implementation, verified by the crate’s own claims and structure - Native async support (
futures-sink/futures-core) so the same channel works in sync threads and async tasks - A
select!-style macro (selectfeature) for waiting on multiple channels simultaneously - Cloneable,
Send + SyncSenderandReceiverhandles for straightforward fan-in/fan-out concurrency patterns - An
eventual-fairnessfeature for randomized selection among ready channels to avoid starvation
Common Use Cases
- Worker pool fan-in - multiple producer threads send results to a single consumer that aggregates them
- Async task coordination - bridge sync producer threads with an async consumer task (or vice versa) without manual signaling
- Drop-in std::sync::mpsc replacement - swap in flume for existing
std::sync::mpsccode to get MPMC support and better throughput - Event/command buses - use
select!across several channels to implement a simple actor-style event loop
Under The Hood
Architecture - Flume centers on a shared internal queue guarded by an efficient signaling mechanism (src/signal.rs) that can wake either a parked OS thread or a polled async task, letting src/lib.rs expose a single Sender/Receiver API that works transparently across sync and async contexts; src/async.rs implements the Sink/Stream adapters, and src/select.rs implements the multi-channel select! macro used to wait on several receivers/senders at once.
Tech Stack - Pure Rust (2018 edition, MSRV 1.78), with a deliberately small dependency set: spin for an optional spinlock mode, and optional futures-sink/futures-core/fastrand gated behind the async, select, and eventual-fairness Cargo features respectively, keeping the default build lean and fast to compile.
Code Quality - The tests/ directory contains focused integration tests per behavior (mpsc.rs, async.rs, select.rs, same_channel.rs, zero.rs, golang.rs for Go-channel-style semantics), and benches/ includes Criterion-based benchmarks comparing against std::sync::mpsc and crossbeam-channel; the README explicitly advertises ‘no unsafe code anywhere in the codebase,’ a strong safety signal for a low-level concurrency primitive.
API Design - The public surface mirrors std::sync::mpsc closely (unbounded(), bounded(n), .send(), .recv(), .iter()) so existing code can often switch to flume with minimal changes, while adding async variants (.send_async(), .recv_async()) and a select! macro for more advanced coordination — a design that trades a slightly larger API surface for meaningfully more capability than the standard library channel.
Used by 5 apps in this directory
Cap
Team Chat · Video Conferencing
Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.
Enso
Analytics · Data Engineering · Low Code Platforms
A visual and textual programming platform for data prep and analysis where the node graph and the underlying Enso code are always perfectly in sync, built by an Alteryx co-founder on a GraalVM engine.
GitButler
Developer Tools · Devops · AI Development
Git, but better — a modern version control client with stacked branches, parallel workflows, unlimited undo, and first-class support for AI-powered development.
helix-db
Databases
A graph-vector database built from scratch in Rust that unifies graph traversal, vector search, key-value, and relational storage into a single platform for AI applications.
Meilisearch
Search
Lightning-fast hybrid search engine with AI-powered semantic and full-text retrieval for modern applications.