{"id":29210626,"url":"https://github.com/embarkstudios/poll-promise","last_synced_at":"2025-07-02T21:07:20.009Z","repository":{"id":44588629,"uuid":"446360879","full_name":"EmbarkStudios/poll-promise","owner":"EmbarkStudios","description":"A Rust promise for games and immediate mode GUIs","archived":false,"fork":false,"pushed_at":"2023-09-29T19:59:02.000Z","size":64,"stargazers_count":137,"open_issues_count":5,"forks_count":13,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-29T11:11:23.550Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EmbarkStudios.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-10T09:37:26.000Z","updated_at":"2025-06-08T13:38:08.000Z","dependencies_parsed_at":"2024-06-21T02:12:18.941Z","dependency_job_id":"25daf367-bf50-4ba7-93f0-1e86a6ec9968","html_url":"https://github.com/EmbarkStudios/poll-promise","commit_stats":{"total_commits":25,"total_committers":6,"mean_commits":4.166666666666667,"dds":"0.19999999999999996","last_synced_commit":"b493586107b0e508860aa2e9d18049fd8cd9d13f"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":"EmbarkStudios/opensource-template","purl":"pkg:github/EmbarkStudios/poll-promise","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Fpoll-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Fpoll-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Fpoll-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Fpoll-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EmbarkStudios","download_url":"https://codeload.github.com/EmbarkStudios/poll-promise/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Fpoll-promise/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263215299,"owners_count":23431895,"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-07-02T21:07:19.232Z","updated_at":"2025-07-02T21:07:20.000Z","avatar_url":"https://github.com/EmbarkStudios.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- Allow this file to not have a first line heading --\u003e\n\u003c!-- markdownlint-disable-file MD041 --\u003e\n\n\u003c!-- inline html --\u003e\n\u003c!-- markdownlint-disable-file MD033 --\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n# ⌛ `poll-promise`\n\n**A Rust promise for games and immediate mode GUIs**\n\n[![Embark](https://img.shields.io/badge/embark-open%20source-blueviolet.svg)](https://embark.dev)\n[![Embark](https://img.shields.io/badge/discord-ark-%237289da.svg?logo=discord)](https://discord.gg/dAuKfZS)\n[![Crates.io](https://img.shields.io/crates/v/poll-promise.svg)](https://crates.io/crates/poll-promise)\n[![Docs](https://docs.rs/poll-promise/badge.svg)](https://docs.rs/poll-promise)\n[![dependency status](https://deps.rs/repo/github/EmbarkStudios/poll-promise/status.svg)](https://deps.rs/repo/github/EmbarkStudios/poll-promise)\n[![Build status](https://github.com/EmbarkStudios/physx-rs/workflows/CI/badge.svg)](https://github.com/EmbarkStudios/physx-rs/actions)\n\u003c/div\u003e\n\n## Description\n\n`poll-promise` is a Rust crate for polling the result of a concurrent (e.g. `async`) operation. This is in particular useful in games and immediate mode GUI:s, where one often wants to start a background operation and then ask \"are we there yet?\" on each subsequent frame until the operation completes.\n\nExample:\n\n``` rust\nlet promise = poll_promise::Promise::spawn_thread(\"slow_operation\", something_slow);\n\n// Then in the game loop or immediate mode GUI code:\nif let Some(result) = promise.ready() {\n    // Use/show result\n} else {\n    // Show a loading icon\n}\n```\n\nIf you enable the `tokio` feature you can use `poll-promise` with the [tokio](https://github.com/tokio-rs/tokio) runtime.\n\n### Caveat\nThe crate is primarily useful as a high-level building block in apps.\n\nThis crate provides convenience methods to spawn threads and tokio tasks, and methods that block on waiting for a result.\nThis is gererally a bad idea to do in a library, as decisions about execution environments and thread blocking should be left to the app.\nSo we do not recommend using this crate for libraries in its current state.\n\n## See also\nSimilar functionality is provided by:\n\n* [`eventuals::Eventual`](https://docs.rs/eventuals/latest/eventuals/struct.Eventual.html)\n* [`tokio::sync::watch::channel`](https://docs.rs/tokio/latest/tokio/sync/watch/fn.channel.html)\n\n## Contribution\n\n[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v1.4-ff69b4.svg)](../main/CODE_OF_CONDUCT.md)\n\nWe welcome community contributions to this project.\n\nPlease read our [Contributor Guide](CONTRIBUTING.md) for more information on how to get started.\nPlease also read our [Contributor Terms](CONTRIBUTING.md#contributor-terms) before you make any contributions.\n\nAny contribution intentionally submitted for inclusion in an Embark Studios project, shall comply with the Rust standard licensing model (MIT OR Apache 2.0) and therefore be dual licensed as described below, without any additional terms or conditions:\n\n### License\n\nThis contribution is dual licensed under EITHER OF\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\nFor clarity, \"your\" refers to Embark or any other licensee/user of the contribution.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembarkstudios%2Fpoll-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fembarkstudios%2Fpoll-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembarkstudios%2Fpoll-promise/lists"}