Enum Guard
pub enum Guard {
Spec(Pred),
Custom(Arc<dyn Fn(&FlowCtx<'_>) -> bool + Send + Sync>),
}Expand description
A boolean predicate over (state, marking) — the only predicate type.
Use the constructors (Guard::is_true, Guard::captured,
Guard::called_ok, …) for the serializable closed atoms, or
Guard::custom for a bespoke closure (not serializable).
Variants§
Spec(Pred)
A serializable predicate built from the closed atom set.
Custom(Arc<dyn Fn(&FlowCtx<'_>) -> bool + Send + Sync>)
A code-only escape hatch. Not serializable.
Implementations§
§impl Guard
impl Guard
pub fn eq(key: impl Into<String>, value: impl Into<Value>) -> Guard
pub fn eq(key: impl Into<String>, value: impl Into<Value>) -> Guard
State key equals the given JSON value.
pub fn resolved(name: impl AsRef<str>) -> Guard
pub fn resolved(name: impl AsRef<str>) -> Guard
True once an orchestrated agent named name has produced a result
(its {name}:result state key is set). Pairs with the
orchestration call/dispatch/background.
pub fn all(guards: impl IntoIterator<Item = Guard>) -> Guard
pub fn all(guards: impl IntoIterator<Item = Guard>) -> Guard
Conjunction.
If every input is a serializable atom, the result is a serializable
Pred::All. If any input is a Guard::custom, the result is itself a
custom guard that evaluates the conjunction at runtime — the custom guard
is never silently dropped (it merely makes the combinator
non-serializable, which surfaces as an error only if you try to serialize
the flow).
pub fn any(guards: impl IntoIterator<Item = Guard>) -> Guard
pub fn any(guards: impl IntoIterator<Item = Guard>) -> Guard
Disjunction.
Mirrors Guard::all: custom inputs are preserved as a runtime closure
rather than erased.