Skip to main content
Apache Asyncband™ (Incubating) · Async Rust

Sync. Signal.
Coordinate.

Apache Asyncband™ (Incubating) software provides runtime-agnostic concurrency primitives built on standard Rust futures, without pulling an executor into your dependency tree.

26Composable APIs
24Opt-in features
0Default features
1.86+Rust MSRV
cargo add asyncband --features semaphore
use std::sync::Arc;
use asyncband::semaphore::{OwnedSemaphorePermit, Semaphore};

pub struct BudgetedChunk {
pub bytes: Vec<u8>,
_permit: OwnedSemaphorePermit,
}

pub async fn reserve(
budget: &Arc<Semaphore>,
len: usize,
) -> BudgetedChunk {
// Permit stays with the buffer until dropped.
let permit = budget.clone().acquire_owned(len).await;
BudgetedChunk {
bytes: vec![0; len],
_permit: permit,
}
}
Use case showcase
Apache Reqsign™Apache Reqsign™Request signing

Deduplicates overlapping cloud credential and delegation-key refreshes across concurrent HTTP signing callers while keeping signing crates runtime-neutral.

prekprekGit hook runner

Passes shared concurrency permits across workspace project runs to bound parallel hook execution against local CPU and I/O capacity.

Architecture

Mechanism in the library. Policy in your code.

Reusable concurrency mechanisms belong in a shared crate; task scheduling, timers, retries, and lifecycle policy belong to the application.

01

Executor-independent by construction

Built strictly on core::future::Future and core::task::Waker. Works seamlessly on Tokio as well as custom schedulers or embedded executors, without spawning tasks, owning threads, or installing timers.

02

Mechanism in the library, policy in the caller

Stateful coordination such as singleflight groups and object pools fit cleanly, while task placement, deadlines, retries, and periodic maintenance stay with your runtime.

03

Zero-default feature granularity

The crate enables no APIs by default. Opt into individual features like mutex, semaphore, or mpsc so unused primitives and optional dependencies stay out of your build.

04

Async first, synchronous at the boundary

Primitives optimize for async waker queues rather than duplicating blocking methods across every type. Synchronous callers drive futures at the boundary via blocking::FutureExt.

Patterns in practice

Choose the exact coordination contract.

Subtle concurrency bugs happen when one primitive stands in for another: retaining a value vs. collapsing overlapping calls, or dropping slow receivers vs. applying sender backpressure.

use std::sync::Arc;
use asyncband::semaphore::{OwnedSemaphorePermit, Semaphore};

pub struct TrackedStream<S> {
inner: S,
_permit: OwnedSemaphorePermit,
}

pub async fn open_stream<S>(
slots: &Arc<Semaphore>,
connect: impl AsyncFnOnce() -> S,
) -> TrackedStream<S> {
let permit = slots.clone().acquire_owned(1).await;
TrackedStream {
inner: connect().await,
_permit: permit,
}
}
API Map · v0.8.0

26 primitives across 6 families.​

Public module paths stay direct while Cargo features keep unused implementations out of your build. Select any entry to open its API reference on docs.rs.

Blocking interop

Single-future boundary adapter

blocking::FutureExt parks the calling thread for one runtime-agnostic future. wait_timeout drops the future on timeout; futures needing a timer or I/O driver still require their runtime, and executor threads must not block.

blocking contract →
Thread safety

Conditional Send and Sync

Asyncband types implement Send and Sync only when the protected, transferred, or managed value satisfies the required trait bounds, preserving use with non-Send local state where sound.

API reference →
Rust compatibility

MSRV 1.86.0 · Minor-bump policy

Built and tested against stable Rust with a minimum supported rustc of 1.86.0. Patch releases (x.y.z) preserve the MSRV; increases happen only in minor or major updates.

Start building

Add only the primitives you need.

Apache Asyncband (Incubating) 0.8.0 ships as a verified ASF source release and on crates.io for Rust 1.86.0 and newer.