#[non_exhaustive]pub enum Enum<const LEN: usize, A, B, C = (), D = (), E = (), F = (), G = (), H = (), I = (), J = (), K = (), L = ()> {
A(A),
B(B),
C(C),
D(D),
E(E),
F(F),
G(G),
H(H),
I(I),
J(J),
K(K),
L(L),
}
Expand description
A generic, parameterized enum for expressing structured alternatives.
Variants are expected to be contiguous, meaning ()
(unit types)
should only appear at the end.
The first variant (A
) is considered the default,
implementing Default
when A: Default
.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
A(A)
The 1st variant (default).
B(B)
The 2nd variant.
C(C)
The 3rd variant.
D(D)
The 4th variant.
E(E)
The 5th variant.
F(F)
The 6th variant.
G(G)
The 7th variant.
H(H)
The 8th variant.
I(I)
The 9th variant.
J(J)
The 10th variant.
K(K)
The 11th variant.
L(L)
The 12th variant.
Implementations§
Source§impl<const LEN: usize, A, B, C, D, E, F, G, H, I, J, K, L> Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
§Structural methods.
impl<const LEN: usize, A, B, C, D, E, F, G, H, I, J, K, L> Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
§Structural methods.
Sourcepub const MAX_ARITY: usize = 12usize
pub const MAX_ARITY: usize = 12usize
The maximum number of generic type parameters in this enum.
Sourcepub const fn variant_index(&self) -> usize
pub const fn variant_index(&self) -> usize
Returns the current variant index (0-based).
Sourcepub const fn is_variant_index(&self, index: usize) -> bool
pub const fn is_variant_index(&self, index: usize) -> bool
Checks whether the current variant is at index
(0-based).
Sourcepub const fn variant_name(&self) -> &'static str ⓘ
pub const fn variant_name(&self) -> &'static str ⓘ
Returns the current variant name.
Sourcepub const fn is_variant_name(&self, name: &str) -> bool
pub const fn is_variant_name(&self, name: &str) -> bool
Checks whether the current variant has the given name
.
Source§impl<const LEN: usize, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static, G: 'static, H: 'static, I: 'static, J: 'static, K: 'static, L: 'static> Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static, G: 'static, H: 'static, I: 'static, J: 'static, K: 'static, L: 'static> Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
Source§impl<const LEN: usize, A: Clone, B: Clone, C: Clone, D: Clone, E: Clone, F: Clone, G: Clone, H: Clone, I: Clone, J: Clone, K: Clone, L: Clone> Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
§Conversion methods.
impl<const LEN: usize, A: Clone, B: Clone, C: Clone, D: Clone, E: Clone, F: Clone, G: Clone, H: Clone, I: Clone, J: Clone, K: Clone, L: Clone> Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
§Conversion methods.
Sourcepub fn into_tuple_options(
self,
) -> (Option<A>, Option<B>, Option<C>, Option<D>, Option<E>, Option<F>, Option<G>, Option<H>, Option<I>, Option<J>, Option<K>, Option<L>) ⓘ
pub fn into_tuple_options( self, ) -> (Option<A>, Option<B>, Option<C>, Option<D>, Option<E>, Option<F>, Option<G>, Option<H>, Option<I>, Option<J>, Option<K>, Option<L>) ⓘ
Returns a tuple with Some(value)
for the active variant and None
elsewhere.
Sourcepub fn into_tuple_defaults(self) -> (A, B, C, D, E, F, G, H, I, J, K, L) ⓘ
pub fn into_tuple_defaults(self) -> (A, B, C, D, E, F, G, H, I, J, K, L) ⓘ
Returns a tuple with the active variant’s inner value in its corresponding position
and Default::default()
for all others.
Source§impl<const LEN: usize, A, B, C, D, E, F, G, H, I, J, K, L> Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A, B, C, D, E, F, G, H, I, J, K, L> Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
Source§impl<const LEN: usize, A, B, C, D, E, F, G, H, I, J, K, L> Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
§Variant-specific methods.
impl<const LEN: usize, A, B, C, D, E, F, G, H, I, J, K, L> Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
§Variant-specific methods.
Sourcepub fn as_mut_a(&mut self) -> Option<&mut A> ⓘ
pub fn as_mut_a(&mut self) -> Option<&mut A> ⓘ
Returns a reference to the inner A
value, if present.
Sourcepub fn as_mut_b(&mut self) -> Option<&mut B> ⓘ
pub fn as_mut_b(&mut self) -> Option<&mut B> ⓘ
Returns a reference to the inner B
value, if present.
Sourcepub fn as_mut_c(&mut self) -> Option<&mut C> ⓘ
pub fn as_mut_c(&mut self) -> Option<&mut C> ⓘ
Returns a reference to the inner C
value, if present.
Sourcepub fn as_mut_d(&mut self) -> Option<&mut D> ⓘ
pub fn as_mut_d(&mut self) -> Option<&mut D> ⓘ
Returns a reference to the inner D
value, if present.
Sourcepub fn as_mut_e(&mut self) -> Option<&mut E> ⓘ
pub fn as_mut_e(&mut self) -> Option<&mut E> ⓘ
Returns a reference to the inner E
value, if present.
Sourcepub fn as_mut_f(&mut self) -> Option<&mut F> ⓘ
pub fn as_mut_f(&mut self) -> Option<&mut F> ⓘ
Returns a reference to the inner F
value, if present.
Sourcepub fn as_mut_g(&mut self) -> Option<&mut G> ⓘ
pub fn as_mut_g(&mut self) -> Option<&mut G> ⓘ
Returns a reference to the inner G
value, if present.
Sourcepub fn as_mut_h(&mut self) -> Option<&mut H> ⓘ
pub fn as_mut_h(&mut self) -> Option<&mut H> ⓘ
Returns a reference to the inner H
value, if present.
Sourcepub fn as_mut_i(&mut self) -> Option<&mut I> ⓘ
pub fn as_mut_i(&mut self) -> Option<&mut I> ⓘ
Returns a reference to the inner I
value, if present.
Sourcepub fn as_mut_j(&mut self) -> Option<&mut J> ⓘ
pub fn as_mut_j(&mut self) -> Option<&mut J> ⓘ
Returns a reference to the inner J
value, if present.
Sourcepub fn as_mut_k(&mut self) -> Option<&mut K> ⓘ
pub fn as_mut_k(&mut self) -> Option<&mut K> ⓘ
Returns a reference to the inner K
value, if present.
Sourcepub fn as_mut_l(&mut self) -> Option<&mut L> ⓘ
pub fn as_mut_l(&mut self) -> Option<&mut L> ⓘ
Returns a reference to the inner L
value, if present.
Sourcepub fn map_a<NEW>(
self,
f: impl FnOnce(A) -> NEW,
) -> Enum<LEN, NEW, B, C, D, E, F, G, H, I, J, K, L>
pub fn map_a<NEW>( self, f: impl FnOnce(A) -> NEW, ) -> Enum<LEN, NEW, B, C, D, E, F, G, H, I, J, K, L>
Transforms the inner A
value using f
, leaving other variants unchanged.
Sourcepub fn map_b<NEW>(
self,
f: impl FnOnce(B) -> NEW,
) -> Enum<LEN, A, NEW, C, D, E, F, G, H, I, J, K, L>
pub fn map_b<NEW>( self, f: impl FnOnce(B) -> NEW, ) -> Enum<LEN, A, NEW, C, D, E, F, G, H, I, J, K, L>
Transforms the inner B
value using f
, leaving other variants unchanged.
Sourcepub fn map_c<NEW>(
self,
f: impl FnOnce(C) -> NEW,
) -> Enum<LEN, A, B, NEW, D, E, F, G, H, I, J, K, L>
pub fn map_c<NEW>( self, f: impl FnOnce(C) -> NEW, ) -> Enum<LEN, A, B, NEW, D, E, F, G, H, I, J, K, L>
Transforms the inner C
value using f
, leaving other variants unchanged.
Sourcepub fn map_d<NEW>(
self,
f: impl FnOnce(D) -> NEW,
) -> Enum<LEN, A, B, C, NEW, E, F, G, H, I, J, K, L>
pub fn map_d<NEW>( self, f: impl FnOnce(D) -> NEW, ) -> Enum<LEN, A, B, C, NEW, E, F, G, H, I, J, K, L>
Transforms the inner D
value using f
, leaving other variants unchanged.
Sourcepub fn map_e<NEW>(
self,
f: impl FnOnce(E) -> NEW,
) -> Enum<LEN, A, B, C, D, NEW, F, G, H, I, J, K, L>
pub fn map_e<NEW>( self, f: impl FnOnce(E) -> NEW, ) -> Enum<LEN, A, B, C, D, NEW, F, G, H, I, J, K, L>
Transforms the inner E
value using f
, leaving other variants unchanged.
Sourcepub fn map_f<NEW>(
self,
f: impl FnOnce(F) -> NEW,
) -> Enum<LEN, A, B, C, D, E, NEW, G, H, I, J, K, L>
pub fn map_f<NEW>( self, f: impl FnOnce(F) -> NEW, ) -> Enum<LEN, A, B, C, D, E, NEW, G, H, I, J, K, L>
Transforms the inner F
value using f
, leaving other variants unchanged.
Sourcepub fn map_g<NEW>(
self,
f: impl FnOnce(G) -> NEW,
) -> Enum<LEN, A, B, C, D, E, F, NEW, H, I, J, K, L>
pub fn map_g<NEW>( self, f: impl FnOnce(G) -> NEW, ) -> Enum<LEN, A, B, C, D, E, F, NEW, H, I, J, K, L>
Transforms the inner G
value using f
, leaving other variants unchanged.
Sourcepub fn map_h<NEW>(
self,
f: impl FnOnce(H) -> NEW,
) -> Enum<LEN, A, B, C, D, E, F, G, NEW, I, J, K, L>
pub fn map_h<NEW>( self, f: impl FnOnce(H) -> NEW, ) -> Enum<LEN, A, B, C, D, E, F, G, NEW, I, J, K, L>
Transforms the inner H
value using f
, leaving other variants unchanged.
Sourcepub fn map_i<NEW>(
self,
f: impl FnOnce(I) -> NEW,
) -> Enum<LEN, A, B, C, D, E, F, G, H, NEW, J, K, L>
pub fn map_i<NEW>( self, f: impl FnOnce(I) -> NEW, ) -> Enum<LEN, A, B, C, D, E, F, G, H, NEW, J, K, L>
Transforms the inner I
value using f
, leaving other variants unchanged.
Sourcepub fn map_j<NEW>(
self,
f: impl FnOnce(J) -> NEW,
) -> Enum<LEN, A, B, C, D, E, F, G, H, I, NEW, K, L>
pub fn map_j<NEW>( self, f: impl FnOnce(J) -> NEW, ) -> Enum<LEN, A, B, C, D, E, F, G, H, I, NEW, K, L>
Transforms the inner J
value using f
, leaving other variants unchanged.
Trait Implementations§
Source§impl<const LEN: usize, A: Clone, B: Clone, C: Clone, D: Clone, E: Clone, F: Clone, G: Clone, H: Clone, I: Clone, J: Clone, K: Clone, L: Clone> Clone for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A: Clone, B: Clone, C: Clone, D: Clone, E: Clone, F: Clone, G: Clone, H: Clone, I: Clone, J: Clone, K: Clone, L: Clone> Clone for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
Source§impl<const LEN: usize, A: ConstDefault, B, C, D, E, F, G, H, I, J, K, L> ConstDefault for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A: ConstDefault, B, C, D, E, F, G, H, I, J, K, L> ConstDefault for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
Source§impl<const LEN: usize, A: Debug, B: Debug, C: Debug, D: Debug, E: Debug, F: Debug, G: Debug, H: Debug, I: Debug, J: Debug, K: Debug, L: Debug> Debug for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A: Debug, B: Debug, C: Debug, D: Debug, E: Debug, F: Debug, G: Debug, H: Debug, I: Debug, J: Debug, K: Debug, L: Debug> Debug for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
Source§impl<const LEN: usize, A: Default, B, C, D, E, F, G, H, I, J, K, L> Default for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A: Default, B, C, D, E, F, G, H, I, J, K, L> Default for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
Source§impl<const LEN: usize, A: Hash, B: Hash, C: Hash, D: Hash, E: Hash, F: Hash, G: Hash, H: Hash, I: Hash, J: Hash, K: Hash, L: Hash> Hash for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A: Hash, B: Hash, C: Hash, D: Hash, E: Hash, F: Hash, G: Hash, H: Hash, I: Hash, J: Hash, K: Hash, L: Hash> Hash for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
Source§impl<const LEN: usize, A: PartialEq, B: PartialEq, C: PartialEq, D: PartialEq, E: PartialEq, F: PartialEq, G: PartialEq, H: PartialEq, I: PartialEq, J: PartialEq, K: PartialEq, L: PartialEq> PartialEq for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A: PartialEq, B: PartialEq, C: PartialEq, D: PartialEq, E: PartialEq, F: PartialEq, G: PartialEq, H: PartialEq, I: PartialEq, J: PartialEq, K: PartialEq, L: PartialEq> PartialEq for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A: Copy, B: Copy, C: Copy, D: Copy, E: Copy, F: Copy, G: Copy, H: Copy, I: Copy, J: Copy, K: Copy, L: Copy> Copy for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A: Eq, B: Eq, C: Eq, D: Eq, E: Eq, F: Eq, G: Eq, H: Eq, I: Eq, J: Eq, K: Eq, L: Eq> Eq for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A, B, C, D, E, F, G, H, I, J, K, L> StructuralPartialEq for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
Auto Trait Implementations§
impl<const LEN: usize, A, B, C, D, E, F, G, H, I, J, K, L> Freeze for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A, B, C, D, E, F, G, H, I, J, K, L> RefUnwindSafe for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>where
A: RefUnwindSafe,
B: RefUnwindSafe,
C: RefUnwindSafe,
D: RefUnwindSafe,
E: RefUnwindSafe,
F: RefUnwindSafe,
G: RefUnwindSafe,
H: RefUnwindSafe,
I: RefUnwindSafe,
J: RefUnwindSafe,
K: RefUnwindSafe,
L: RefUnwindSafe,
impl<const LEN: usize, A, B, C, D, E, F, G, H, I, J, K, L> Send for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A, B, C, D, E, F, G, H, I, J, K, L> Sync for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A, B, C, D, E, F, G, H, I, J, K, L> Unpin for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>
impl<const LEN: usize, A, B, C, D, E, F, G, H, I, J, K, L> UnwindSafe for Enum<LEN, A, B, C, D, E, F, G, H, I, J, K, L>where
A: UnwindSafe,
B: UnwindSafe,
C: UnwindSafe,
D: UnwindSafe,
E: UnwindSafe,
F: UnwindSafe,
G: UnwindSafe,
H: UnwindSafe,
I: UnwindSafe,
J: UnwindSafe,
K: UnwindSafe,
L: 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
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, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> ExtAny for T
impl<T> ExtAny 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§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem 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.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
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> ⓘ
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> ⓘ
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