{"id":22297476,"url":"https://github.com/rustonaut/vec-drain-where","last_synced_at":"2025-12-12T14:43:59.595Z","repository":{"id":57671578,"uuid":"146207499","full_name":"rustonaut/vec-drain-where","owner":"rustonaut","description":"An alternative `Vec::drain_filter` implementation","archived":false,"fork":false,"pushed_at":"2019-10-11T14:19:30.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-31T21:02:30.341Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rustonaut.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-08-26T18:50:01.000Z","updated_at":"2022-06-05T12:20:24.000Z","dependencies_parsed_at":"2022-09-10T13:51:44.647Z","dependency_job_id":null,"html_url":"https://github.com/rustonaut/vec-drain-where","commit_stats":null,"previous_names":["1aim/vec-drain-where"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustonaut%2Fvec-drain-where","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustonaut%2Fvec-drain-where/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustonaut%2Fvec-drain-where/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustonaut%2Fvec-drain-where/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rustonaut","download_url":"https://codeload.github.com/rustonaut/vec-drain-where/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245556960,"owners_count":20634889,"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-12-03T17:49:53.022Z","updated_at":"2025-12-12T14:43:54.554Z","avatar_url":"https://github.com/rustonaut.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vec-drain-where\n\nA alternate `Vec::drain_filter` implementation, slightly diverging from\nthe std's implementation.\n\nThis crate provides an extension trait adding a `e_drain_where` method\n(the `e_` prefix is used to prevent name collisions with std as the\ncurrently `drain_filter` might be stabilized as `drain_where`).\n\n**`e_drain_where` as one large difference to drain filter. It doesn't\nrun to completion when dropped and can as such be \"early stopped\" from\nthe outside by stopping the iteration an dropping the iterator.**\n\nThe reason why `Vec::drain_filter` does run the drain to completion\non drop is that it can be quite confusing. E.g. the code:\n\n```\nvec.drain_filter(|x|x.should_be_removed()).any(|x|x.had_fatal_error())\n```\n\nWould not necessary do what it's expected to do, i.e. it would drain\nthinks until it finds any drained value with `had_fatal_error() == true`\n_and then would stop draining_ (with `e_drain_where`).\n\nBut running to completion on drop is also tricky/dangerous e.g. it can\nlead easily to thinks like panic's on drop and as such double panics,\nwhile drop on panic behavior for `Vec::drain_filter` might still change\nbefore stabilization, this crate completely avoids the problem at cost\nof making it easy to accidentally stop the draining to early.\n\n\n## Documentation\n\nDocumentation can be [viewed on docs.rs](https://docs.rs/mail-api). (at least once it's published ;=) )\n\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 option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustonaut%2Fvec-drain-where","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frustonaut%2Fvec-drain-where","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustonaut%2Fvec-drain-where/lists"}