Currently only Vec and LinkedList have a drain_filter method, while other collections such as HashMap and HashSet do not.
This means that currently, removing items from a collection, and getting ownership of those items is fairly...unidiomatic and cumbersome.
For references, see https://github.com/rust-lang/rfcs/issues/2140
This may be easy to implement since drain_filter was added to the underlying hashbrown types in rust-lang/hashbrown#135 and rust-lang/hashbrown#179. (Requires hashbrown 0.8.1 or later; see #70052.)
I have implemented this on a branch, but it will need to wait for a new release of the hashbrown crate because it depends on rust-lang/hashbrown#185, rust-lang/hashbrown#187, and rust-lang/hashbrown#188:
https://github.com/rust-lang/rust/compare/master...mbrubeck:hash_drain_filter
This is now implemented in nightly behind the unstable hash_drain_filter feature:
Most helpful comment
This is now implemented in nightly behind the unstable
hash_drain_filterfeature: