{"id":15582907,"url":"https://github.com/deciduously/skedge","last_synced_at":"2025-03-22T12:13:04.166Z","repository":{"id":47134262,"uuid":"399464935","full_name":"deciduously/skedge","owner":"deciduously","description":"Single-process scheduling: every(10).minutes()?.at(\":17\")?.run(...","archived":false,"fork":false,"pushed_at":"2024-09-20T13:55:54.000Z","size":102,"stargazers_count":59,"open_issues_count":10,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T14:08:53.655Z","etag":null,"topics":["rust","rust-library","scheduler","utility"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/skedge","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/deciduously.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"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}},"created_at":"2021-08-24T12:55:49.000Z","updated_at":"2025-02-11T21:57:37.000Z","dependencies_parsed_at":"2024-09-12T12:19:18.860Z","dependency_job_id":"3db1ec22-6845-4811-b7bf-1d19176619fc","html_url":"https://github.com/deciduously/skedge","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"9e02f66f7ba2169f78d2e1ed33814611d24679c0"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deciduously%2Fskedge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deciduously%2Fskedge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deciduously%2Fskedge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deciduously%2Fskedge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deciduously","download_url":"https://codeload.github.com/deciduously/skedge/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244952806,"owners_count":20537474,"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":["rust","rust-library","scheduler","utility"],"created_at":"2024-10-02T20:02:22.388Z","updated_at":"2025-03-22T12:13:04.145Z","avatar_url":"https://github.com/deciduously.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# skedge\n\n[![Crates.io](https://img.shields.io/crates/v/skedge.svg)](https://crates.io/crates/skedge)\n[![rust action](https://github.com/deciduously/skedge/actions/workflows/rust.yml/badge.svg)](https://github.com/deciduously/skedge/actions/workflows/rust.yml)\n[![docs.rs](https://img.shields.io/docsrs/skedge)](https://docs.rs/skedge)\n\nRust single-process scheduling. Ported from [`schedule`](https://github.com/dbader/schedule) for Python, in turn inspired by [`clockwork`](https://github.com/Rykian/clockwork) (Ruby), and [\"Rethinking Cron\"](https://adam.herokuapp.com/past/2010/4/13/rethinking_cron/) by [Adam Wiggins](https://github.com/adamwiggins).\n\n## Usage\n\nDocumentation can be found on [docs.rs](https://docs.rs/skedge).\n\nThis library uses the Builder pattern to define jobs. Instantiate a fresh `Scheduler`, then use the `every()` and `every_single()` functions to begin defining a job. Finalize configuration by calling `Job::run()` to add the new job to the scheduler. The `Scheduler::run_pending()` method is used to fire any jobs that have arrived at their next scheduled run time. Currently, precision can only be specified to the second, no smaller.\n\n```rust\nuse skedge::{every, Scheduler};\nuse std::{\n\tthread,\n\ttime::{Duration, SystemTime},\n};\n\nfn seconds_from_epoch() -\u003e u64 {\n\tSystemTime::now()\n\t\t.duration_since(SystemTime::UNIX_EPOCH)\n\t\t.unwrap()\n\t\t.as_secs()\n}\n\nfn greet(name: \u0026str) {\n\tlet timestamp = seconds_from_epoch();\n\tprintln!(\"Hello {name}, it's been {timestamp} seconds since the Unix epoch!\");\n}\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n\tlet mut schedule = Scheduler::new();\n\n\tevery(10)\n\t\t.minutes()?\n\t\t.at(\":17\")?\n\t\t.until(\n\t\t\tSystemTime::now()\n\t\t\t\t.checked_add(Duration::from_secs(2 * 60 * 60))\n\t\t\t\t.unwrap()\n\t\t\t\t.try_into()?,\n\t\t)?\n\t\t.run_one_arg(\u0026mut schedule, greet, \"Cool Person\")?;\n\n\tlet now = seconds_from_epoch();\n\tprintln!(\"Starting at {now}\");\n\tloop {\n\t\tif let Err(e) = schedule.run_pending() {\n\t\t\teprintln!(\"Error: {e}\");\n\t\t}\n\t\tthread::sleep(Duration::from_secs(1));\n\t}\n}\n```\n\nCheck out the [example script](https://github.com/deciduously/skedge/blob/main/examples/basic.rs) to see more configuration options. Try `cargo run --example readme` or `cargo run --example basic` to see it in action.\n\n### CFFI\n\nThere is an **experimental** C foreign function interface, which is feature-gated and not included by default. To build the library with this feature, use `cargo build --features ffi`. See the [Makefile](https://github.com/deciduously/skedge/blob/main/Makefile) and [examples/ffi/c](https://github.com/deciduously/skedge/tree/main/examples/ffi/c) directory for details on using this library from C. Execute `make run` to build and execute the included example C program. It currently **only** supports work functions which take no arguments.\n\n## Development\n\nClone this repo. See [`CONTRIBUTING.md`](https://github.com/deciduously/skedge/blob/main/CONTRIBUTING.md) for contribution guidelines.\n\n### Dependencies\n\n- **Stable [Rust](https://www.rust-lang.org/tools/install)**. Obtainable via `rustup` using the instructions at this link.\n\n### Crates\n\n- [jiff](https://github.com/BurntSushi/jiff) - Date and time handling\n- [libc](https://github.com/rust-lang/libc) - libc bindings for CFFI (optional)\n- [rand](https://rust-random.github.io/book/) - Random number generation (optional)\n- [regex](https://github.com/rust-lang/regex) - Regular expressions\n- [thiserror](https://github.com/dtolnay/thiserror) - Error derive macro\n- [tracing](https://github.com/tokio-rs/tracing) - what it says on the tin\n\n#### Development-Only\n\n- [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions) - Colorful assertion output\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeciduously%2Fskedge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeciduously%2Fskedge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeciduously%2Fskedge/lists"}