pub struct JobScheduler<'a> { /* private fields */ }
Expand description

The JobScheduler contains and executes the scheduled jobs.

Implementations

Create a new JobScheduler.

Add a job to the JobScheduler

let mut sched = JobScheduler::new();
sched.add(Job::new("1/10 * * * * *".parse().unwrap(), || {
    println!("I get executed every 10 seconds!");
}));

The tick method increments time for the JobScheduler and executes any pending jobs. It is recommended to sleep for at least 500 milliseconds between invocations of this method.

loop {
    sched.tick();
    std::thread::sleep(Duration::from_millis(500));
}

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.