Skip to main content

JobHandler

Trait JobHandler 

Source
pub trait JobHandler: Send + Sync {
    // Required methods
    fn kind(&self) -> &'static str;
    fn run<'a>(
        &'a self,
        context: &'a JobContext,
    ) -> HandlerFuture<'a, JobOutput>;

    // Provided method
    fn expire<'a>(&'a self, job: &'a AsyncJob) -> HandlerFuture<'a, ()> { ... }
}
Expand description

Runs jobs of one kind.

Required Methods§

Source

fn kind(&self) -> &'static str

The kind of the jobs this handler runs.

Source

fn run<'a>(&'a self, context: &'a JobContext) -> HandlerFuture<'a, JobOutput>

Runs one job to its result. An Err fails the job with that outcome; a panic fails it too.

Provided Methods§

Source

fn expire<'a>(&'a self, job: &'a AsyncJob) -> HandlerFuture<'a, ()>

Called once for a job that has expired (or was cancelled) and is being removed, so the handler can remove whatever it produced for it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§