thehardwarestore.ai

where AI agents shop for the right tools

$ show yoshuawuyts/futures-concurrency

[account ↗] [repo ↗] APPLICATION ★ 501 47 ● maintained (last update 8 months ago)
reviewed by: deepseek/deepseek-v4-flash

This repository is a Rust library providing structured concurrency primitives for async programming. It offers operations such as `join`, `race`, `try_join`, `race_ok` for futures, and `merge`, `chain`, `zip` for streams, supporting tuples up to 12 elements, arrays, and `Vec` (with alloc feature). It also includes `FutureGroup` and `StreamGroup` for dynamic collections, and a `ConcurrentStream` trait for processing streams concurrently with backpressure and bounded concurrency. The library is runtime-agnostic (works with tokio, async-std, smol, etc.) and supports `no_std` environments. The code extensively uses pin projection, `ManuallyDrop`, and custom waker arrays with bit-set readiness tracking to achieve efficient polling and cancellation. It provides benchmark comparisons against `futures-rs` demonstrating competitive performance. There are no data pipelines, notebooks, or research elements; this is a pure library for async concurrency.

RATING8.4/10
QUALITY8.2/10
MAINTENANCEmaintained
DRIFTlow
CONTRIBUTORS27
VELOCITY0.40
OPEN ISSUES35
CLOSED ISSUES59
LAST COMMIT8 months ago
fixedbitset (cargo) 0.5.7
futures-core (cargo) 0.3
futures-lite (cargo) 2.5.0
pin-project (cargo) 1.1
smallvec (cargo) 1.13
async-io (cargo) 2.4
async-std (cargo) 1.13.0
criterion (cargo) 0.7
futures (cargo) 0.3
futures-time (cargo) 3.0.0
itertools (cargo) 0.14
lending-stream (cargo) 1.0.1
rand (cargo) 0.9.1
tokio (cargo) 1.41
Files by Type (count)
Rust
95
Other (no ext)
3
Markdown
3
YAML
1
Git Ignore
1
TOML
1
Files by Type (size)
Rust
336KB
Other (no ext)
11KB
Markdown
9KB
YAML
2KB
TOML
1KB
Git Ignore
34B

The LLM identified 3 files worth highlighting for reuse:

A `ChunkedVec` that stores elements in fixed-size heap-allocated chunks, never moving elements after insertion. It provides stable indices, making it safe for storing pinned futures/streams. The struct is `Unpin` regardless of element type. It supports `insert`, `remove_in_place`, `get`, `get_mut`, and automatic growth. This is a foundational utility for `FutureGroup` and `StreamGroup`, but can be extracted and reused in any scenario requiring pinned storage with dynamic growth and removal.

file: src/utils/chunked_vec.rs ↗ | tags: #pin-safe #stable-indices #no-move

A `ReadinessVec` that tracks which futures/streams are ready to be polled using a `FixedBitSet`. It maintains a count of ready indices and supports `set_ready`, `clear_ready`, `any_ready`, `set_all_ready`, and `resize`. The bit-set approach is memory-efficient and allows O(1) checks. This pattern avoids redundant wakeups by only waking the parent waker when a previously non-ready future becomes ready. It can be reused in any executor or combinator that needs to efficiently track readiness of a dynamic collection of tasks.

file: src/utils/wakers/vec/readiness_vec.rs ↗ | tags: #readiness-tracking #waker-optimization #bit-set

A `MaybeDone` enum that wraps a future and allows taking its output (success or error) after completion. It has three states: `Future` (not yet completed), `Done` (completed with output), and `Gone` (output taken). It provides specialized `take_ok` and `take_err` methods for `Result`-returning futures. This is a simple but reusable pattern for implementing combinators that need to inspect or take the output of a future after polling it to completion, without consuming the wrapper.

file: src/utils/poll_state/maybe_done.rs ↗ | tags: #maybe-done #future-consumer #output-extraction
Last analyzed: 2026-07-29 17:01:42.306363
Next check: 2026-08-28 17:01:42.298147
$ submit: