cronic

Crates.iocronic
lib.rscronic
version0.1.0
sourcesrc
created_at2021-02-05 07:41:31.010686
updated_at2021-02-05 07:41:31.010686
descriptionA cron-enabled task scheduler for `async` Rust.
homepage
repositoryhttps://github.com/ajmwagar/cronic
max_upload_size
id350933
size17,383
Avery Wagar (ajmwagar)

documentation

README

cronic

A cron-enabled task scheduler for async Rust

[dependencies]
cronic = "0.1"
tokio = { version = "1", features = ["full"] }
use cronic::Scheduler;
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    Scheduler::new()
        .set_context(())
        .job("@hourly", &|_| {
            Box::pin(async {
                println!("Every hour!");
            })
        })
        .job("* * * * * *", &|_| {
            Box::pin(async {
                println!("Every second!");
            })
        })
        .job("0 * * * * *", &|_| {
            Box::pin(async {
                println!("Every minute!");
            })
        })
        .start()
        .await?;

    Ok(())
}
Commit count: 5

cargo fmt