Expand description
Tokio-first helpers for bounded async task execution.
The helpers in this crate make task lifecycle policy explicit: callers choose between first-error execution with sibling cancellation, collect-all execution that records every operation result, and small cancellation or timeout wrappers built directly on Tokio primitives.
use bluetape_rs_async::try_map_bounded;
let values = try_map_bounded([1, 2, 3], 2, |value| async move {
Ok::<_, &'static str>(value * 2)
})
.await?;
assert_eq!(values, vec![2, 4, 6]);Structs§
- Cancellation
Source - Handle used to request cancellation for one or more
CancellationTokens. - Cancellation
Token - Receiver-side cancellation token.
- Shutdown
Signal - Listener side of a shutdown signal pair.
- Shutdown
Trigger - Trigger side of a shutdown signal pair.
- Task
Failure - A failed operation result captured by
map_bounded_collect. - Task
Group Report - Operation results captured by
map_bounded_collect. - Task
Success - A successful operation result captured by
map_bounded_collect.
Enums§
- Async
Control Error - Error returned by timeout, deadline, cancellation, and shutdown helpers.
- Task
Group Error - Error returned by bounded task helpers.
Constants§
- DEFAULT_
MAX_ CONCURRENCY - Default concurrency bound for callers that do not need a custom limit.
- MAX_
CONCURRENCY - Maximum accepted concurrency bound.
Functions§
- map_
bounded_ collect - Runs operations with bounded concurrency and records every operation result.
- run_
until_ cancelled - Runs a future until either it completes or cancellation is requested.
- shutdown_
signal - Creates a shutdown trigger and its first listener.
- try_
map_ bounded - Runs operations with a bounded number of Tokio tasks.
- with_
deadline - Runs a future until a Tokio deadline.
- with_
timeout - Runs a future with a Tokio timeout.
- with_
timeout_ or_ cancel - Runs a future until it completes, times out, or cancellation is requested.