1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Typed sequential chain execution for rskit.
//!
//! A chain is a statically typed sequence where each step receives the previous
//! step's output and returns the next step's input type. Execution short-circuits
//! on the first [`AppError`](rskit_errors::AppError), checks cancellation between
//! steps, and runs registered cleanup actions for already-completed steps when
//! a later failure or cancellation interrupts the chain.
//!
//! # Quick start
//!
//! ```
//! use rskit_chain::{ChainBuilder, Step};
//! use tokio_util::sync::CancellationToken;
//!
//! # async fn run() -> rskit_errors::AppResult<()> {
//! let chain = ChainBuilder::new()
//! .step(Step::from_fn("parse", |input: String, _ctx| async move {
//! input.parse::<u32>().map_err(|err| {
//! rskit_errors::AppError::invalid_input("input", err.to_string())
//! })
//! }))
//! .step(Step::from_fn("double", |value: u32, _ctx| async move {
//! Ok(value * 2)
//! }))
//! .build();
//!
//! let output = chain
//! .execute("21".to_string(), None, CancellationToken::new())
//! .await?;
//! assert_eq!(output, 42);
//! # Ok(())
//! # }
//! ```
/// Fluent builder for constructing typed chain executors.
/// Typed sequential chain executor.
/// Typed step primitives.
/// Progress types.
pub use ChainBuilder;
pub use ;
pub use ;
pub use ;