Add retain to VecSet

This commit is contained in:
Ayaz Hafiz 2022-11-15 09:39:20 -06:00
parent 60178f14e4
commit 6d0c42d480
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -88,6 +88,14 @@ impl<T: PartialEq> VecSet<T> {
pub fn clear(&mut self) {
self.elements.clear()
}
/// Retains only the elements specified by the predicate.
pub fn retain<F>(&mut self, f: F)
where
F: FnMut(&T) -> bool,
{
self.elements.retain(f)
}
}
impl<A: Ord> Extend<A> for VecSet<A> {