Skip to main content

EnumSet

Struct EnumSet 

Source
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>

Source

pub const fn empty() -> Self

The empty set.

Source

pub const fn all() -> Self

The set of every variant of T.

Source

pub fn only(value: T) -> Self

A set holding only value.

Source

pub const fn as_u64(self) -> u64

The raw bitmask.

Source

pub const fn from_u64_truncated(bits: u64) -> Self

Build a set from a raw bitmask, discarding bits that name no variant.

Source

pub const fn len(self) -> usize

Number of variants in the set.

Source

pub const fn is_empty(self) -> bool

Whether the set holds no variants.

Source

pub fn contains(self, value: T) -> bool

Whether value is in the set.

Source

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

Add value, returning whether it was newly added.

Source

pub fn remove(&mut self, value: T) -> bool

Remove value, returning whether it had been present.

Source

pub fn clear(&mut self)

Remove every variant.

Source

pub const fn union(self, other: Self) -> Self

Variants in either set.

Source

pub const fn intersection(self, other: Self) -> Self

Variants in both sets.

Source

pub const fn difference(self, other: Self) -> Self

Variants in self but not other.

Source

pub const fn symmetrical_difference(self, other: Self) -> Self

Variants in exactly one of the two sets.

Source

pub const fn complement(self) -> Self

Every variant not in the set.

Source

pub const fn is_subset(self, other: Self) -> bool

Whether every variant of self is in other.

Source

pub const fn is_superset(self, other: Self) -> bool

Whether every variant of other is in self.

Source

pub const fn is_disjoint(self, other: Self) -> bool

Whether the two sets share no variants.

Source

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>

Source§

type Output = EnumSet<T>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: EnumSet<T>) -> EnumSet<T>

Performs the & operation. Read more
Source§

impl<T: EnumSetType> BitAnd<T> for EnumSet<T>

Source§

type Output = EnumSet<T>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: T) -> EnumSet<T>

Performs the & operation. Read more
Source§

impl<T: EnumSetType> BitAndAssign for EnumSet<T>

Source§

fn bitand_assign(&mut self, other: EnumSet<T>)

Performs the &= operation. Read more
Source§

impl<T: EnumSetType> BitAndAssign<T> for EnumSet<T>

Source§

fn bitand_assign(&mut self, other: T)

Performs the &= operation. Read more
Source§

impl<T: EnumSetType> BitOr for EnumSet<T>

Source§

type Output = EnumSet<T>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: EnumSet<T>) -> EnumSet<T>

Performs the | operation. Read more
Source§

impl BitOr<EnumSet<AtomicUsage>> for AtomicUsage

Source§

type Output = EnumSet<AtomicUsage>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: EnumSet<AtomicUsage>) -> EnumSet<AtomicUsage>

Performs the | operation. Read more
Source§

impl BitOr<EnumSet<ComplexUsage>> for ComplexUsage

Source§

type Output = EnumSet<ComplexUsage>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: EnumSet<ComplexUsage>) -> EnumSet<ComplexUsage>

Performs the | operation. Read more
Source§

impl BitOr<EnumSet<FastMath>> for FastMath

Source§

type Output = EnumSet<FastMath>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: EnumSet<FastMath>) -> EnumSet<FastMath>

Performs the | operation. Read more
Source§

impl BitOr<EnumSet<Fp8Format>> for Fp8Format

Source§

type Output = EnumSet<Fp8Format>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: EnumSet<Fp8Format>) -> EnumSet<Fp8Format>

Performs the | operation. Read more
Source§

impl BitOr<EnumSet<Plane>> for Plane

Source§

type Output = EnumSet<Plane>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: EnumSet<Plane>) -> EnumSet<Plane>

Performs the | operation. Read more
Source§

impl BitOr<EnumSet<Tma>> for Tma

Source§

type Output = EnumSet<Tma>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: EnumSet<Tma>) -> EnumSet<Tma>

Performs the | operation. Read more
Source§

impl BitOr<EnumSet<TypeUsage>> for TypeUsage

