Crates.io | funscheduler |
lib.rs | funscheduler |
version | 0.1.0 |
source | src |
created_at | 2021-10-29 09:38:44.75741 |
updated_at | 2021-10-29 09:38:44.75741 |
description | Time based function execution scheduler |
homepage | https://github.com/cy6erlion/funscheduler |
repository | https://github.com/cy6erlion/funscheduler |
max_upload_size | |
id | 473876 |
size | 5,196 |
┌─┐┬ ┬┌┐┌┌─┐┌─┐┬ ┬┌─┐┌┬┐┬ ┬┬ ┌─┐┬─┐
├┤ │ ││││└─┐│ ├─┤├┤ │││ ││ ├┤ ├┬┘
└ └─┘┘└┘└─┘└─┘┴ ┴└─┘─┴┘└─┘┴─┘└─┘┴└─
Time based function execution scheduler
use funscheduler::{FunScheduler, Timing};
fn main() {
// Execute job every five seconds
FunScheduler::interval(job, Timing::Seconds(5));
}
fn job() {
println!("Hello, world");
}
Timing::Seconds(1)
Timing::Minutes(25)
Timing::Hours(2)
Timing::Days(1)
// Evaluates a function at specified intervals, starting now
FunScheduler::interval(job, Timing::Seconds(1))
// Evaluates a function at specified intervals, does not execute
// the function immedialy
FunScheduler::rinterval(job, Timing::Seconds(1))
// Execute function once after a specified amount of time
FunScheduler::after(job, Timing::Seconds(1))
⧉