pub struct EnumSet<T: EnumSetType> { /* private fields */ }Expand description
An efficient set type for enums.
Implementations
sourceimpl<T: EnumSetType> EnumSet<T>
impl<T: EnumSetType> EnumSet<T>
sourcepub fn bit_width() -> u8
pub fn bit_width() -> u8
Total number of bits this enumset uses. Note that the actual amount of space used is
rounded up to the next highest integer type (u8, u16, u32, u64, or u128).
This is the same as EnumSet::variant_count except in enums with “sparse” variants.
(e.g. enum Foo { A = 10, B = 20 })
sourcepub fn variant_count() -> u8
pub fn variant_count() -> u8
The number of valid variants in this enumset.
This is the same as EnumSet::bit_width except in enums with “sparse” variants.
(e.g. enum Foo { A = 10, B = 20 })
sourcepub fn is_disjoint(&self, other: Self) -> bool
pub fn is_disjoint(&self, other: Self) -> bool
Checks if this set shares no elements with another.
sourcepub fn is_superset(&self, other: Self) -> bool
pub fn is_superset(&self, other: Self) -> bool
Checks if all elements in another set are in this set.
sourcepub fn is_subset(&self, other: Self) -> bool
pub fn is_subset(&self, other: Self) -> bool
Checks if all elements of this set are in another set.
sourcepub fn union(&self, other: Self) -> Self
pub fn union(&self, other: Self) -> Self
Returns a set containing the union of all elements in both sets.
sourcepub fn intersection(&self, other: Self) -> Self
pub fn intersection(&self, other: Self) -> Self
Returns a set containing all elements in common with another set.
sourcepub fn difference(&self, other: Self) -> Self
pub fn difference(&self, other: Self) -> Self
Returns a set with all elements of the other set removed.
sourcepub fn symmetrical_difference(&self, other: Self) -> Self
pub fn symmetrical_difference(&self, other: Self) -> Self
Returns a set with all elements not contained in both sets.
sourcepub fn complement(&self) -> Self
pub fn complement(&self) -> Self
Returns a set containing all elements not in this set.
sourcepub fn insert_all(&mut self, other: Self)
pub fn insert_all(&mut self, other: Self)
Adds all elements in another set to this one.
sourcepub fn remove_all(&mut self, other: Self)
pub fn remove_all(&mut self, other: Self)
Removes all values in another set from this one.
sourcepub fn iter(&self) -> EnumSetIter<T> ⓘ
pub fn iter(&self) -> EnumSetIter<T> ⓘ
Creates an iterator over the values in this set.
Trait Implementations
sourceimpl<T: EnumSetType, O: Into<EnumSet<T>>> BitAndAssign<O> for EnumSet<T>
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitAndAssign<O> for EnumSet<T>
sourcefn bitand_assign(&mut self, rhs: O)
fn bitand_assign(&mut self, rhs: O)
&= operation. Read moresourceimpl<T: EnumSetType, O: Into<EnumSet<T>>> BitOrAssign<O> for EnumSet<T>
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitOrAssign<O> for EnumSet<T>
sourcefn bitor_assign(&mut self, rhs: O)
fn bitor_assign(&mut self, rhs: O)
|= operation. Read moresourceimpl<T: EnumSetType, O: Into<EnumSet<T>>> BitXorAssign<O> for EnumSet<T>
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitXorAssign<O> for EnumSet<T>
sourcefn bitxor_assign(&mut self, rhs: O)
fn bitxor_assign(&mut self, rhs: O)
^= operation. Read moresourceimpl<T: EnumSetType + Debug> Debug for EnumSet<T>
impl<T: EnumSetType + Debug> Debug for EnumSet<T>
sourceimpl<T: EnumSetType> From<T> for EnumSet<T>
impl<T: EnumSetType> From<T> for EnumSet<T>
sourceimpl<T: EnumSetType> IntoIterator for EnumSet<T>
impl<T: EnumSetType> IntoIterator for EnumSet<T>
sourceimpl<T: EnumSetType> Not for EnumSet<T>
impl<T: EnumSetType> Not for EnumSet<T>
sourceimpl<T: Ord + EnumSetType> Ord for EnumSet<T>where
T::Repr: Ord,
impl<T: Ord + EnumSetType> Ord for EnumSet<T>where
T::Repr: Ord,
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl<T: PartialEq + EnumSetType> PartialEq<EnumSet<T>> for EnumSet<T>where
T::Repr: PartialEq,
impl<T: PartialEq + EnumSetType> PartialEq<EnumSet<T>> for EnumSet<T>where
T::Repr: PartialEq,
sourceimpl<T: PartialOrd + EnumSetType> PartialOrd<EnumSet<T>> for EnumSet<T>where
T::Repr: PartialOrd,
impl<T: PartialOrd + EnumSetType> PartialOrd<EnumSet<T>> for EnumSet<T>where
T::Repr: PartialOrd,
sourcefn partial_cmp(&self, other: &EnumSet<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &EnumSet<T>) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresourceimpl<T: EnumSetType, O: Into<EnumSet<T>>> SubAssign<O> for EnumSet<T>
impl<T: EnumSetType, O: Into<EnumSet<T>>> SubAssign<O> for EnumSet<T>
sourcefn sub_assign(&mut self, rhs: O)
fn sub_assign(&mut self, rhs: O)
-= operation. Read more