pub struct EnumSet<T: EnumSetType> { /* private fields */ }Expand description
A set of enum variants, stored as a bitmask.
Implementations§
Source§impl<T: EnumSetType> EnumSet<T>
impl<T: EnumSetType> EnumSet<T>
Sourcepub const fn from_u64_truncated(bits: u64) -> Self
pub const fn from_u64_truncated(bits: u64) -> Self
Build a set from a raw bitmask, discarding bits that name no variant.
Sourcepub fn remove(&mut self, value: T) -> bool
pub fn remove(&mut self, value: T) -> bool
Remove value, returning whether it had been present.
Sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
Variants in both sets.
Sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
Variants in self but not other.
Sourcepub const fn symmetrical_difference(self, other: Self) -> Self
pub const fn symmetrical_difference(self, other: Self) -> Self
Variants in exactly one of the two sets.
Sourcepub const fn complement(self) -> Self
pub const fn complement(self) -> Self
Every variant not in the set.
Sourcepub const fn is_superset(self, other: Self) -> bool
pub const fn is_superset(self, other: Self) -> bool
Whether every variant of other is in self.
Sourcepub const fn is_disjoint(self, other: Self) -> bool
pub const fn is_disjoint(self, other: Self) -> bool
Whether the two sets share no variants.
Sourcepub fn iter(self) -> EnumSetIter<T> ⓘ
pub fn iter(self) -> EnumSetIter<T> ⓘ
Iterate the variants in the set, in declaration order.
Trait Implementations§
Source§impl<T: EnumSetType> BitAnd for EnumSet<T>
impl<T: EnumSetType> BitAnd for EnumSet<T>
Source§impl<T: EnumSetType> BitAnd<T> for EnumSet<T>
impl<T: EnumSetType> BitAnd<T> for EnumSet<T>
Source§impl<T: EnumSetType> BitAndAssign for EnumSet<T>
impl<T: EnumSetType> BitAndAssign for EnumSet<T>
Source§fn bitand_assign(&mut self, other: EnumSet<T>)
fn bitand_assign(&mut self, other: EnumSet<T>)
Performs the
&= operation. Read moreSource§impl<T: EnumSetType> BitAndAssign<T> for EnumSet<T>
impl<T: EnumSetType> BitAndAssign<T> for EnumSet<T>
Source§fn bitand_assign(&mut self, other: T)
fn bitand_assign(&mut self, other: T)
Performs the
&= operation. Read moreSource§impl<T: EnumSetType> BitOr for EnumSet<T>
impl<T: EnumSetType> BitOr for EnumSet<T>
Source§impl BitOr<EnumSet<AtomicUsage>> for AtomicUsage
impl BitOr<EnumSet<AtomicUsage>> for AtomicUsage
Source§type Output = EnumSet<AtomicUsage>
type Output = EnumSet<AtomicUsage>
The resulting type after applying the
| operator.Source§fn bitor(self, other: EnumSet<AtomicUsage>) -> EnumSet<AtomicUsage>
fn bitor(self, other: EnumSet<AtomicUsage>) -> EnumSet<AtomicUsage>
Performs the
| operation. Read moreSource§impl BitOr<EnumSet<ComplexUsage>> for ComplexUsage
impl BitOr<EnumSet<ComplexUsage>> for ComplexUsage
Source§type Output = EnumSet<ComplexUsage>
type Output = EnumSet<ComplexUsage>
The resulting type after applying the
| operator.Source§fn bitor(self, other: EnumSet<ComplexUsage>) -> EnumSet<ComplexUsage>
fn bitor(self, other: EnumSet<ComplexUsage>) -> EnumSet<ComplexUsage>
Performs the
| operation. Read moreSource§impl<T: EnumSetType> BitOr<T> for EnumSet<T>
impl<T: EnumSetType> BitOr<T> for EnumSet<T>
Source§impl<T: EnumSetType> BitOrAssign for EnumSet<T>
impl<T: EnumSetType> BitOrAssign for EnumSet<T>
Source§fn bitor_assign(&mut self, other: EnumSet<T>)
fn bitor_assign(&mut self, other: EnumSet<T>)
Performs the
|= operation. Read moreSource§impl<T: EnumSetType> BitOrAssign<T> for EnumSet<T>
impl<T: EnumSetType> BitOrAssign<T> for EnumSet<T>
Source§fn bitor_assign(&mut self, other: T)
fn bitor_assign(&mut self, other: T)
Performs the
|= operation. Read moreSource§impl<T: EnumSetType> BitXor for EnumSet<T>
impl<T: EnumSetType> BitXor for EnumSet<T>
Source§impl<T: EnumSetType> BitXor<T> for EnumSet<T>
impl<T: EnumSetType> BitXor<T> for EnumSet<T>
Source§impl<T: EnumSetType> BitXorAssign for EnumSet<T>
impl<T: EnumSetType> BitXorAssign for EnumSet<T>
Source§fn bitxor_assign(&mut self, other: EnumSet<T>)
fn bitxor_assign(&mut self, other: EnumSet<T>)
Performs the
^= operation. Read moreSource§impl<T: EnumSetType> BitXorAssign<T> for EnumSet<T>
impl<T: EnumSetType> BitXorAssign<T> for EnumSet<T>
Source§fn bitxor_assign(&mut self, other: T)
fn bitxor_assign(&mut self, other: T)
Performs the
^= operation. Read moreSource§impl<T: EnumSetType> Clone for EnumSet<T>
impl<T: EnumSetType> Clone for EnumSet<T>
impl<T: EnumSetType> Copy for EnumSet<T>
Source§impl<T: EnumSetType> Default for EnumSet<T>
impl<T: EnumSetType> Default for EnumSet<T>
Source§impl<'de, T: EnumSetType> Deserialize<'de> for EnumSet<T>
Available on crate feature serde only.
impl<'de, T: EnumSetType> Deserialize<'de> for EnumSet<T>
Available on crate feature
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl<T: EnumSetType> Eq for EnumSet<T>
Source§impl<T: EnumSetType> Extend<T> for EnumSet<T>
impl<T: EnumSetType> Extend<T> for EnumSet<T>
Source§fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<T: EnumSetType> From<T> for EnumSet<T>
impl<T: EnumSetType> From<T> for EnumSet<T>
Source§impl<T: EnumSetType> FromIterator<T> for EnumSet<T>
impl<T: EnumSetType> FromIterator<T> for EnumSet<T>
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl<T: EnumSetType> Hash for EnumSet<T>
impl<T: EnumSetType> Hash for EnumSet<T>
Source§impl<T: EnumSetType> IntoIterator for EnumSet<T>
impl<T: EnumSetType> IntoIterator for EnumSet<T>
Source§impl<T: EnumSetType> Not for EnumSet<T>
impl<T: EnumSetType> Not for EnumSet<T>
Source§impl<T: EnumSetType> Ord for EnumSet<T>
impl<T: EnumSetType> Ord for EnumSet<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<T: EnumSetType> PartialEq for EnumSet<T>
impl<T: EnumSetType> PartialEq for EnumSet<T>
Source§impl<T: EnumSetType> PartialOrd for EnumSet<T>
impl<T: EnumSetType> PartialOrd for EnumSet<T>
Source§impl<T: EnumSetType> Serialize for EnumSet<T>
Available on crate feature serde only.
impl<T: EnumSetType> Serialize for EnumSet<T>
Available on crate feature
serde only.Source§impl<T: EnumSetType> Sub for EnumSet<T>
impl<T: EnumSetType> Sub for EnumSet<T>
Source§impl<T: EnumSetType> Sub<T> for EnumSet<T>
impl<T: EnumSetType> Sub<T> for EnumSet<T>
Source§impl<T: EnumSetType> SubAssign for EnumSet<T>
impl<T: EnumSetType> SubAssign for EnumSet<T>
Source§fn sub_assign(&mut self, other: EnumSet<T>)
fn sub_assign(&mut self, other: EnumSet<T>)
Performs the
-= operation. Read moreSource§impl<T: EnumSetType> SubAssign<T> for EnumSet<T>
impl<T: EnumSetType> SubAssign<T> for EnumSet<T>
Source§fn sub_assign(&mut self, other: T)
fn sub_assign(&mut self, other: T)
Performs the
-= operation. Read moreAuto Trait Implementations§
impl<T> Freeze for EnumSet<T>where
PhantomData<T>: Freeze,
impl<T> RefUnwindSafe for EnumSet<T>where
PhantomData<T>: RefUnwindSafe,
impl<T> Send for EnumSet<T>where
PhantomData<T>: Send,
impl<T> Sync for EnumSet<T>where
PhantomData<T>: Sync,
impl<T> Unpin for EnumSet<T>where
PhantomData<T>: Unpin,
impl<T> UnsafeUnpin for EnumSet<T>where
PhantomData<T>: UnsafeUnpin,
impl<T> UnwindSafe for EnumSet<T>where
PhantomData<T>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more