{"id":26904432,"url":"https://github.com/splurf/sync_select","last_synced_at":"2025-04-01T10:53:40.532Z","repository":{"id":285137575,"uuid":"885535937","full_name":"splurf/sync_select","owner":"splurf","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-29T18:33:18.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T19:29:09.341Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/splurf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2024-11-08T19:24:55.000Z","updated_at":"2025-03-29T18:33:22.000Z","dependencies_parsed_at":"2025-03-29T19:39:23.670Z","dependency_job_id":null,"html_url":"https://github.com/splurf/sync_select","commit_stats":null,"previous_names":["splurf/sync_select"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splurf%2Fsync_select","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splurf%2Fsync_select/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splurf%2Fsync_select/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splurf%2Fsync_select/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/splurf","download_url":"https://codeload.github.com/splurf/sync_select/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246628336,"owners_count":20808106,"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":[],"created_at":"2025-04-01T10:53:40.136Z","updated_at":"2025-04-01T10:53:40.526Z","avatar_url":"https://github.com/splurf.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sync_select\n\nA short-circuiting (verbose) `std::thread::scope`.\n\n## Example\n\n```rust\nuse std::{thread::sleep, time::Duration};\n\nuse sync_select::*;\n\nfn main() {\n    let s = SyncSelect::new();\n\n    // Task A (3rd to finish)\n    s.spawn(|| sleep(Duration::from_secs(3)));\n\n    // Task B (1st to finish =\u003e Subtask 1)\n    s.spawn_with(|s| {\n        // Task C (subtask of B) (1st to finish)\n        s.spawn(|| sleep(Duration::from_secs(1)));\n\n        // Task D (subtask of B) (2nd to finish)\n        s.spawn(|| sleep(Duration::from_secs(2)));\n    });\n\n    // In this specific scenario, Task B is first to die,\n    // because it short-circuits due to one of it's subtasks\n    // finishing. This causes the root to short-circuit,\n    // resulting in the program exiting.\n\n    // Note: scopes automatically short-circuit when dropped.\n}\n```\n\n## Notes\n- There is no \"borrow non-'static data\" functionality.\n\n## Todo\n- Better ergonomics\n    - `scope(...)` function or something.\n    - Maybe build a macro `select!` similar to tokio's [select!](https://docs.rs/tokio/1.41.1/tokio/macro.select.html) macro.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplurf%2Fsync_select","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsplurf%2Fsync_select","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplurf%2Fsync_select/lists"}