mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-21 15:59:20 +03:00
Add VecSet::insert_all
This commit is contained in:
parent
e6a72578c1
commit
59023d2a88
@ -40,6 +40,17 @@ impl<T: PartialEq> VecSet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true iff any of the given elements previoously existed in the set.
|
||||
pub fn insert_all<I: Iterator<Item = T>>(&mut self, values: I) -> bool {
|
||||
let mut any_existed = false;
|
||||
|
||||
for value in values {
|
||||
any_existed = any_existed || self.insert(value);
|
||||
}
|
||||
|
||||
any_existed
|
||||
}
|
||||
|
||||
pub fn contains(&self, value: &T) -> bool {
|
||||
self.elements.contains(value)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user