diff --git a/.github/img/unimplemented.svg b/.github/img/unimplemented.svg new file mode 100644 index 0000000..bc6d1a9 --- /dev/null +++ b/.github/img/unimplemented.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/sched/README.md b/lib/sched/README.md index 2a04e73..893091b 100644 --- a/lib/sched/README.md +++ b/lib/sched/README.md @@ -25,31 +25,48 @@ cargo add lool --registry=lugit --features sched {sub-feature} # Sub-Features +## Runtimes -### has subfeatures  sched.tokio +At least one of the following features must be enabled to use this library. -Enables the `tokio` runtime support, replacing the default behaviour, which implies a `std::thread` -pool to run the tasks. +- has subfeatures   + **sched.tokio**: Enables the `tokio` runtime support. -> [!WARNING] -> -> Not yet implemented +- has subfeatures   + **sched.threads**: Enables the `std::thread` runtime support. -### has subfeatures  sched.rule-recurrent +- has subfeatures   + **sched.thread-pool**: Enables the `std::thread` runtime support with a thread + pool unimplemented -Enables the "**recurrent-rule**" style for scheduling tasks. +## Scheduling Rules -### has subfeatures  sched.rule-cron +The default way to schedule tasks is to use a `DateTime` object. However, that means that the task +will only run once. To schedule tasks to run at specific intervals, you can use the following +features: + +- has subfeatures   + **sched.rule-recurrent**: Enables the "**recurrent-rule**" style for scheduling tasks. + +- has subfeatures   + **sched.rule-cron**: Enables the "cron-like" style for scheduling tasks -> [!WARNING] -> -> Not yet implemented ## Planned Features -- `sched.rule-cron`: Enables the "cron-like" style for scheduling tasks -- `sched.rule-pyschedule`: Enables the [python schedule](https://pypi.org/project/schedule/)-like +- **sched.rule-pyschedule**: Enables the [python schedule](https://pypi.org/project/schedule/)-like style for scheduling tasks +- **sched.thread-pool**: Enables the `std::thread` runtime support with a thread pool (like + [scheduled-thread-pool](https://crates.io/crates/scheduled-thread-pool) crate but using `lool`'s + thread pool implementation) + + +# Usage + +Check the [examples](../../examples) directory for usage examples: + +- [tokio](../../examples/sched_tokio.rs): using the `tokio` runtime +- [threads](../../examples/sched.rs): using the `std::thread` runtime # Inspiration @@ -65,15 +82,3 @@ This library is inspired by several other libraries, including: - [python's schedule](https://pypi.org/project/schedule/): a simple python scheduler with a human-friendly API - -Other useful libraries that might come in handy for this project during development are: - -- https://crates.io/crates/tokio-cron-scheduler -- https://crates.io/crates/clokwerk -- https://crates.io/crates/cron_tab -- https://crates.io/crates/multithreading -- https://crates.io/crates/multithreading -- https://crates.io/crates/threadpool -- https://crates.io/crates/blocking -- https://crates.io/crates/scheduled-thread-pool -- https://crates.io/crates/clokwerk