Skip to main content

Calendar

Trait Calendar 

Source
pub trait Calendar:
    Send
    + Sync
    + Debug {
    // Required methods
    fn resolve(
        &self,
        from: Timestamp,
        spec: &DeadlineSpec,
    ) -> Result<Timestamp, CalendarError>;
    fn digest(&self) -> Digest;
}
Expand description

Resolves a domain-specific deadline description to an instant.

§Contract

Implementations must be pure: the same (from, spec) always resolves to the same instant for a given digest. The engine journals the resolved instant and never calls back, so an impure calendar would not corrupt an existing deadline — but it would make two runs registered a millisecond apart disagree about the same regulatory window, which is worse for being intermittent.

Changing the rules means changing the digest. That makes a shifted rule visible in the journal instead of retroactive.

Required Methods§

Source

fn resolve( &self, from: Timestamp, spec: &DeadlineSpec, ) -> Result<Timestamp, CalendarError>

Source

fn digest(&self) -> Digest

Identifies this calendar’s ruleset. Recorded alongside every instant it produces.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§