[−][src]Struct oasis_std::collections::set::Set
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
use oasis_std::collections::Set; let mut set1 = Set::new(); let mut set2 = Set::new(); set1.insert(1); set1.insert(2); set2.insert(2); set2.insert(3); let mut set3 = 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(&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]
&'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 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]
&'a self,
other: &'a Self
) -> impl Iterator<Item = &'a T> + DoubleEndedIterator
Trait Implementations
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> BorshDeserialize for Set<T> where
T: BorshDeserialize + Eq,
[src]
T: BorshDeserialize + Eq,
fn deserialize<R: Read>(reader: &mut R) -> Result<Self, Error>
[src]
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
[src]
impl<T> BorshSerialize for Set<T> where
T: BorshSerialize + PartialOrd,
[src]
T: BorshSerialize + PartialOrd,
fn serialize<W: Write>(&self, writer: &mut W) -> Result<(), Error>
[src]
fn try_to_vec(&self) -> Result<Vec<u8>, Error>
[src]
impl<T: Clone> Clone for Set<T>
[src]
impl<T: Debug> Debug for Set<T>
[src]
impl<T: Default> Default for Set<T>
[src]
impl<T: Eq> Eq for Set<T>
[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: Eq> Extend<T> for Set<T>
[src]
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
[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: PartialEq> PartialEq<Set<T>> for Set<T>
[src]
impl<T> StructuralEq for Set<T>
[src]
impl<T> StructuralPartialEq for Set<T>
[src]
impl<'_, '_, T: Clone + Eq> Sub<&'_ Set<T>> for &'_ Set<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Set<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Set<T> where
T: Send,
T: Send,
impl<T> Sync for Set<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Set<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Set<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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> 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, 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<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, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,