{"id":19325403,"url":"https://github.com/krypt0nn/wait_not_await","last_synced_at":"2025-04-22T20:31:32.210Z","repository":{"id":57671826,"uuid":"472487106","full_name":"krypt0nn/wait_not_await","owner":"krypt0nn","description":"Simple awaiter implementation in 🦀 Rust","archived":false,"fork":false,"pushed_at":"2023-01-27T20:39:09.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T06:41:40.034Z","etag":null,"topics":["async","rust"],"latest_commit_sha":null,"homepage":"","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/krypt0nn.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}},"created_at":"2022-03-21T19:42:04.000Z","updated_at":"2023-02-17T02:31:52.000Z","dependencies_parsed_at":"2023-02-15T12:25:34.669Z","dependency_job_id":null,"html_url":"https://github.com/krypt0nn/wait_not_await","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krypt0nn%2Fwait_not_await","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krypt0nn%2Fwait_not_await/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krypt0nn%2Fwait_not_await/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krypt0nn%2Fwait_not_await/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krypt0nn","download_url":"https://codeload.github.com/krypt0nn/wait_not_await/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250318719,"owners_count":21410983,"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":["async","rust"],"created_at":"2024-11-10T02:09:57.025Z","updated_at":"2025-04-22T20:31:31.964Z","avatar_url":"https://github.com/krypt0nn.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e🦀 wait_not_await\u003c/h1\u003e\n\nSimple awaiter implementation in Rust\n\n## Examples\n\n### Await as a variable\n\n```rs\nuse std::time::Duration;\nuse wait_not_await::Await;\n\nlet mut awaiter = Await::new(move || {\n    std::thread::sleep(Duration::from_secs(3));\n\n    \"Hello, Wolrd!\".to_string()\n});\n\nif let Some(result) = awaiter.wait(None) {\n    println!(\"Result: {}\", result);\n}\n```\n\n### Await with functions\n\n```rs\nuse std::time::Duration;\nuse wait_not_await::Await;\n\nfn async_hello_world() -\u003e Await\u003cString\u003e {\n    Await::new(move || {\n        std::thread::sleep(Duration::from_secs(2));\n\n        \"Hello, World!\".to_string()\n    })\n}\n\nprintln!(\"{}\", async_hello_world().wait(None).unwrap());\n```\n\n### Await result handling\n\n```rs\nuse std::time::Duration;\nuse wait_not_await::Await;\n\nlet awaiter = Await::new(move || {\n    std::thread::sleep(Duration::from_secs(3));\n\n    \"Hello, Wolrd!\".to_string()\n});\n\nawaiter.then(move |result| {\n    println!(\"Task result: {}\", result);\n});\n```\n\n### Await loop with result\n\n```rs\nuse std::time::Duration;\nuse wait_not_await::Await;\n\nfn async_hello_world() -\u003e Await\u003cString\u003e {\n    Await::new(move || {\n        std::thread::sleep(Duration::from_secs(2));\n\n        \"Hello, World!\".to_string()\n    })\n}\n\nlet mut awaiter = async_hello_world();\nlet mut i = 1;\n\nwhile let None = awaiter.result() {\n    println!(\"Waiting for result: {}\", i);\n\n    i += 1;\n}\n\nprintln!(\"{}\", awaiter.result().unwrap());\n```\n\nAuthor: [Nikita Podvirnyy](https://github.com/krypt0nn)\n\nLicensed under [MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrypt0nn%2Fwait_not_await","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrypt0nn%2Fwait_not_await","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrypt0nn%2Fwait_not_await/lists"}