[−][src]Crate crony
Crony: simple cron runner
Example
extern crate crony; use crony::{Job, Runner, Schedule}; use std::str::FromStr; struct ExampleJob; impl Job for ExampleJob { fn schedule(&self) -> Schedule { // Runs every minute Schedule::from_str("0 * * * * *").unwrap() } fn handle(&self) { println!("Hello, I am cron job running at: {}", self.now()); } } fn main() { println!("Hello world"); Runner::new().add(Box::new(ExampleJob)).run(); } /* Hello world Hello, I am cron job running at: 2020-12-10 16:01:59.740944 UTC Hello, I am cron job running at: 2020-12-10 16:02:59.821043 UTC */
Structs
Runner | Runner that will hold all the jobs and will start up the execution and eventually will stop it. |
Schedule |
Traits
Job |