Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
klaatu01 committed Aug 31, 2024
1 parent bb46d1b commit 0b77ca3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 71 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 0 additions & 70 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,76 +14,6 @@
//! cargo add skedgy
//! ```
//!
//! ## Usage
//!
//! ### 1. Define Your Task Handler
//!
//! Implement the `SkedgyHandler` trait for your task. This trait requires the `handle` method, which is an asynchronous function that defines the task's behavior.
//!
//! ```rust
//! use skedgy::SkedgyHandler;
//!
//! #[derive(Clone)]
//! struct MyTask;
//!
//! impl SkedgyHandler for MyTask {
//! async fn handle(&self) {
//! println!("Task is running!");
//! }
//! }
//! ```
//!
//! ### 2. Create a Scheduler
//!
//! Initialize a scheduler with a tick interval:
//!
//! ```rust
//! use skedgy::{Skedgy, SkedgyConfig};
//! use std::time::Duration;
//!
//! let config = SkedgyConfig {
//! tick_interval: Duration::from_millis(100),
//! };
//! let mut scheduler = Skedgy::new(config).expect("Failed to create scheduler");
//! ```
//!
//! ### 3. Schedule Tasks
//!
//! You can schedule tasks to run at specific times, after a delay, or using cron expressions.
//!
//! ```rust
//! use chrono::Utc;
//!
//! // Schedule a task to run at a specific time
//! scheduler.run_at(Utc::now() + chrono::Duration::seconds(10), MyTask).await.expect("Failed to schedule task");
//!
//! // Schedule a task to run after a delay
//! scheduler.run_in(Duration::from_secs(5), MyTask).await.expect("Failed to schedule task");
//!
//! // Schedule a task using a cron expression
//! scheduler.cron("0/1 * * * * * *", MyTask).await.expect("Failed to schedule cron task");
//! ```
//!
//! ### 4. Run the Scheduler
//!
//! The scheduler is automatically run when it is created and will continue to process tasks until the program ends.
//!
//! ## Running Tests
//!
//! To run the tests, use the following command:
//!
//! ```sh
//! cargo test
//! ```
//!
//! Make sure to include the necessary dependencies in your `Cargo.toml`:
//!
//! ```toml
//! [dev-dependencies]
//! tokio = { version = "1", features = ["full", "macros"] }
//! async-trait = "0.1"
//! ```
//!
//! The test suite includes tests for scheduling tasks at specific times, after delays, and with cron expressions. It also checks error handling for invalid cron expressions.
//!
//! ## Contributing
Expand Down

0 comments on commit 0b77ca3

Please sign in to comment.