Skip to main content

ContextFactory

Trait ContextFactory 

Source
pub trait ContextFactory: Send + Sync {
    // Required method
    fn build(&self, actor_json: &Value) -> Result<Box<dyn ScriptContext>>;
}
Expand description

Builds a ScriptContext from JSON captured at schedule time.

Installed on ChrononBuilder at boot. The executor calls Self::build for every dispatched run using the job’s actor_json.

Required Methods§

Source

fn build(&self, actor_json: &Value) -> Result<Box<dyn ScriptContext>>

Reconstruct handler context from actor JSON stored on the job.

Returns IdentityError (mapped to ChrononError::Internal) when the payload cannot be decoded into application identity.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§