{"id":13806133,"url":"https://github.com/stav121/tasklet","last_synced_at":"2025-05-13T21:32:27.683Z","repository":{"id":110877102,"uuid":"323646525","full_name":"stav121/tasklet","owner":"stav121","description":"⏱️ An asynchronous task scheduling library written in Rust","archived":false,"fork":false,"pushed_at":"2024-05-17T12:54:34.000Z","size":58,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-05-18T13:18:20.000Z","etag":null,"topics":["asychronous","crates","open-source","rust","scheduler","tasklet","tokio"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/tasklet","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stav121.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["stav121"]}},"created_at":"2020-12-22T14:19:12.000Z","updated_at":"2024-08-04T01:05:54.485Z","dependencies_parsed_at":"2024-01-16T12:25:44.347Z","dependency_job_id":"5e2e2d7f-fc48-4360-9c19-5fd8e69db0f6","html_url":"https://github.com/stav121/tasklet","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stav121%2Ftasklet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stav121%2Ftasklet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stav121%2Ftasklet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stav121%2Ftasklet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stav121","download_url":"https://codeload.github.com/stav121/tasklet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225260375,"owners_count":17446086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asychronous","crates","open-source","rust","scheduler","tasklet","tokio"],"created_at":"2024-08-04T01:01:08.115Z","updated_at":"2025-05-13T21:32:27.666Z","avatar_url":"https://github.com/stav121.png","language":"Rust","readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"tasklet-logo.png\"\u003e\n\u003c/p\u003e\n\n[![CircleCI](https://img.shields.io/circleci/build/github/stav121/tasklet?style=for-the-badge\u0026logo=circleci)](https://circleci.com/gh/stav121/tasklet)\n![Crates.io](https://img.shields.io/crates/d/tasklet?style=for-the-badge\u0026color=blue\u0026logo=owncloud)\n![Crates.io](https://img.shields.io/crates/v/tasklet?style=for-the-badge\u0026color=orange\u0026logo=rust)\n![GitHub last commit](https://img.shields.io/github/last-commit/stav121/tasklet?style=for-the-badge\u0026color=purple\u0026logo=git\u0026logoColor=white)\n[![Codecov](https://img.shields.io/codecov/c/github/stav121/tasklet?style=for-the-badge\u0026logo=codecov\u0026logoColor=white)](https://codecov.io/gh/stav121/tasklet)\n![License](https://img.shields.io/github/license/stav121/tasklet?style=for-the-badge\u0026color=lightgrey\u0026logo=amazoniam\u0026logoColor=white)\n[![GitHub issues](https://img.shields.io/github/issues/stav121/tasklet?style=for-the-badge\u0026color=yellow\u0026logo=github)](https://github.com/stav121/tasklet/issues)\n\n⏱️ An asynchronous task scheduling library written in Rust\n\n## About\n\n`tasklet` is a task scheduling library written in Rust. It is built over `tokio` runtime and utilizes green threads\nin order to run tasks asynchronously.\n\n## Dependencies\n\n| library | version |\n|---------|---------|\n| cron    | 0.15.0  |\n| chrono  | 0.4.40  |\n| time    | 0.3.41  |\n| log     | 0.4.27  |\n| tokio   | 1.44.1  |\n| futures | 0.3.31  |\n\n## How to use this library\n\nIn your `Cargo.toml` add:\n\n```\n[dependencies]\ntasklet = \"0.2.8\"\n```\n\n## Example\n\nFind more examples in the [examples](/examples) folder.\n\n```rust\nuse log::info;\nuse simple_logger::SimpleLogger;\nuse tasklet::task::TaskStepStatusErr::Error;\nuse tasklet::task::TaskStepStatusOk::Success;\nuse tasklet::{TaskBuilder, TaskScheduler};\n\n/// A simple example of a task with two steps,\n/// that might work or fail sometimes.\n#[tokio::main]\nasync fn main() {\n    // Init the logger.\n    SimpleLogger::new().init().unwrap();\n\n    // A variable to be passed in the task.\n    let mut exec_count = 0;\n\n    // Task scheduler with 1000ms loop frequency.\n    let mut scheduler = TaskScheduler::default(chrono::Local);\n\n    // Create a task with 2 steps and add it to the scheduler.\n    // The second step fails every second execution.\n    // Append the task to the scheduler.\n    scheduler.add_task(\n        TaskBuilder::new(chrono::Local)\n            .every(\"1 * * * * * *\")\n            .description(\"A simple task\")\n            .add_step(\"Step 1\", || {\n                info!(\"Hello from step 1\");\n                Ok(Success) // Let the scheduler know this step was a success.\n            })\n            .add_step(\"Step 2\", move || {\n                if exec_count % 2 == 0 {\n                    exec_count += 1;\n                    Err(Error) // Indicate that this step was a fail.\n                } else {\n                    info!(\"Hello from step 2\");\n                    exec_count += 1;\n                    Ok(Success) // Indicate that this step was a success.\n                }\n            })\n            .build(),\n    );\n\n    // Execute the scheduler.\n    scheduler.run().await;\n}\n```\n\n## Author\n\nStavros Grigoriou ([stav121](github.com/stav121))\n","funding_links":["https://github.com/sponsors/stav121"],"categories":["Applications"],"sub_categories":["Task scheduling"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstav121%2Ftasklet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstav121%2Ftasklet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstav121%2Ftasklet/lists"}