pub fn retain<F>(&mut self, mut f: F)
    where
        T: Ord,
        F: FnMut(&T) -> bool,
    {
        self.drain_filter(|v| !f(v));
    }
Creates an iterator which uses a closure to determine if a value should be removed.

If the closure returns true, then the value is removed and yielded.
If the closure returns false, the value will remain in the list and will not be yielded
by the iterator.

If the iterator is only partially consumed or not consumed at all, each of the remaining
values will still be subjected to the closure and removed and dropped if it returns true.

It is unspecified how many more values will be subjected to the closure
if a panic occurs in the closure, or if a panic occurs while dropping a value, or if the
`DrainFilter` itself is leaked.

# Examples

Splitting a set into even and odd values, reusing the original set:

```
#![feature(btree_drain_
benchmarks/haystacks/code/rust-library.rs