funscheduler

Time based function execution scheduler
git clone https://gitlab.com/kwatafana/etango/funscheduler.git
Log | Files | Refs | README | LICENSE

README.md (1186B)


      1 ![crates.io](https://img.shields.io/crates/v/funscheduler "crates.io")
      2 
      3 ``` text
      4 ┌─┐┬ ┬┌┐┌┌─┐┌─┐┬ ┬┌─┐┌┬┐┬ ┬┬  ┌─┐┬─┐
      5 ├┤ │ ││││└─┐│  ├─┤├┤  │││ ││  ├┤ ├┬┘
      6 └  └─┘┘└┘└─┘└─┘┴ ┴└─┘─┴┘└─┘┴─┘└─┘┴└─
      7 ```
      8 
      9 Time based function execution scheduler
     10 
     11 ``` rust
     12 use funscheduler::{FunScheduler, Timing};
     13 
     14 fn main() {
     15     // Execute job every five seconds
     16     FunScheduler::interval(job, Timing::Seconds(5));
     17 }
     18 
     19 fn job() {
     20     println!("Hello, world");
     21 }
     22 ```
     23 
     24 ## Time configurations with the Timing Enum
     25 
     26 ``` rust
     27 Timing::Seconds(1)
     28 Timing::Minutes(25)
     29 Timing::Hours(2)
     30 Timing::Days(1)
     31 ```
     32 
     33 ## Job runners, different methods to execute the function
     34 
     35 ``` rust
     36 // Evaluates a function at specified intervals, starting now
     37 FunScheduler::interval(job, Timing::Seconds(1))
     38 
     39 // Evaluates a function at specified intervals, does not execute
     40 // the function immedialy
     41 FunScheduler::rinterval(job, Timing::Seconds(1))
     42 
     43 // Execute function once after a specified amount of time
     44 FunScheduler::after(job, Timing::Seconds(1))
     45 ```
     46 
     47