pub trait Job:
Send
+ Sync
+ Serialize
+ DeserializeOwned {
// Required methods
fn execute<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = JobResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn job_type(&self) -> &'static str;
// Provided methods
fn max_retries(&self) -> u32 { ... }
fn retry_delay(&self, attempt: u32) -> Duration { ... }
fn timeout(&self) -> Duration { ... }
}Expand description
Core trait that all jobs must implement
Required Methods§
Provided Methods§
Sourcefn max_retries(&self) -> u32
fn max_retries(&self) -> u32
Get maximum number of retry attempts (default: 3)
Sourcefn retry_delay(&self, attempt: u32) -> Duration
fn retry_delay(&self, attempt: u32) -> Duration
Get retry delay (default: exponential backoff starting at 1 second)
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.