[−][src]Struct map_vec::set::Set
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
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]
T: Borrow<Q>,
Q: Eq,
pub fn difference<'a>(
&'a self,
other: &'a Self
) -> impl Iterator<Item = &'a T> + DoubleEndedIterator
[src]
&'a self,
other: &'a Self
) -> impl Iterator<Item = &'a T> + DoubleEndedIterator
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]
T: Borrow<Q>,
Q: Eq,
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]
&mut self,
value: &Q,
f: impl FnOnce(&Q) -> T
) -> &T where
T: Borrow<Q>,
Q: Eq,
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]
&'a self,
other: &'a Self
) -> impl Iterator<Item = &'a T> + DoubleEndedIterator<Item = &'a T>
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]
&self
) -> impl Iterator<Item = &T> + DoubleEndedIterator + ExactSizeIterator
pub fn len(&self) -> usize
[src]
pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool where
T: Borrow<Q>,
Q: Eq,
[src]
T: Borrow<Q>,
Q: Eq,
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_fit(&mut self)
[src]
pub fn symmetric_difference<'a>(
&'a self,
other: &'a Self
) -> impl Iterator<Item = &'a T> + DoubleEndedIterator
[src]
&'a self,
other: &'a Self
) -> impl Iterator<Item = &'a T> + DoubleEndedIterator
pub fn take<Q: ?Sized>(&mut self, value: &Q) -> Option<T> where
T: Borrow<Q>,
Q: Eq,
[src]
T: Borrow<Q>,
Q: Eq,
pub fn union<'a>(
&'a self,
other: &'a Self
) -> impl Iterator<Item = &'a T> + DoubleEndedIterator
[src]
&'a self,
other: &'a Self
) -> impl Iterator<Item = &'a T> + DoubleEndedIterator
Trait Implementations
impl<T: Debug> Debug 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.
fn sub(self, rhs: &Set<T>) -> 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> BitAnd<&'_ Set<T>> for &'_ Set<T>
[src]
type Output = Set<T>
The resulting type after applying the &
operator.
fn bitand(self, rhs: &Set<T>) -> Set<T>
[src]
impl<'_, '_, T: Clone + Eq> BitOr<&'_ Set<T>> for &'_ Set<T>
[src]
type Output = Set<T>
The resulting type after applying the |
operator.
fn bitor(self, rhs: &Set<T>) -> Set<T>
[src]
impl<'_, '_, T: Clone + Eq> BitXor<&'_ Set<T>> for &'_ Set<T>
[src]
type Output = Set<T>
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: &Set<T>) -> Set<T>
[src]
impl<T> StructuralPartialEq for Set<T>
[src]
impl<T> StructuralEq for Set<T>
[src]
impl<T: Eq> FromIterator<T> for Set<T>
[src]
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
[src]
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?
fn into_iter(self) -> Self::IntoIter
[src]
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?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T: Eq> Extend<T> for Set<T>
[src]
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
[src]
impl<'a, T: 'a + Copy + Eq> Extend<&'a T> for Set<T>
[src]
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
[src]
impl<T: Clone> Clone for Set<T>
[src]
impl<T: Default> Default for Set<T>
[src]
impl<T> Serialize for Set<T> where
T: Serialize,
[src]
T: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de, T> Deserialize<'de> for Set<T> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl<T> Unpin for Set<T> where
T: Unpin,
T: Unpin,
impl<T> Send for Set<T> where
T: Send,
T: Send,
impl<T> Sync for Set<T> where
T: Sync,
T: Sync,
impl<T> UnwindSafe for Set<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for Set<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
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?
fn into_iter(self) -> I
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,