[][src]Struct clokwerk::Job

pub struct Job<Tz = Local> where
    Tz: TimeZone
{ /* fields omitted */ }

A job to run on the scheduler. Create these by calling Scheduler::every().

Methods

impl<Tz> Job<Tz> where
    Tz: TimeZone
[src]

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]

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

impl<Tz> Debug for Job<Tz> where
    Tz: TimeZone
[src]

Auto Trait Implementations

impl<Tz> Unpin for Job<Tz> where
    Tz: Unpin,
    <Tz as TimeZone>::Offset: Unpin

impl<Tz> Sync for Job<Tz> where
    Tz: Sync,
    <Tz as TimeZone>::Offset: Sync

impl<Tz> Send for Job<Tz> where
    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]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]