Still, I also discover that this function only gives an immutable reference to the elements inside. That's sad because it can give a mutable one and allow a more thorough set of use cases to be done with that function.
Changing the function signature (the argument of the
retain method) is a breaking change. I tried to change it in the std, and
BinaryHeap wasn't happy about that. So I would like your advice, is it better to create a new
Vec::retain_mut or just let users implement their own function to do that?
// implemented on Vec<T> fn retain_mut<F>(&mut self, mut f: F) where F: FnMut(&mut T) -> bool;