pub trait WorkerOutputHandler {
// Required method
fn handle_result(
self,
client: Client,
job: ActivatedJob,
) -> impl Future<Output = ()> + Send + 'static;
}Expand description
A trait for handling the output of job processing.
This trait defines how different output types should be handled after job processing is complete. It provides built-in implementations for common result types.
§Type Parameters
T- The type of output produced by the job handler
§Examples
ⓘ
impl WorkerOutputHandler for MyStruct {
fn handle_result(self, client: Client, job: ActivatedJob) -> impl Future<Output = ()> + Send + 'static {
if let Ok(req) = client
.complete_job()
.with_job_key(job.key())
.with_variables(self)
{
let _ = req.send().await;
}
}Required Methods§
fn handle_result( self, client: Client, job: ActivatedJob, ) -> impl Future<Output = ()> + Send + 'static
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.