[][src]Struct map_vec::set::Set

pub struct Set<T> { /* fields omitted */ }

map_vec::Set is a data structure with a Set-like API but based on a Vec. It's primarily useful when you care about constant factors or prefer determinism to speed. Please refer to the docs for Set for details and examples of the Set API.

Example

fn main() {
  let mut set1 = map_vec::Set::new();
  let mut set2 = map_vec::Set::new();
  set1.insert(1);
  set1.insert(2);
  set2.insert(2);
  set2.insert(3);
  let mut set3 = map_vec::Set::with_capacity(1);
  assert!(set3.insert(3));
  assert_eq!(&set2 - &set1, set3);
}

Methods

impl<T: Eq> Set<T>[src]

pub fn new() -> Self[src]

pub fn with_capacity(capacity: usize) -> Self[src]

pub fn capacity(&self) -> usize[src]

pub fn clear(&mut self)[src]

pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool where
    T: Borrow<Q>,
    Q: Eq
[src]

pub fn difference<'a>(
    &'a self,
    other: &'a Self
) -> impl Iterator<Item = &'a T> + DoubleEndedIterator
[src]

pub fn drain(&mut self) -> Drain<T>[src]

pub fn get<Q: ?Sized>(&self, value: &Q) -> Option<&T> where
    T: Borrow<Q>,
    Q: Eq
[src]

pub fn get_or_insert(&mut self, value: T) -> &T[src]

pub fn get_or_insert_with<Q: ?Sized>(
    &mut self,
    value: &Q,
    f: impl FnOnce(&Q) -> T
) -> &T where
    T: Borrow<Q>,
    Q: Eq
[src]

pub fn insert(&mut self, value: T) -> bool[src]

pub fn intersection<'a>(
    &'a self,
    other: &'a Self
) -> impl Iterator<Item = &'a T> + DoubleEndedIterator<Item = &'a T>
[src]

pub fn is_disjoint<'a>(&'a self, other: &'a Self) -> bool[src]

pub fn is_empty(&self) -> bool[src]

pub fn is_subset(&self, other: &Self) -> bool[src]

pub fn is_superset(&self, other: &Self) -> bool[src]

pub fn iter(
    &self
) -> impl Iterator<Item = &T> + DoubleEndedIterator + ExactSizeIterator
[src]

pub fn len(&self) -> usize[src]

pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool where
    T: Borrow<Q>,
    Q: Eq
[src]

pub fn replace(&mut self, value: T) -> Option<T>[src]

pub fn reserve(&mut self, additional: usize)[src]

pub fn retain(&mut self, f: impl FnMut(&T) -> bool)[src]

pub fn shrink_to(&mut self, min_capacity: usize)[src]

pub fn shrink_to_fit(&mut self)[src]

pub fn symmetric_difference<'a>(
    &'a self,
    other: &'a Self
) -> impl Iterator<Item = &'a T> + DoubleEndedIterator
[src]

pub fn take<Q: ?Sized>(&mut self, value: &Q) -> Option<T> where
    T: Borrow<Q>,
    Q: Eq
[src]

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>[src]

pub fn union<'a>(
    &'a self,
    other: &'a Self
) -> impl Iterator<Item = &'a T> + DoubleEndedIterator
[src]

Trait Implementations

impl<T: Debug> Debug for Set<T>[src]

impl<T: PartialEq> PartialEq<Set<T>> for Set<T>[src]

impl<T: Eq> Eq for Set<T>[src]

impl<'_, '_, T: Clone + Eq> Sub<&'_ Set<T>> for &'_ Set<T>[src]

type Output = Set<T>

The resulting type after applying the - operator.

impl<'_, '_, T: Clone + Eq> BitAnd<&'_ Set<T>> for &'_ Set<T>[src]

type Output = Set<T>

The resulting type after applying the & operator.

impl<'_, '_, T: Clone + Eq> BitOr<&'_ Set<T>> for &'_ Set<T>[src]

type Output = Set<T>

The resulting type after applying the | operator.

impl<'_, '_, T: Clone + Eq> BitXor<&'_ Set<T>> for &'_ Set<T>[src]

type Output = Set<T>

The resulting type after applying the ^ operator.

impl<'a, T> IntoIterator for &'a Set<T>[src]

type Item = &'a T

The type of the elements being iterated over.

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?

impl<T> IntoIterator for Set<T>[src]

type Item = T

The type of the elements being iterated over.

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?

impl<T: Eq> FromIterator<T> for Set<T>[src]

impl<T: Eq> Extend<T> for Set<T>[src]

impl<'a, T: 'a + Copy + Eq> Extend<&'a T> for Set<T>[src]

impl<T: Clone> Clone for Set<T>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Default> Default for Set<T>[src]

impl<T> Serialize for Set<T> where
    T: Serialize
[src]

impl<'de, T> Deserialize<'de> for Set<T> where
    T: Deserialize<'de>, 
[src]

Auto Trait Implementations

impl<T> Unpin for Set<T> where
    T: Unpin

impl<T> Sync for Set<T> where
    T: Sync

impl<T> Send for Set<T> where
    T: Send

impl<T> UnwindSafe for Set<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for Set<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]