pub trait Check: Send + Sync {
// Required methods
fn id(&self) -> &str;
fn evaluate(&self, ctx: &ActionContext) -> Option<Decision>;
// Provided method
fn config_fingerprint(&self) -> String { ... }
}Expand description
A single gate check.
A check is a pure function of the ActionContext: it must not call the
host, read a clock, or mutate state, so a gate assembled from checks is
deterministic and unit-testable. Return Some(decision) to short-circuit
the gate, None to pass to the next check.
Required Methods§
Sourcefn evaluate(&self, ctx: &ActionContext) -> Option<Decision>
fn evaluate(&self, ctx: &ActionContext) -> Option<Decision>
Evaluate the context. Some short-circuits the gate; None passes on.
Provided Methods§
Sourcefn config_fingerprint(&self) -> String
fn config_fingerprint(&self) -> String
A stable fingerprint of this check’s identity and parameters, folded
into the gate’s config hash. Defaults to id; a check with
tunable parameters should override this to include them, so a recorded
decision can be bound to the exact gate configuration that produced it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".