[][src]Struct cron_tab::Cron

pub struct Cron<Z> where
    Z: Send + Sync + 'static,
    Z: TimeZone,
    <Z as TimeZone>::Offset: Send
{ /* fields omitted */ }

Implementations

impl<Z> Cron<Z> where
    Z: Send + Sync + 'static,
    Z: TimeZone,
    <Z as TimeZone>::Offset: Send
[src]

Cron contains and executes the scheduled jobs.

pub fn new(tz: Z) -> Cron<Z>[src]

Create a new cron.

This example is not tested
let mut cron = cron::Cron::new(Utc);
cron.add_fn("* * * * * *", || {
println!("anonymous fn");
}).unwrap();
cron.start();    

pub fn add_fn<T>(&mut self, spec: &str, f: T) -> Result<i32, CronError> where
    T: 'static,
    T: FnMut() + Send + Sync
[src]

Add a function to Cron.

This example is not tested
let mut cron = cron::Cron::new(Utc);
cron.add_fn("* * * * * *", || {
println!("anonymous fn");
}).unwrap();
cron.start();    

pub fn set_timezone(&mut self, tz: Z)[src]

Set timezone offset.

This example is not tested
let mut cron = cron::Cron::new(Utc);
cron.start();    

pub fn remove(&self, id: i32)[src]

Remove a job from Cron.

This example is not tested
let mut cron = cron::Cron::new();
let job_id = cron.add_fn("* * * * * *", || {
println!("anonymous fn");
}).unwrap();
cron.start();  
cron.remove(job_id);  

pub fn stop(&self)[src]

Stop Cron.

This example is not tested
let mut cron = cron::Cron::new();
let job_id = cron.add_fn("* * * * * *", || {
println!("anonymous fn");
}).unwrap();
cron.start();  
cron.stop();  

pub fn start(&mut self)[src]

Start cron. A thead will be spawn for schedule jobs

This example is not tested
let mut cron = cron::Cron::new(Utc);
let job_id = cron.add_fn("* * * * * *", || {
println!("anonymous fn");
}).unwrap();
cron.start();

Trait Implementations

impl<Z: Clone> Clone for Cron<Z> where
    Z: Send + Sync + 'static,
    Z: TimeZone,
    <Z as TimeZone>::Offset: Send
[src]

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

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

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

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

impl<T> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.