Skip to main content

Check

Trait Check 

Source
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§

Source

fn id(&self) -> &str

A stable identifier for this check (e.g. "secrets", "grounding").

Source

fn evaluate(&self, ctx: &ActionContext) -> Option<Decision>

Evaluate the context. Some short-circuits the gate; None passes on.

Provided Methods§

Source

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".

Implementors§