[−][src]Struct clokwerk::Scheduler
Job scheduler
Methods
impl Scheduler
[src]
pub fn new() -> Self
[src]
Create a new scheduler. Dates and times will be interpretted using the local timezone
pub fn with_tz<Tz: TimeZone>(tz: Tz) -> Scheduler<Tz>
[src]
Create a new scheduler. Dates and times will be interpretted using the specified
impl<Tz> Scheduler<Tz> where
Tz: TimeZone + Sync + Send,
[src]
Tz: TimeZone + Sync + Send,
pub fn every(&mut self, ival: Interval) -> &mut Job<Tz>
[src]
Add a new job to the scheduler to be run on the given interval
let mut scheduler = Scheduler::new(); scheduler.every(10.minutes()).plus(30.seconds()).run(|| println!("Periodic task")); scheduler.every(1.day()).at("3:20 pm").run(|| println!("Daily task")); scheduler.every(Wednesday).at("14:20:17").run(|| println!("Weekly task")); scheduler.every(Weekday).run(|| println!("Every weekday at midnight"));
pub fn run_pending(&mut self)
[src]
Run all jobs that should run at this time.
use std::thread; use std::time::Duration; loop { scheduler.run_pending(); thread::sleep(Duration::from_millis(100)); }
impl<Tz> Scheduler<Tz> where
Tz: TimeZone + Sync + Send + 'static,
<Tz as TimeZone>::Offset: Send,
[src]
Tz: TimeZone + Sync + Send + 'static,
<Tz as TimeZone>::Offset: Send,
pub fn watch_thread(self, frequency: Duration) -> ScheduleHandle
[src]
Start a background thread to call Scheduler::run_pending() with the specified frequency. The resulting thread fill end cleanly if the returned ScheduleHandle is dropped.
Trait Implementations
Auto Trait Implementations
impl<Tz> Sync for Scheduler<Tz> where
Tz: Sync,
<Tz as TimeZone>::Offset: Sync,
Tz: Sync,
<Tz as TimeZone>::Offset: Sync,
impl<Tz> Unpin for Scheduler<Tz> where
Tz: Unpin,
<Tz as TimeZone>::Offset: Unpin,
Tz: Unpin,
<Tz as TimeZone>::Offset: Unpin,
impl<Tz> Send for Scheduler<Tz> where
Tz: Send,
<Tz as TimeZone>::Offset: Send,
Tz: Send,
<Tz as TimeZone>::Offset: Send,
impl<Tz = Local> !UnwindSafe for Scheduler<Tz>
impl<Tz = Local> !RefUnwindSafe for Scheduler<Tz>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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,