Skip to main content

Policy

Trait Policy 

Source
pub trait Policy<E> {
    // Required method
    fn decide(&self, attempts: u32, error: &E) -> Verdict;
}
Expand description

A user-obligation trait deciding, after a claimed pact’s execution fails with an infrastructure error, whether to keep letting the claim lapse (to be reclaimed and attempted again) or concede as a terminal breach.

This governs only infrastructure failures — an Executor::Error the shipped Driver would otherwise leave unsettled to lapse and be reclaimed indefinitely. It has no bearing on a clean business Outcome: the shipped Driver always settles a clean Outcome::Breached as terminal, so there is no “retry a business breach” decision for a Policy to make (see BACKLOG.md’s lifecycle-persistence entry: attempt limits stay outside the registry, as user-owned policy — this trait is that policy’s seam).

Required Methods§

Source

fn decide(&self, attempts: u32, error: &E) -> Verdict

Decide the verdict for the attempts-th consecutive infrastructure failure (counting the current one) with error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§