{"id":16607256,"url":"https://github.com/dns2utf8/drop_guard","last_synced_at":"2025-09-28T17:31:04.330Z","repository":{"id":57621900,"uuid":"97094764","full_name":"dns2utf8/drop_guard","owner":"dns2utf8","description":"Catch everything as it is falling out of scope","archived":false,"fork":false,"pushed_at":"2023-10-29T16:41:21.000Z","size":18,"stargazers_count":3,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-13T08:50:27.586Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/dns2utf8.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["dns2utf8"],"patreon":"dns2utf8"}},"created_at":"2017-07-13T07:44:09.000Z","updated_at":"2023-07-27T01:06:44.000Z","dependencies_parsed_at":"2024-10-28T10:29:26.447Z","dependency_job_id":"62d410fc-46b5-4cee-8efe-8229a6db7e6b","html_url":"https://github.com/dns2utf8/drop_guard","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":"0.050000000000000044","last_synced_commit":"ac078e172ea97c215c4922864d5e4b6e032798fb"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dns2utf8%2Fdrop_guard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dns2utf8%2Fdrop_guard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dns2utf8%2Fdrop_guard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dns2utf8%2Fdrop_guard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dns2utf8","download_url":"https://codeload.github.com/dns2utf8/drop_guard/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234541571,"owners_count":18849635,"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-10-12T01:12:10.317Z","updated_at":"2025-09-28T17:31:03.997Z","avatar_url":"https://github.com/dns2utf8.png","language":"Rust","funding_links":["https://github.com/sponsors/dns2utf8","https://patreon.com/dns2utf8"],"categories":[],"sub_categories":[],"readme":"# drop_guard\n\n[![crates.io](https://img.shields.io/crates/v/drop_guard.svg)](https://crates.io/crates/drop_guard)\n[![doc.rs](https://docs.rs/drop_guard/badge.svg)](https://docs.rs/drop_guard)\n[![Build Status travis](https://travis-ci.org/dns2utf8/drop_guard.svg?branch=master)](https://travis-ci.org/dns2utf8/drop_guard)\n[![Build status appveyor](https://ci.appveyor.com/api/projects/status/github/dns2utf8/drop_guard?svg=true)](https://ci.appveyor.com/project/dns2utf8/drop-guard)\n\nA RAII that executes you function whenever the wrapped object gets dropped.\n\n## Use cases\n\nJoining threads when they fall out of scope:\n\n```rust\nextern crate drop_guard;\n\nuse drop_guard::DropGuard;\n\nuse std::thread::{spawn, sleep};\nuse std::time::guard;\n\nfn main() {\n    let _ = guard(spawn(move || {\n                            sleep(Duration::from_secs(2));\n                            println!(\"println! from thread\");\n                        })\n                        , |join_handle| join_handle.join().unwrap());\n    \n    println!(\"Waiting for thread ...\");\n}\n```\n\n## Examples\n\nFeel free to run the included examples:\n\n```bash\ncargo run --example drop\ncargo run --example rainbow\ncargo run --example thread\ncargo run --example threadpool\n```\n\n## Contribute\n\nContributions are very welcome.\nFeel free to bring your own ideas or continue one of these:\n\n* Add example/test with panic between guard and drop\n* Add example/test with panic in guard closure\n* Add minimal rustc version\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your discression.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in the work by you, as defined in the Apache-2.0\nlicense, shall be dual licensed as above, without any additional terms or\nconditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdns2utf8%2Fdrop_guard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdns2utf8%2Fdrop_guard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdns2utf8%2Fdrop_guard/lists"}