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§
Sourcefn run<'a>(&'a self, context: &'a JobContext) -> HandlerFuture<'a, JobOutput>
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§
Sourcefn expire<'a>(&'a self, job: &'a AsyncJob) -> HandlerFuture<'a, ()>
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".