uhrwerk 0.1.0

Simple scheduler for recurring tasks
Documentation
//! Uhrwerk is a simple scheduler,
//! forked from [clokwerk](https://crates.io/crates/clokwerk), which itself is inspired
//! by Python's [Schedule](https://schedule.readthedocs.io/en/stable/)
//! and Ruby's [clockwork](https://github.com/Rykian/clockwork).
//! It uses a similar DSL for scheduling, rather than parsing cron strings.
//!
//! Uhrwerk supports both synchronous and asynchronous tasks.
//!
//! # Usage
//!
//! ```rust
//! // Import week days and WeekDay
//! use uhrwerk::Interval::*;
//! // Scheduler and trait for .seconds(), .minutes(), etc.
//! use uhrwerk::{Job as _, Scheduler, TimeUnits as _};
//! # use std::thread;
//! # use std::time::Duration;
//! # use time::UtcOffset;
//!
//! // Create a new scheduler
//! let mut scheduler = Scheduler::new();
//! // or a scheduler with a given timezone
//! let mut scheduler = Scheduler::new_with_utc_offset(UtcOffset::UTC);
//! // Add some tasks to it
//! 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(Tuesday)
//! 	.at("14:20:17")
//! 	.and_every(Thursday)
//! 	.at("15:00")
//! 	.run(|| println!("Biweekly task"));
//!
//! // Manually run the scheduler in an event loop
//! for _ in 1 .. 10 {
//! 	scheduler.run_pending();
//! 	thread::sleep(Duration::from_millis(10));
//! }
//! // Or run it in a background thread
//! let thread_handle = scheduler.watch_thread(Duration::from_millis(100));
//! // The scheduler stops when `thread_handle` is dropped, or `stop` is called
//! thread_handle.stop();
//! ```
//!
//! By default, dates and times are relative to the local timezone, but the scheduler
//! can be made to use a different timezone using [`Scheduler::new_with_utc_offset`].
//!
//! For more details, see [`Scheduler`] or its async counterpart, [`AsyncScheduler`].
//!
//! # Caveats
//!
//! Some combinations of times or intervals are permissible, but make little sense, e.g.
//! `every(10.seconds()).at("16:00")`, which would next run at the next 4 PM after the
//! next multiple of 10 seconds.
//!
//! # Trivia
//!
//! _Uhrwerk_ is the German word for _clockwork_.

#[cfg(feature = "async")]
mod async_job;
#[cfg(feature = "async")]
mod async_scheduler;
mod intervals;
mod job;
mod job_schedule;
mod scheduler;
mod sync_job;
pub mod timeprovider;

#[cfg(feature = "async")]
pub use crate::async_job::AsyncJob;
#[cfg(feature = "async")]
pub use crate::async_scheduler::AsyncScheduler;
pub use crate::{
	intervals::{Interval, NextTime, TimeUnits},
	job::Job,
	scheduler::{ScheduleHandle, Scheduler},
	sync_job::SyncJob
};