{"id":13503046,"url":"https://github.com/whatisaphone/genawaiter","last_synced_at":"2025-05-15T14:07:59.402Z","repository":{"id":35809343,"uuid":"219345042","full_name":"whatisaphone/genawaiter","owner":"whatisaphone","description":"Stackless generators on stable Rust.","archived":false,"fork":false,"pushed_at":"2022-06-24T07:15:14.000Z","size":224,"stargazers_count":462,"open_issues_count":20,"forks_count":33,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-07T20:08:21.271Z","etag":null,"topics":["async","await","coroutine","generator","rust","yield"],"latest_commit_sha":null,"homepage":"https://docs.rs/genawaiter","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whatisaphone.png","metadata":{"files":{"readme":"README-crates-io.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-03T18:18:48.000Z","updated_at":"2025-05-05T22:34:01.000Z","dependencies_parsed_at":"2022-07-14T06:40:28.237Z","dependency_job_id":null,"html_url":"https://github.com/whatisaphone/genawaiter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatisaphone%2Fgenawaiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatisaphone%2Fgenawaiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatisaphone%2Fgenawaiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatisaphone%2Fgenawaiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whatisaphone","download_url":"https://codeload.github.com/whatisaphone/genawaiter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254355335,"owners_count":22057354,"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","await","coroutine","generator","rust","yield"],"created_at":"2024-07-31T22:02:34.816Z","updated_at":"2025-05-15T14:07:59.351Z","avatar_url":"https://github.com/whatisaphone.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# genawaiter\n\n[![crate-badge]][crate-link] [![docs-badge]][docs-link] [![ci-badge]][ci-link]\n\n[crate-badge]: https://img.shields.io/crates/v/genawaiter.svg\n[crate-link]: https://crates.io/crates/genawaiter\n[docs-badge]: https://docs.rs/genawaiter/badge.svg\n[docs-link]: https://docs.rs/genawaiter\n[ci-badge]: https://github.com/whatisaphone/genawaiter/workflows/CI/badge.svg\n[ci-link]: https://github.com/whatisaphone/genawaiter/actions\n\nThis crate implements stackless generators (aka coroutines) in stable Rust. Instead of using `yield`, which [won't be stabilized anytime soon][yield-unstable], you use `async`/`await`, which is stable today.\n\n[yield-unstable]: https://doc.rust-lang.org/nightly/unstable-book/language-features/generators.html\n\nFeatures:\n\n- supports resume arguments and completion values\n- supports async generators (e.g., `Stream`s)\n- allocation-free\n- no runtime dependencies\n  - no compile-time dependencies either, with `default-features = false`\n- built on top of standard language constructs, which means there are no platform-specific shenanigans\n\nExample:\n\n```rust\nlet odd_numbers_less_than_ten = gen!({\n    let mut n = 1;\n    while n \u003c 10 {\n        yield_!(n); // Suspend a function at any point with a value.\n        n += 2;\n    }\n});\n\n// Generators can be used as ordinary iterators.\nfor num in odd_numbers_less_than_ten {\n    println!(\"{}\", num);\n}\n```\n\nResult:\n\n```text\n1\n3\n5\n7\n9\n```\n\nAnd here is the same generator, this time without macros. This is how you do things with `default-features = false` (which eliminates the proc macro dependencies).\n\n```rust\nlet odd_numbers_less_than_ten = Gen::new(|co| async move {\n    let mut n = 1;\n    while n \u003c 10 {\n        co.yield_(n).await;\n        n += 2;\n    }\n});\n```\n\n[See the docs for more.](https://docs.rs/genawaiter)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhatisaphone%2Fgenawaiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhatisaphone%2Fgenawaiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhatisaphone%2Fgenawaiter/lists"}