-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #135 - JulianKnodt:master, r=Amanieu
Implemented drain_filter for HashMap #134 Drain filter is as described in the doc comments. The implementation is based almost entirely on retain's implementation, as per `amanieu`'s suggestion. I messed around with the lifetimes, as I'm not entirely familiar with the unsafe `iter` on the raw table, but since we're now using a lazy iterator, the predicate must be valid for as long as the borrow on the table. I also annotated the function with a `#[must_use]`, otherwise the drain would have no effect. Please let me know if there are any other additions before this change can be added. Thanks! Edit: I also realize this could be added to hashset, let me know if I should add that as well, and if there are other tests that need to be updated.
- Loading branch information
Showing
1 changed file
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters