{"id":22325110,"url":"https://github.com/rogercoll/lullable","last_synced_at":"2025-03-26T05:44:05.111Z","repository":{"id":214044670,"uuid":"735557216","full_name":"rogercoll/lullable","owner":"rogercoll","description":"Futures wrapper that allows to abort or pause them","archived":false,"fork":false,"pushed_at":"2023-12-25T11:01:04.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-20T14:52:49.431Z","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/rogercoll.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-25T10:50:14.000Z","updated_at":"2024-01-03T07:13:01.000Z","dependencies_parsed_at":"2023-12-25T12:28:51.978Z","dependency_job_id":"14d7c41c-61a3-4dbc-9c43-91812742bc5d","html_url":"https://github.com/rogercoll/lullable","commit_stats":null,"previous_names":["rogercoll/lullable"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogercoll%2Flullable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogercoll%2Flullable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogercoll%2Flullable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogercoll%2Flullable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rogercoll","download_url":"https://codeload.github.com/rogercoll/lullable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245598310,"owners_count":20641884,"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":"2024-12-04T02:10:16.919Z","updated_at":"2025-03-26T05:44:05.091Z","avatar_url":"https://github.com/rogercoll.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lullable (Experimental)\n\n**Lull that task!**\n\n```rust\nuse std::{\n    thread::{sleep, spawn},\n    time::Duration,\n};\n\nuse futures::executor::block_on;\nuse tokio::task::yield_now;\n\nfn main() {\n    let (cancel, handle) = lullable::lullable(async {\n        let mut i = 0;\n        loop {\n            eprintln!(\"Iteration number: {}\", i);\n            i += 1;\n            yield_now().await;\n            sleep(Duration::from_secs(1))\n        }\n    });\n\n    spawn(move || block_on(cancel));\n\n    std::thread::sleep(Duration::from_secs(3));\n    let pause = handle.pause();\n    eprintln!(\"Task paused\");\n\n    std::thread::sleep(Duration::from_secs(3));\n    drop(pause);\n\n    eprintln!(\"Task unpaused\");\n    std::thread::sleep(Duration::from_secs(3));\n    handle.abort();\n    eprintln!(\"Task cancelled\")\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogercoll%2Flullable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frogercoll%2Flullable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogercoll%2Flullable/lists"}