futures-concurrency
Performant, portable, structured concurrency operations for async Rust that work with any runtime.
Repository Health
Technical Analysis
futures-concurrency provides structured concurrency operations for async Rust, letting you combine groups of futures and streams with primitives like join, try_join, race, race_ok, merge, zip, and chain. It works with any async runtime, does not erase lifetimes, always handles cancellation, and always returns output to the caller.
The crate exposes these operations over tuples, arrays, and vectors of futures and streams, covering both bounded and unbounded sets, with performance on par with or exceeding conventional hand-rolled approaches. It is a foundational toolkit for writing correct, ergonomic concurrent async code.
What You Get
- Future combinators:
join,try_join,race, andrace_ok - Stream combinators:
merge,zip, andchain - Support over tuples, arrays, and
Vecfor heterogeneous or dynamic sets - Runtime-agnostic operation that works with any async executor
- Correct cancellation handling and lifetime preservation
Common Use Cases
- Awaiting several futures concurrently and collecting all results
- Racing futures to take the first to complete (or first to succeed)
- Merging multiple async streams into a single combined stream
- Building structured concurrency without tying code to a specific runtime
Under The Hood
Architecture - The crate is organized by domain: src/future/ implements the future combinators (join/, try_join/, race/, race_ok/, plus future_group.rs for dynamic sets and futures_ext.rs extension traits), while src/stream/ mirrors this for streams (merge/, zip/, chain/, stream_group.rs, stream_ext.rs). A concurrent_stream/ module handles concurrent stream processing, collections/ provides the tuple/array/Vec implementations, and utils/ holds shared polling machinery. Each operation is a trait implemented across the supported container shapes, so the same method name works over a tuple, an array, or a Vec.
Tech Stack - Pure Rust (edition 2021, MSRV 1.81), runtime-agnostic and built directly on the Future/Stream traits so it does not depend on any particular executor. Dual-licensed MIT OR Apache-2.0.
Code Quality - The codebase is carefully structured around correctness guarantees the README emphasizes — no lifetime erasure, guaranteed cancellation, output always returned to the caller — with combinators split into focused modules and shared utilities factored out. The design draws on the author’s extensive ‘Futures Concurrency’ blog series documenting the semantics.
API Design - The API is a highlight: uniform, discoverable method names (join, race, merge, zip) applied consistently across tuples, arrays, and Vecs make concurrent code read naturally. Extension traits mean you call combinators fluently on existing collections, and thorough docs.rs documentation eases learning, though grasping the precise join/race semantics rewards reading the linked articles.
Used by 2 apps in this directory
InfluxDB
Databases · Analytics
Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.
Spacedrive
File Storage · Collaboration
One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.