Struct erg_common::set::Set
source · pub struct Set<T> { /* private fields */ }
Implementations§
source§impl<T> Set<T>
impl<T> Set<T>
pub fn new() -> Self
pub fn get_by<Q>(&self, value: &Q, cmp: impl Fn(&Q, &Q) -> bool) -> Option<&T>
pub fn with_capacity(capacity: usize) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> Iter<'_, T>
pub fn to_vec(&self) -> Vec<T>where
T: Clone,
pub fn into_vec(self) -> Vec<T>
source§impl<T: Eq> Set<T>
impl<T: Eq> Set<T>
source§impl<T: Hash + Eq + Immutable> Set<T>
impl<T: Hash + Eq + Immutable> Set<T>
source§impl<T: Hash + Eq + Clone + Immutable> Set<T>
impl<T: Hash + Eq + Clone + Immutable> 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});
source§impl<T: Hash + Eq> Set<T>
impl<T: Hash + Eq> Set<T>
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>
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>
Trait Implementations§
source§impl<'a, T> IntoIterator for &'a Set<T>
impl<'a, T> IntoIterator for &'a Set<T>
source§impl<T: Hash> IntoIterator for Set<T>
impl<T: Hash> IntoIterator for Set<T>
impl<T: Hash + Eq + Immutable> 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)