bluetape_rs_async/lib.rs
1//! Tokio-first helpers for bounded async task execution.
2//!
3//! The helpers in this crate make task lifecycle policy explicit: callers
4//! choose between first-error execution with sibling cancellation, collect-all
5//! execution that records every operation result, and small cancellation or
6//! timeout wrappers built directly on Tokio primitives.
7//!
8//! ```
9//! use bluetape_rs_async::try_map_bounded;
10//!
11//! # async fn demo() -> Result<(), bluetape_rs_async::TaskGroupError<&'static str>> {
12//! let values = try_map_bounded([1, 2, 3], 2, |value| async move {
13//! Ok::<_, &'static str>(value * 2)
14//! })
15//! .await?;
16//!
17//! assert_eq!(values, vec![2, 4, 6]);
18//! # Ok(())
19//! # }
20//! ```
21
22mod control;
23mod task_group;
24
25pub use control::{
26 AsyncControlError, CancellationSource, CancellationToken, ShutdownSignal, ShutdownTrigger,
27 run_until_cancelled, shutdown_signal, with_deadline, with_timeout, with_timeout_or_cancel,
28};
29pub use task_group::{
30 DEFAULT_MAX_CONCURRENCY, MAX_CONCURRENCY, TaskFailure, TaskGroupError, TaskGroupReport,
31 TaskSuccess, map_bounded_collect, try_map_bounded,
32};