pub struct Cron<Z> where
Z: Send + Sync + 'static,
Z: TimeZone,
<Z as TimeZone>::Offset: Send, { /* private fields */ }Implementations
sourceimpl<Z> Cron<Z> where
Z: Send + Sync + 'static,
Z: TimeZone,
<Z as TimeZone>::Offset: Send,
impl<Z> Cron<Z> where
Z: Send + Sync + 'static,
Z: TimeZone,
<Z as TimeZone>::Offset: Send,
Cron contains and executes the scheduled jobs.
sourcepub fn new(tz: Z) -> Cron<Z>
pub fn new(tz: Z) -> Cron<Z>
Create a new cron.
ⓘ
let mut cron = cron::Cron::new(Utc);
cron.add_fn("* * * * * *", || {
println!("anonymous fn");
}).unwrap();
cron.start(); sourcepub fn add_fn<T>(&mut self, spec: &str, f: T) -> Result<i32, CronError> where
T: 'static,
T: FnMut() + Send + Sync,
pub fn add_fn<T>(&mut self, spec: &str, f: T) -> Result<i32, CronError> where
T: 'static,
T: FnMut() + Send + Sync,
Add a function to Cron.
ⓘ
let mut cron = cron::Cron::new(Utc);
cron.add_fn("* * * * * *", || {
println!("anonymous fn");
}).unwrap();
cron.start(); sourcepub fn set_timezone(&mut self, tz: Z)
pub fn set_timezone(&mut self, tz: Z)
Set timezone offset.
ⓘ
let mut cron = cron::Cron::new(Utc);
cron.start(); sourcepub fn remove(&self, id: i32)
pub fn remove(&self, id: i32)
Remove a job from Cron.
ⓘ
let mut cron = cron::Cron::new();
let job_id = cron.add_fn("* * * * * *", || {
println!("anonymous fn");
}).unwrap();
cron.start();
cron.remove(job_id); Trait Implementations
Auto Trait Implementations
impl<Z> RefUnwindSafe for Cron<Z> where
Z: RefUnwindSafe,
impl<Z> Send for Cron<Z>
impl<Z> Sync for Cron<Z>
impl<Z> Unpin for Cron<Z> where
Z: Unpin,
<Z as TimeZone>::Offset: Unpin,
impl<Z> UnwindSafe for Cron<Z> where
Z: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more