Struct erg_common::set::Set
source · pub struct Set<T> { /* private fields */ }
Implementations§
source§impl<T: Hash + Eq> Set<T>
impl<T: Hash + Eq> Set<T>
pub fn get<Q>(&self, value: &Q) -> Option<&T>
pub fn get_by<Q>(&self, value: &Q, cmp: impl Fn(&Q, &Q) -> bool) -> Option<&T>
pub fn fast_eq(&self, other: &Set<T>) -> bool
pub fn contains<Q>(&self, value: &Q) -> bool
pub fn remove<Q>(&mut self, value: &Q) -> bool
pub fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
pub fn extended<I: IntoIterator<Item = T>>(self, iter: I) -> Self
pub fn is_superset(&self, other: &Set<T>) -> bool
pub fn merge(&mut self, other: Self)
pub fn concat(self, other: Self) -> Self
sourcepub fn retain(&mut self, f: impl FnMut(&T) -> bool)
pub fn retain(&mut self, f: impl FnMut(&T) -> bool)
remove all elements for which the predicate returns false
pub fn clear(&mut self)
pub fn take_all(&mut self) -> Self
pub fn inplace_map<F: FnMut(T) -> T>(&mut self, f: F)
source§impl<T: Hash + Eq + Clone> Set<T>
impl<T: Hash + Eq + Clone> Set<T>
sourcepub fn union(&self, other: &Set<T>) -> Set<T>
pub fn union(&self, other: &Set<T>) -> Set<T>
assert_eq!(set!{1, 2, 3}.union(&set!{2, 3, 4}), set!{1, 2, 3, 4});
pub fn union_iter<'a>( &'a self, other: &'a Set<T> ) -> impl Iterator<Item = &'a T>
pub fn union_from_iter<I: Iterator<Item = T>>(&self, iter: I) -> Set<T>
sourcepub fn intersection(&self, other: &Set<T>) -> Set<T>
pub fn intersection(&self, other: &Set<T>) -> Set<T>
assert_eq!(set!{1, 2, 3}.intersection(&set!{2, 3, 4}), set!{2, 3});
pub fn intersec_iter<'a>( &'a self, other: &'a Set<T> ) -> impl Iterator<Item = &'a T>
pub fn intersec_from_iter<I: Iterator<Item = T>>(&self, iter: I) -> Set<T>
sourcepub fn multi_intersection<I>(i: I) -> Set<T>
pub fn multi_intersection<I>(i: I) -> Set<T>
assert_eq!(Set::multi_intersection([set!{1, 3}, set!{1, 2}].into_iter()), set!{1});
assert_eq!(Set::multi_intersection([set!{1, 3}, set!{1, 2}, set!{2}].into_iter()), set!{1, 2});
assert_eq!(Set::multi_intersection([set!{1, 3}, set!{1, 2}, set!{2, 3}].into_iter()), set!{1, 2, 3});
pub fn difference(&self, other: &Set<T>) -> Set<T>
pub fn diff_iter<'a>(&'a self, other: &'a Set<T>) -> impl Iterator<Item = &'a T>
pub fn include(self, other: T) -> Set<T>
pub fn exclude(self, other: &T) -> Set<T>
Trait Implementations§
source§impl<T: Hash> IntoIterator for Set<T>
impl<T: Hash> IntoIterator for Set<T>
source§impl<T: Hash + Eq> PartialEq for Set<T>
impl<T: Hash + Eq> PartialEq for Set<T>
impl<T: Hash + Eq> Eq for Set<T>
Auto Trait Implementations§
impl<T> Freeze for Set<T>
impl<T> RefUnwindSafe for Set<T>where
T: RefUnwindSafe,
impl<T> Send for Set<T>where
T: Send,
impl<T> Sync for Set<T>where
T: Sync,
impl<T> Unpin for Set<T>where
T: Unpin,
impl<T> UnwindSafe for Set<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more