pub struct VecSet<T>(/* private fields */);Expand description
Implementations§
Source§impl<T> VecSet<T>
impl<T> VecSet<T>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new VecSet with a given pre-allocated capacity.
May allocate more than requested.
Sourcepub fn drain(&mut self) -> Drain<'_, T> ⓘ
pub fn drain(&mut self) -> Drain<'_, T> ⓘ
Empty the set and return an iterator over the cleared values.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserve additional space. May allocate more than requested.
§Panics
Panics if the new allocation fails.
Sourcepub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrink the capacity of the set as much as possible. May keep more than precisely needed.
Source§impl<T: Eq> VecSet<T>
impl<T: Eq> VecSet<T>
Sourcepub fn difference<'a>(&'a self, other: &'a VecSet<T>) -> Difference<'a, T> ⓘ
pub fn difference<'a>(&'a self, other: &'a VecSet<T>) -> Difference<'a, T> ⓘ
Get an iterator over the set difference between two sets.
Sourcepub fn symmetric_difference<'a>(
&'a self,
other: &'a VecSet<T>,
) -> SymmetricDifference<'a, T> ⓘ
pub fn symmetric_difference<'a>( &'a self, other: &'a VecSet<T>, ) -> SymmetricDifference<'a, T> ⓘ
Get an iterator over the symmetric set difference between two sets.
Sourcepub fn intersection<'a>(&'a self, other: &'a VecSet<T>) -> Intersection<'a, T> ⓘ
pub fn intersection<'a>(&'a self, other: &'a VecSet<T>) -> Intersection<'a, T> ⓘ
Get an iterator over the intersection of two sets.
Sourcepub fn union<'a>(&'a self, other: &'a VecSet<T>) -> Union<'a, T> ⓘ
pub fn union<'a>(&'a self, other: &'a VecSet<T>) -> Union<'a, T> ⓘ
Get an iterator over the union of two sets.
Sourcepub fn is_disjoint(&self, other: &VecSet<T>) -> bool
pub fn is_disjoint(&self, other: &VecSet<T>) -> bool
Check if two sets are disjoint.
Sourcepub fn is_superset(&self, other: &VecSet<T>) -> bool
pub fn is_superset(&self, other: &VecSet<T>) -> bool
Check if one set is a superset of another.
Sourcepub fn insert(&mut self, value: T) -> bool
pub fn insert(&mut self, value: T) -> bool
Insert a value into the set.
Returns true if the value was successfully inserted,
and false if the value was already present.
Sourcepub fn replace(&mut self, value: T) -> Option<T>
pub fn replace(&mut self, value: T) -> Option<T>
Replace a value with a new, equal value. If the value is replaced successfully, the old value is returned.
Trait Implementations§
Source§impl<'a, T: Eq + Copy> Extend<&'a T> for VecSet<T>
impl<'a, T: Eq + Copy> Extend<&'a T> for VecSet<T>
Source§fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<T: Eq> Extend<T> for VecSet<T>
impl<T: Eq> Extend<T> for VecSet<T>
Source§fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)