pub trait Job: Send + Sync {
// Required methods
fn execute(&self);
fn schedule(&self) -> Schedule;
// Provided methods
fn should_run(&self) -> bool { ... }
fn allow_parallel_runs(&self) -> bool { ... }
fn now(&self) -> DateTime<Utc> { ... }
}Expand description
Job Trait
Implement this trait for any struct you want to run as a Job.
Required Methods§
Provided Methods§
Sourcefn should_run(&self) -> bool
fn should_run(&self) -> bool
Returns whether the job should run now or not
Sourcefn allow_parallel_runs(&self) -> bool
fn allow_parallel_runs(&self) -> bool
If you want your Job to run again, while another instance of it is already running overwrite this The default behaviour is that while a job is running it will not be executed again.
fn now(&self) -> DateTime<Utc>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".