rehearse/lib.rs
1//! Build typed operation plans, then describe, dry-run, or execute them.
2//!
3//! `rehearse` records declared operation impact. It does not infer effects from
4//! arbitrary Rust code. A pipeline builds a static ordered [`Plan`], and the
5//! runner decides whether each operation is only described, safely rehearsed, or
6//! fully executed.
7//!
8//! The default macro frontend is available through `#[operation]` and
9//! `#[pipeline]`. The manual [`PlanBuilder`] API remains public for tests and
10//! lower-level integrations.
11
12//! Manual construction works with default features disabled:
13//!
14//! ```
15//! use rehearse::{Impact, Operation, OperationMetadata, PlanBuilder};
16//!
17//! let mut builder = PlanBuilder::<(), ()>::new("example");
18//! let output = builder.add(Operation::sync(
19//! OperationMetadata::new("answer", Impact::Pure),
20//! (),
21//! |_, ()| Ok(42_u32),
22//! ));
23//! let plan = builder.try_finish(output).expect("valid plan");
24//! assert_eq!(plan.describe().len(), 1);
25//! ```
26
27#![forbid(unsafe_code)]
28
29mod describe;
30mod error;
31mod impact;
32mod operation;
33mod policy;
34mod progress;
35mod report;
36
37pub mod plan;
38mod runner;
39
40pub use describe::{
41 PlanDescription, PlanDescriptionRow, PlanExecutionDescription, PlanExecutionDescriptionRow,
42};
43pub use error::{DryRunFailure, ExecuteError, InvariantError, PlanBuildError, ValueError};
44pub use impact::Impact;
45pub use operation::{BoxFuture, Operation, OperationMetadata};
46pub use plan::{Input, IntoInput, NodeId, OperationInputs, Plan, PlanBuilder, Value};
47pub use policy::{DryRunAction, DryRunPolicy, SafeDryRun};
48pub use progress::{
49 ConsoleProgress, ConsoleProgressOptions, NoopProgress, ProgressEvent, ProgressListener,
50 ProgressMode, ProgressNode, ProgressOutcome, ProgressPlanOutcome,
51};
52pub use report::{DryRunIncomplete, DryRunReport, DryRunStatus, NodeOutcome, NodeReport};
53
54#[cfg(feature = "macros")]
55pub use rehearse_macros::{operation, pipeline, step};