You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
0 commit comments