Skip to main content

Crate io_pass

Crate io_pass 

Source
Expand description

The logic of passing values through named stages.

io-pass keeps ownership explicit: every stage either passes a value onward or blocks it while returning the value and a reason. A Passage records a trace, stops at the first block, and never silently discards input.

§Example

use io_pass::{PassResult, Passage, Stage};

let mut passage = Passage::<String, &'static str>::new();
passage.push(Stage::inspect("not empty", |value: &String| {
    if value.is_empty() { Err("empty") } else { Ok(()) }
})?)?;
passage.push(Stage::transform("normalize", |value: String| value.trim().to_lowercase())?)?;

let result = passage.run("  PASS  ".to_owned());
match result {
    PassResult::Passed(done) => assert_eq!(done.value(), "pass"),
    PassResult::Blocked(_) => unreachable!(),
}

Structs§

Blocked
A value stopped at one stage with an application-defined reason.
PassToken
A value wrapper that can be redeemed only by consuming the token.
Passage
An ordered pipeline that stops at the first block.
Passed
A value that passed every stage.
Stage
A named, cloneable, thread-safe pass-or-block stage.
TraceEntry
One immutable entry in a passage trace.

Enums§

Error
Pipeline definition errors.
PassResult
The final result of running a Passage.
StageOutcome
A stage’s ownership-preserving decision.
TraceStatus
Whether one pipeline stage passed or blocked a value.