pub trait PolicyChecks {
// Required method
fn check(&mut self, policy: PolicyId, trigger: Trigger) -> PolicyOutcome;
}Expand description
What:
The policies behind the stage.
A trait is a named set of methods a type promises
to provide,
like a TS interface;
&mut self lends the provider for writing,
because a check may cache repository facts.
Why:
The stage owns order,
severity and stopping;
this seam owns what each policy
reads.
Tests drive the stage with a scripted provider,
the executable with real Git.
In TS you’d write (pseudocode):
interface PolicyChecks { check(policy: PolicyId, trigger: PolicyTrigger): Promise<PolicyOutcome> }Required Methods§
Sourcefn check(&mut self, policy: PolicyId, trigger: Trigger) -> PolicyOutcome
fn check(&mut self, policy: PolicyId, trigger: Trigger) -> PolicyOutcome
Evaluate one policy for one lifecycle point.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl<F: RepositoryFacts> PolicyChecks for ShippedChecks<F>
What:
impl<F: RepositoryFacts> PolicyChecks for ShippedChecks<F> provides the engine’s
interface for the shipped policies,
for any facts provider F.
Why:
One match over the typed policy identity is the whole registry of behavior:
the compiler refuses a policy without a check.
In TS you’d write (pseudocode):
check(policy: PolicyId, trigger: PolicyTrigger): Promise<PolicyOutcome> { switch (policy) { /* ... */ } }