Struct lightspeed_scheduler::JobExecutor
source · pub struct JobExecutor { /* private fields */ }
Implementations§
source§impl JobExecutor
impl JobExecutor
sourcepub fn new_with_local_tz() -> JobExecutor
pub fn new_with_local_tz() -> JobExecutor
Creates a new Executor that uses the Local time zone for the execution times evaluation. For example, the cron expressions will refer to the Local time zone.
sourcepub fn new_with_utc_tz() -> JobExecutor
pub fn new_with_utc_tz() -> JobExecutor
Creates a new Executor that uses the UTC time zone for the execution times evaluation. For example, the cron expressions will refer to the UTC time zone.
sourcepub fn new_with_tz(timezone: Option<Tz>) -> JobExecutor
pub fn new_with_tz(timezone: Option<Tz>) -> JobExecutor
Creates a new Executor that uses a custom time zone for the execution times evaluation. For example, the cron expressions will refer to the specified time zone.
sourcepub async fn add_job(
&self,
schedule: &dyn TryToScheduler,
job: Job,
) -> Result<(), SchedulerError>
pub async fn add_job( &self, schedule: &dyn TryToScheduler, job: Job, ) -> Result<(), SchedulerError>
Adds a job to the JobExecutor.
sourcepub async fn add_job_with_multi_schedule(
&self,
schedule: &[&dyn TryToScheduler],
job: Job,
) -> Result<(), SchedulerError>
pub async fn add_job_with_multi_schedule( &self, schedule: &[&dyn TryToScheduler], job: Job, ) -> Result<(), SchedulerError>
Adds a job to the JobExecutor.
sourcepub async fn add_job_with_scheduler<S: Into<Scheduler>>(
&self,
schedule: S,
job: Job,
)
pub async fn add_job_with_scheduler<S: Into<Scheduler>>( &self, schedule: S, job: Job, )
Adds a job to the JobExecutor.
sourcepub async fn run(&self) -> Result<JoinHandle<()>, SchedulerError>
pub async fn run(&self) -> Result<JoinHandle<()>, SchedulerError>
Starts the JobExecutor
sourcepub fn set_sleep_between_checks(&self, sleep: Duration)
pub fn set_sleep_between_checks(&self, sleep: Duration)
Sets the sleep time between checks for pending Jobs. The default is 1 second.
Trait Implementations§
source§impl Clone for JobExecutor
impl Clone for JobExecutor
source§fn clone(&self) -> JobExecutor
fn clone(&self) -> JobExecutor
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for JobExecutor
impl !RefUnwindSafe for JobExecutor
impl Send for JobExecutor
impl Sync for JobExecutor
impl Unpin for JobExecutor
impl !UnwindSafe for JobExecutor
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)