pub struct EnumSetExample { /* private fields */ }Expand description
✨ ⌗ ⊆
An example set of enum variants, generated by enumset!.
📍 data/codec/bin::EnumSetExample
📦 size_of::<EnumSetExample>() == 1 bytes / 8 bits
⚗️Option<T> ❗🟰 T
Represents a set of EnumExample variants.
Implementations§
Source§impl EnumSetExample
Named subsets.
impl EnumSetExample
Named subsets.
Sourcepub const BORROW_OR_ALLOC: Self
pub const BORROW_OR_ALLOC: Self
Variants that can hold either borrowed or allocated data.
Source§impl EnumSetExample
Named constants
impl EnumSetExample
Named constants
Source§impl EnumSetExample
Convenience methods derived from each named constant.
impl EnumSetExample
Convenience methods derived from each named constant.
Sourcepub const fn has_variant0(self) -> bool
pub const fn has_variant0(self) -> bool
Returns true if Variant0 is present.
Sourcepub const fn contains_variant0(self) -> bool
pub const fn contains_variant0(self) -> bool
Returns true if all bits in Variant0 are present.
Sourcepub const fn intersects_variant0(self) -> bool
pub const fn intersects_variant0(self) -> bool
Returns true if the set shares any bit with Variant0.
Sourcepub const fn with_variant0(self) -> Self
pub const fn with_variant0(self) -> Self
Returns self with Variant0 inserted.
Sourcepub const fn with_variant0_if(self, condition: bool) -> Self
pub const fn with_variant0_if(self, condition: bool) -> Self
Returns self with Variant0 inserted if condition is true.
Sourcepub const fn without_variant0(self) -> Self
pub const fn without_variant0(self) -> Self
Returns self with Variant0 removed.
Sourcepub const fn set_variant0(&mut self)
pub const fn set_variant0(&mut self)
Sets Variant0.
Sourcepub const fn set_variant0_if(&mut self, condition: bool)
pub const fn set_variant0_if(&mut self, condition: bool)
Sets Variant0 if condition is true.
Sourcepub const fn unset_variant0(&mut self)
pub const fn unset_variant0(&mut self)
Unsets Variant0.
Sourcepub const fn has_variant1(self) -> bool
pub const fn has_variant1(self) -> bool
Returns true if Variant1 is present.
Sourcepub const fn contains_variant1(self) -> bool
pub const fn contains_variant1(self) -> bool
Returns true if all bits in Variant1 are present.
Sourcepub const fn intersects_variant1(self) -> bool
pub const fn intersects_variant1(self) -> bool
Returns true if the set shares any bit with Variant1.
Sourcepub const fn with_variant1(self) -> Self
pub const fn with_variant1(self) -> Self
Returns self with Variant1 inserted.
Sourcepub const fn with_variant1_if(self, condition: bool) -> Self
pub const fn with_variant1_if(self, condition: bool) -> Self
Returns self with Variant1 inserted if condition is true.
Sourcepub const fn without_variant1(self) -> Self
pub const fn without_variant1(self) -> Self
Returns self with Variant1 removed.
Sourcepub const fn set_variant1(&mut self)
pub const fn set_variant1(&mut self)
Sets Variant1.
Sourcepub const fn set_variant1_if(&mut self, condition: bool)
pub const fn set_variant1_if(&mut self, condition: bool)
Sets Variant1 if condition is true.
Sourcepub const fn unset_variant1(&mut self)
pub const fn unset_variant1(&mut self)
Unsets Variant1.
Sourcepub const fn has_variant2(self) -> bool
pub const fn has_variant2(self) -> bool
Returns true if Variant2 is present.
Sourcepub const fn contains_variant2(self) -> bool
pub const fn contains_variant2(self) -> bool
Returns true if all bits in Variant2 are present.
Sourcepub const fn intersects_variant2(self) -> bool
pub const fn intersects_variant2(self) -> bool
Returns true if the set shares any bit with Variant2.
Sourcepub const fn with_variant2(self) -> Self
pub const fn with_variant2(self) -> Self
Returns self with Variant2 inserted.
Sourcepub const fn with_variant2_if(self, condition: bool) -> Self
pub const fn with_variant2_if(self, condition: bool) -> Self
Returns self with Variant2 inserted if condition is true.
Sourcepub const fn without_variant2(self) -> Self
pub const fn without_variant2(self) -> Self
Returns self with Variant2 removed.
Sourcepub const fn set_variant2(&mut self)
pub const fn set_variant2(&mut self)
Sets Variant2.
Sourcepub const fn set_variant2_if(&mut self, condition: bool)
pub const fn set_variant2_if(&mut self, condition: bool)
Sets Variant2 if condition is true.
Sourcepub const fn unset_variant2(&mut self)
pub const fn unset_variant2(&mut self)
Unsets Variant2.
Sourcepub const fn has_variant3(self) -> bool
pub const fn has_variant3(self) -> bool
Returns true if Variant3 is present.
Sourcepub const fn contains_variant3(self) -> bool
pub const fn contains_variant3(self) -> bool
Returns true if all bits in Variant3 are present.
Sourcepub const fn intersects_variant3(self) -> bool
pub const fn intersects_variant3(self) -> bool
Returns true if the set shares any bit with Variant3.
Sourcepub const fn with_variant3(self) -> Self
pub const fn with_variant3(self) -> Self
Returns self with Variant3 inserted.
Sourcepub const fn with_variant3_if(self, condition: bool) -> Self
pub const fn with_variant3_if(self, condition: bool) -> Self
Returns self with Variant3 inserted if condition is true.
Sourcepub const fn without_variant3(self) -> Self
pub const fn without_variant3(self) -> Self
Returns self with Variant3 removed.
Sourcepub const fn set_variant3(&mut self)
pub const fn set_variant3(&mut self)
Sets Variant3.
Sourcepub const fn set_variant3_if(&mut self, condition: bool)
pub const fn set_variant3_if(&mut self, condition: bool)
Sets Variant3 if condition is true.
Sourcepub const fn unset_variant3(&mut self)
pub const fn unset_variant3(&mut self)
Unsets Variant3.
Sourcepub const fn has_variant4(self) -> bool
pub const fn has_variant4(self) -> bool
Returns true if Variant4 is present.
Sourcepub const fn contains_variant4(self) -> bool
pub const fn contains_variant4(self) -> bool
Returns true if all bits in Variant4 are present.
Sourcepub const fn intersects_variant4(self) -> bool
pub const fn intersects_variant4(self) -> bool
Returns true if the set shares any bit with Variant4.
Sourcepub const fn with_variant4(self) -> Self
pub const fn with_variant4(self) -> Self
Returns self with Variant4 inserted.
Sourcepub const fn with_variant4_if(self, condition: bool) -> Self
pub const fn with_variant4_if(self, condition: bool) -> Self
Returns self with Variant4 inserted if condition is true.
Sourcepub const fn without_variant4(self) -> Self
pub const fn without_variant4(self) -> Self
Returns self with Variant4 removed.
Sourcepub const fn set_variant4(&mut self)
pub const fn set_variant4(&mut self)
Sets Variant4.
Sourcepub const fn set_variant4_if(&mut self, condition: bool)
pub const fn set_variant4_if(&mut self, condition: bool)
Sets Variant4 if condition is true.
Sourcepub const fn unset_variant4(&mut self)
pub const fn unset_variant4(&mut self)
Unsets Variant4.
Source§impl EnumSetExample
Common set methods
impl EnumSetExample
Common set methods
Source§impl EnumSetExample
Set operations
impl EnumSetExample
Set operations
Sourcepub const fn intersects(self, other: Self) -> bool
pub const fn intersects(self, other: Self) -> bool
Returns true if self and other share any bit.
Sourcepub const fn is_subset(self, other: Self) -> bool
pub const fn is_subset(self, other: Self) -> bool
Returns true if all bits in self are also set in other.
Sourcepub const fn is_superset(self, other: Self) -> bool
pub const fn is_superset(self, other: Self) -> bool
Returns true if all bits in other are also set in self.
Sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
Returns the intersection of self and other.
Sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
Returns the difference of self and other.
Sourcepub const fn symmetric_difference(self, other: Self) -> Self
pub const fn symmetric_difference(self, other: Self) -> Self
Returns the symmetric difference of self and other.
Source§impl EnumSetExample
Mutating set operations
impl EnumSetExample
Mutating set operations
Source§impl EnumSetExample
§Associated set methods
impl EnumSetExample
§Associated set methods
Sourcepub const fn contains_variant<'a, 'b, T>(
self,
value: &EnumExample<'a, 'b, T>,
) -> boolwhere
T: Clone,
pub const fn contains_variant<'a, 'b, T>(
self,
value: &EnumExample<'a, 'b, T>,
) -> boolwhere
T: Clone,
Returns true if the set contains the variant of value.
Sourcepub const fn has_variant<'a, 'b, T>(
self,
value: &EnumExample<'a, 'b, T>,
) -> boolwhere
T: Clone,
pub const fn has_variant<'a, 'b, T>(
self,
value: &EnumExample<'a, 'b, T>,
) -> boolwhere
T: Clone,
An alias of contains_variant.
Sourcepub const fn with_variant<'a, 'b, T>(
self,
value: &EnumExample<'a, 'b, T>,
) -> Selfwhere
T: Clone,
pub const fn with_variant<'a, 'b, T>(
self,
value: &EnumExample<'a, 'b, T>,
) -> Selfwhere
T: Clone,
Returns self with the variant of value inserted.
Sourcepub const fn without_variant<'a, 'b, T>(
self,
value: &EnumExample<'a, 'b, T>,
) -> Selfwhere
T: Clone,
pub const fn without_variant<'a, 'b, T>(
self,
value: &EnumExample<'a, 'b, T>,
) -> Selfwhere
T: Clone,
Returns self with the variant of value removed.
Sourcepub const fn toggled_variant<'a, 'b, T>(
self,
value: &EnumExample<'a, 'b, T>,
) -> Selfwhere
T: Clone,
pub const fn toggled_variant<'a, 'b, T>(
self,
value: &EnumExample<'a, 'b, T>,
) -> Selfwhere
T: Clone,
Returns self with the variant of value toggled.
Sourcepub const fn insert_variant<'a, 'b, T>(
&mut self,
value: &EnumExample<'a, 'b, T>,
)where
T: Clone,
pub const fn insert_variant<'a, 'b, T>(
&mut self,
value: &EnumExample<'a, 'b, T>,
)where
T: Clone,
Inserts the variant of value.
Sourcepub const fn remove_variant<'a, 'b, T>(
&mut self,
value: &EnumExample<'a, 'b, T>,
)where
T: Clone,
pub const fn remove_variant<'a, 'b, T>(
&mut self,
value: &EnumExample<'a, 'b, T>,
)where
T: Clone,
Removes the variant of value.
Sourcepub const fn toggle_variant<'a, 'b, T>(
&mut self,
value: &EnumExample<'a, 'b, T>,
)where
T: Clone,
pub const fn toggle_variant<'a, 'b, T>(
&mut self,
value: &EnumExample<'a, 'b, T>,
)where
T: Clone,
Toggles the variant of value.
Sourcepub fn for_each_set(self, f: impl FnMut(Self))
pub fn for_each_set(self, f: impl FnMut(Self))
Calls f for each associated set constant present in this set.
Sourcepub fn for_each_set_while(self, f: impl FnMut(Self) -> bool) -> bool
pub fn for_each_set_while(self, f: impl FnMut(Self) -> bool) -> bool
Calls f for each associated set constant present in this set while it returns true.
Returns true if all set constants were visited,
or false if iteration stopped early.
Trait Implementations§
Source§impl Binary for EnumSetExample
Formats the set as a binary mask over its declared bit domain.
impl Binary for EnumSetExample
Formats the set as a binary mask over its declared bit domain.
Source§impl BitAnd for EnumSetExample
impl BitAnd for EnumSetExample
Source§impl BitAndAssign for EnumSetExample
impl BitAndAssign for EnumSetExample
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&= operation. Read moreSource§impl BitOr for EnumSetExample
impl BitOr for EnumSetExample
Source§impl BitOrAssign for EnumSetExample
impl BitOrAssign for EnumSetExample
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|= operation. Read moreSource§impl BitSized<{ $Set::_SET_BIT_SIZE }> for EnumSetExample
impl BitSized<{ $Set::_SET_BIT_SIZE }> for EnumSetExample
Source§const BIT_SIZE: usize = _
const BIT_SIZE: usize = _
Source§const MIN_BYTE_SIZE: usize = _
const MIN_BYTE_SIZE: usize = _
Source§fn bit_size(&self) -> usize
fn bit_size(&self) -> usize
Source§fn min_byte_size(&self) -> usize
fn min_byte_size(&self) -> usize
Source§impl BitXor for EnumSetExample
impl BitXor for EnumSetExample
Source§impl BitXorAssign for EnumSetExample
impl BitXorAssign for EnumSetExample
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
^= operation. Read moreSource§impl Clone for EnumSetExample
impl Clone for EnumSetExample
Source§fn clone(&self) -> EnumSetExample
fn clone(&self) -> EnumSetExample
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ConstInit for EnumSetExample
impl ConstInit for EnumSetExample
impl Copy for EnumSetExample
Source§impl Debug for EnumSetExample
Formats the set as a prefixed binary mask over its declared bit domain.
impl Debug for EnumSetExample
Formats the set as a prefixed binary mask over its declared bit domain.
Source§impl DebugExt for EnumSetExamplewhere
EnumSetExample: Debug,
impl DebugExt for EnumSetExamplewhere
EnumSetExample: Debug,
Source§impl Default for EnumSetExample
impl Default for EnumSetExample
Source§impl Display for EnumSetExample
Formats the set as a prefixed binary mask over its declared bit domain.
impl Display for EnumSetExample
Formats the set as a prefixed binary mask over its declared bit domain.
impl Eq for EnumSetExample
Source§impl<'a, 'b, T> From<&EnumExample<'a, 'b, T>> for EnumSetExamplewhere
T: Clone,
impl<'a, 'b, T> From<&EnumExample<'a, 'b, T>> for EnumSetExamplewhere
T: Clone,
Source§fn from(value: &EnumExample<'a, 'b, T>) -> Self
fn from(value: &EnumExample<'a, 'b, T>) -> Self
Converts an enum value into its singleton variant set.
Source§impl<'a, 'b, T> From<EnumExample<'a, 'b, T>> for EnumSetExamplewhere
T: Clone,
impl<'a, 'b, T> From<EnumExample<'a, 'b, T>> for EnumSetExamplewhere
T: Clone,
Source§fn from(value: EnumExample<'a, 'b, T>) -> Self
fn from(value: EnumExample<'a, 'b, T>) -> Self
Converts an enum value into its singleton variant set.
Source§impl Hash for EnumSetExample
impl Hash for EnumSetExample
Source§impl LowerHex for EnumSetExample
Formats the set as a hexadecimal mask over its declared bit domain.
impl LowerHex for EnumSetExample
Formats the set as a hexadecimal mask over its declared bit domain.
Source§impl Not for EnumSetExample
impl Not for EnumSetExample
Source§impl Octal for EnumSetExample
Formats the set as an octal mask over its declared bit domain.
impl Octal for EnumSetExample
Formats the set as an octal mask over its declared bit domain.
Source§impl Ord for EnumSetExample
impl Ord for EnumSetExample
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for EnumSetExample
impl PartialEq for EnumSetExample
Source§impl PartialOrd for EnumSetExample
impl PartialOrd for EnumSetExample
Source§impl Sub for EnumSetExample
impl Sub for EnumSetExample
Source§impl SubAssign for EnumSetExample
impl SubAssign for EnumSetExample
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read moreAuto Trait Implementations§
impl Freeze for EnumSetExample
impl RefUnwindSafe for EnumSetExample
impl Send for EnumSetExample
impl Sync for EnumSetExample
impl Unpin for EnumSetExample
impl UnsafeUnpin for EnumSetExample
impl UnwindSafe for EnumSetExample
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId of Self using a custom hasher.Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
alloc only.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
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice only.