{"id":17924270,"url":"https://github.com/zebp/tryagain","last_synced_at":"2025-10-19T18:44:20.893Z","repository":{"id":57670676,"uuid":"332032166","full_name":"zebp/tryagain","owner":"zebp","description":"A library to try things again if they fail","archived":false,"fork":false,"pushed_at":"2022-01-16T23:25:36.000Z","size":16,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T05:49:36.374Z","etag":null,"topics":["crate","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/tryagain","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zebp.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":"2021-01-22T18:37:35.000Z","updated_at":"2023-09-24T13:34:21.000Z","dependencies_parsed_at":"2022-09-26T20:41:13.698Z","dependency_job_id":null,"html_url":"https://github.com/zebp/tryagain","commit_stats":null,"previous_names":["vlakreeh/tryagain"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebp%2Ftryagain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebp%2Ftryagain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebp%2Ftryagain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zebp%2Ftryagain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zebp","download_url":"https://codeload.github.com/zebp/tryagain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246970846,"owners_count":20862641,"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":["crate","rust"],"created_at":"2024-10-28T20:47:50.361Z","updated_at":"2025-10-19T18:44:20.774Z","avatar_url":"https://github.com/zebp.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tryagain\n[![Docs.rs][docs-badge]][docs-url]\n[![Crates.io][crates-badge]][crates-url]\n[![Unlicense][license-badge]][license-url]\n\n[crates-badge]: https://img.shields.io/crates/v/tryagain.svg\n[crates-url]: https://crates.io/crates/tryagain\n[license-badge]: https://img.shields.io/badge/license-Unlicense-blue.svg\n[license-url]: https://github.com/vlakreeh/tryagain/blob/master/LICENSE\n[docs-badge]: https://img.shields.io/badge/docs.rs-rustdoc-green\n[docs-url]: https://docs.rs/tryagain/\n\n`tryagain` is a crate to try things again if they fail inspired by\n[backoff](https://docs.rs/backoff) that offers an easier way to cancel\nretry attemps and uses a non-blocking async implementation.\n`tryagain` works with both [tokio](https://crates.io/crates/tokio) and\n[async-std](https://crates.io/crates/async-std) through the use of the\nfeature flags `runtime-tokio` and `runtime-async-std`.\n\n## Sync example\n```rust\nlet counter = RefCell::new(0);\nlet fails_four_times = || {\n    let mut counter = counter.borrow_mut();\n    *counter += 1;\n\n    if *counter \u003c 5 {\n        Err(*counter)\n    } else {\n        Ok(())\n    }\n};\n\ntryagain::retry(ImmediateBackoff, fails_four_times);\n```\n## Async example\n```rust\nlet counter = RefCell::new(0);\nlet fails_four_times = || async {\n    let mut counter = counter.borrow_mut();\n    *counter += 1;\n\n    if *counter \u003c 5 {\n        Err(*counter)\n    } else {\n        Ok(())\n    }\n};\n\ntryagain::future::retry(ImmediateBackoff, fails_four_times).await;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzebp%2Ftryagain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzebp%2Ftryagain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzebp%2Ftryagain/lists"}