Source§

type Output = EnumSet<TypeUsage>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: EnumSet<TypeUsage>) -> EnumSet<TypeUsage>

Performs the | operation. Read more
Source§

impl<T: EnumSetType> BitOr<T> for EnumSet<T>

Source§

type Output = EnumSet<T>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: T) -> EnumSet<T>

Performs the | operation. Read more
Source§

impl<T: EnumSetType> BitOrAssign for EnumSet<T>

Source§

fn bitor_assign(&mut self, other: EnumSet<T>)

Performs the |= operation. Read more
Source§

impl<T: EnumSetType> BitOrAssign<T> for EnumSet<T>

Source§

fn bitor_assign(&mut self, other: T)

Performs the |= operation. Read more
Source§

impl<T: EnumSetType> BitXor for EnumSet<T>

Source§

type Output = EnumSet<T>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: EnumSet<T>) -> EnumSet<T>

Performs the ^ operation. Read more
Source§

impl<T: EnumSetType> BitXor<T> for EnumSet<T>

Source§

type Output = EnumSet<T>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: T) -> EnumSet<T>

Performs the ^ operation. Read more
Source§

impl<T: EnumSetType> BitXorAssign for EnumSet<T>

Source§

fn bitxor_assign(&mut self, other: EnumSet<T>)

Performs the ^= operation. Read more
Source§

impl<T: EnumSetType> BitXorAssign<T> for EnumSet<T>

Source§

fn bitxor_assign(&mut self, other: T)

Performs the ^= operation. Read more
Source§

impl<T: EnumSetType> Clone for EnumSet<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: EnumSetType> Copy for EnumSet<T>

Source§

impl<T: EnumSetType + Debug> Debug for EnumSet<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: EnumSetType> Default for EnumSet<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

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>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T: EnumSetType> Eq for EnumSet<T>

Source§

impl<T: EnumSetType> Extend<T> for EnumSet<T>

Source§

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)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

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>

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl<T: EnumSetType> FromIterator<T> for EnumSet<T>

Source§

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>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: EnumSetType> IntoIterator for EnumSet<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = EnumSetIter<T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: EnumSetType> Not for EnumSet<T>

Source§

type Output = EnumSet<T>

The resulting type after applying the ! operator.
Source§

fn not(self) -> EnumSet<T>

Performs the unary ! operation. Read more
Source§

impl<T: EnumSetType> Ord for EnumSet<T>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl<T: EnumSetType> PartialEq for EnumSet<T>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: EnumSetType> PartialOrd for EnumSet<T>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: EnumSetType> Serialize for EnumSet<T>

Available on crate feature serde only.
Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<T: EnumSetType> Sub for EnumSet<T>

Source§

type Output = EnumSet<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: EnumSet<T>) -> EnumSet<T>

Performs the - operation. Read more
Source§

impl<T: EnumSetType> Sub<T> for EnumSet<T>

Source§

type Output = EnumSet<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: T) -> EnumSet<T>

Performs the - operation. Read more
Source§

impl<T: EnumSetType> SubAssign for EnumSet<T>

Source§

fn sub_assign(&mut self, other: EnumSet<T>)

Performs the -= operation. Read more
Source§

impl<T: EnumSetType> SubAssign<T> for EnumSet<T>

Source§

fn sub_assign(&mut self, other: T)

Performs the -= operation. Read more
Source§

impl<T: TypeHash + EnumSetType> TypeHash for EnumSet<T>

Source§

fn write_hash(hasher: &mut impl Hasher)

Write the structure of the type to the hasher
Source§

fn type_hash() -> u128

Generate a stable hash of the type structure. Read more

Auto Trait Implementations§

§

impl<T> Freeze for EnumSet<T>
where PhantomData<T>: Freeze,

§

impl<T> RefUnwindSafe for EnumSet<T>

§

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>

§

impl<T> UnwindSafe for EnumSet<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

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

Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> StoreKey for T

Source§

impl<T> StoreValue for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.