[−][src]Struct clokwerk::Job
A job to run on the scheduler.
Create these by calling Scheduler::every()
.
Methods
impl<Tz> Job<Tz> where
Tz: TimeZone,
[src]
Tz: TimeZone,
pub fn at(&mut self, s: &str) -> &mut Self
[src]
Specify the time of day when a task should run, e.g.
let mut scheduler = Scheduler::new(); scheduler.every(1.day()).at("14:32").run(|| println!("Tea time!")); scheduler.every(Wednesday).at("6:32:21 PM").run(|| println!("Writing examples is hard"));
Times can be specified with or without seconds, and in either 24-hour or 12-hour time.
Mutually exclusive with Job::plus()
.
pub fn plus(&mut self, ival: Interval) -> &mut Self
[src]
Add additional precision time to when a task should run, e.g.
let mut scheduler = Scheduler::new(); scheduler.every(1.day()) .plus(6.hours()) .plus(13.minutes()) .run(|| println!("Time to wake up!"));
Mutually exclusive with Job::at()
.
pub fn and_every(&mut self, ival: Interval) -> &mut Self
[src]
Add an additional scheduling to the task. All schedules will be considered when determining when the task should next run.
pub fn run<F>(&mut self, f: F) -> &mut Self where
F: 'static + FnMut() + Sync + Send,
[src]
F: 'static + FnMut() + Sync + Send,
Specify a task to run, and schedule its next run
pub fn is_pending(&self) -> bool
[src]
Test whether a job is scheduled to run again. This is usually only called by Scheduler::run_pending().
pub fn execute(&mut self)
[src]
Run a task and re-schedule it. This is usually only called by Scheduler::run_pending().
Trait Implementations
Auto Trait Implementations
impl<Tz> Unpin for Job<Tz> where
Tz: Unpin,
<Tz as TimeZone>::Offset: Unpin,
Tz: Unpin,
<Tz as TimeZone>::Offset: Unpin,
impl<Tz> Sync for Job<Tz> where
Tz: Sync,
<Tz as TimeZone>::Offset: Sync,
Tz: Sync,
<Tz as TimeZone>::Offset: Sync,
impl<Tz> Send for Job<Tz> where
Tz: Send,
<Tz as TimeZone>::Offset: Send,
Tz: Send,
<Tz as TimeZone>::Offset: Send,
impl<Tz = Local> !UnwindSafe for Job<Tz>
impl<Tz = Local> !RefUnwindSafe for Job<Tz>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,