Skip to main content

JobExt

Trait JobExt 

Source
pub trait JobExt: Job + Serialize {
    // Provided method
    fn dispatch<'a>(
        &'a self,
        env: &'a Env,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'a>> { ... }
}
Expand description

Extension trait that adds dispatch() to any Job implementor.

This is separate from the Job trait because typetag needs Job to be object-safe, and dispatch requires Serialize.

Provided Methods§

Source

fn dispatch<'a>( &'a self, env: &'a Env, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'a>>

Serialize this job and send it to its queue via the worker Env.

The binding name from queue_binding() (e.g. "QUEUE") is automatically prefixed with the project name (e.g. "EXAMPLE_BASIC_QUEUE").

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.

Implementors§

Source§

impl<T> JobExt for T
where T: Job + Serialize,