pub trait JobHandler<Args>:
Clone
+ Send
+ 'static {
// Required method
fn call(self, ctx: JobContext) -> impl Future<Output = Result<()>> + Send;
}Expand description
Trait implemented by all valid job handler functions.
A job handler is any async fn whose arguments each implement
FromJobContext. Up to 12 arguments are supported via blanket
implementations.
You never implement this trait directly — write a plain async fn and pass
it to WorkerBuilder::register.
§Supported signatures
use modo::job::{Payload, Meta};
use serde::Deserialize;
#[derive(Deserialize)]
struct MyPayload { value: u32 }
// Zero arguments
async fn job_no_args() -> modo::Result<()> { Ok(()) }
// One argument
async fn job_one_arg(payload: Payload<MyPayload>) -> modo::Result<()> { Ok(()) }
// Multiple arguments (up to 12)
async fn job_two_args(payload: Payload<MyPayload>, meta: Meta) -> modo::Result<()> { Ok(()) }Required Methods§
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.