#[repr(u64)]pub enum EnumExample<'a, 'b, T>where
T: Clone,{
Variant0 = 1,
Variant1([u8; 3]),
Variant2(Box<Self>),
Variant3 {
some: [u8; 2],
other: u32,
},
Variant4(T, &'a str, &'b u32),
}Available on
doc or test only.Expand description
✨ ⌗ ∈
An example enum generated with enumset!.
It has an associated set EnumSetExample.
Variants§
Variant0 = 1
A default unit variant.
Variant1([u8; 3])
A tuple variant.
Variant2(Box<Self>)
Available on crate feature
std only.A self-referential tuple variant.
Variant3
A struct variant with discriminant.
Variant4(T, &'a str, &'b u32)
Supports generics and lifetimes.
Implementations§
Source§impl<'a, 'b, T> EnumExample<'a, 'b, T>where
T: Clone,
Classification helpers for EnumExample.
impl<'a, 'b, T> EnumExample<'a, 'b, T>where
T: Clone,
Classification helpers for EnumExample.
Sourcepub const fn is_data(&self) -> bool
pub const fn is_data(&self) -> bool
Returns whether this variant belongs to EnumSetExample::DATA.
Source§impl<'a, 'b, T> EnumExample<'a, 'b, T>where
T: Clone,
Small associated constants for EnumExample.
impl<'a, 'b, T> EnumExample<'a, 'b, T>where
T: Clone,
Small associated constants for EnumExample.
pub const HAS_CUSTOM_IMPLS: bool = true
Source§impl<'a, 'b, T> EnumExample<'a, 'b, T>where
T: Clone,
§Associated set methods
impl<'a, 'b, T> EnumExample<'a, 'b, T>where
T: Clone,
§Associated set methods
Sourcepub const VARIANTS: usize = _EnumExample_private::VARIANTS
pub const VARIANTS: usize = _EnumExample_private::VARIANTS
The total number of declared variants.
Sourcepub const fn empty_set() -> EnumSetExample
pub const fn empty_set() -> EnumSetExample
Returns the associated empty set.
Sourcepub const fn full_set() -> EnumSetExample
pub const fn full_set() -> EnumSetExample
Returns the associated full set.
Sourcepub const fn to_set(&self) -> EnumSetExample
pub const fn to_set(&self) -> EnumSetExample
Returns the singleton set for this variant.
Sourcepub const fn is_in(&self, set: EnumSetExample) -> bool
pub const fn is_in(&self, set: EnumSetExample) -> bool
Returns whether this variant belongs to set.
Trait Implementations§
Source§impl<'a, 'b, T> Clone for EnumExample<'a, 'b, T>
impl<'a, 'b, T> Clone for EnumExample<'a, 'b, T>
Source§fn clone(&self) -> EnumExample<'a, 'b, T>
fn clone(&self) -> EnumExample<'a, 'b, T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Clone> Default for EnumExample<'_, '_, T>
impl<T: Clone> Default for EnumExample<'_, '_, T>
Source§fn default() -> Self
fn default() -> Self
Returns EnumExample::Variant0.
Auto Trait Implementations§
impl<'a, 'b, T> Freeze for EnumExample<'a, 'b, T>where
T: Freeze,
impl<'a, 'b, T> RefUnwindSafe for EnumExample<'a, 'b, T>where
T: RefUnwindSafe,
impl<'a, 'b, T> Send for EnumExample<'a, 'b, T>where
T: Send,
impl<'a, 'b, T> Sync for EnumExample<'a, 'b, T>where
T: Sync,
impl<'a, 'b, T> Unpin for EnumExample<'a, 'b, T>where
T: Unpin,
impl<'a, 'b, T> UnsafeUnpin for EnumExample<'a, 'b, T>where
T: UnsafeUnpin,
impl<'a, 'b, T> UnwindSafe for EnumExample<'a, 'b, T>where
T: UnwindSafe,
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
Returns a deterministic hash of the
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,
Available on crate feature
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
Mutably borrows from an owned value. Read more
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
The alignment of this type in bytes.
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Returns the alignment of this type in bytes.
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<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Know whether dropping values of this type matters, in compile-time.
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Returns the minimum alignment of the type in bytes. Read more
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Returns the alignment of the pointed-to value in bytes. Read more
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Returns the size of a type in bytes. Read more
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Returns the size of the pointed-to value in bytes. Read more
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
Returns
true if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
Forgets about
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
Available on crate feature
unsafe_layout only.Returns the value of type
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
Available on crate feature
unsafe_layout only.Returns the value of type
T represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
Available on crate feature
unsafe_slice only.