Skip to main content

JobArgs

Trait JobArgs 

Source
pub trait JobArgs: Serialize {
    // Required method
    fn kind() -> &'static str
       where Self: Sized;

    // Provided methods
    fn kind_str(&self) -> &'static str
       where Self: Sized { ... }
    fn to_args(&self) -> Result<Value, Error> { ... }
}
Expand description

Trait for typed job arguments.

Implement this trait (or use #[derive(JobArgs)]) to define a job type. The kind() method returns the snake_case kind string that identifies this job type across languages.

Required Methods§

Source

fn kind() -> &'static str
where Self: Sized,

The kind string for this job type (e.g., “send_email”).

Provided Methods§

Source

fn kind_str(&self) -> &'static str
where Self: Sized,

Get the kind string for an instance.

Source

fn to_args(&self) -> Result<Value, Error>

Serialize to JSON value.

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§