mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 15:03:46 +00:00
Add retain
to VecSet
This commit is contained in:
parent
60178f14e4
commit
6d0c42d480
1 changed files with 8 additions and 0 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue