pub struct VariantId { /* private fields */ }๐ฌThis is a nightly-only experimental API. (
type_info)Expand description
Variant representing type ID. Representing a variant of an enum.
Implementationsยง
Sourceยงimpl VariantId
impl VariantId
Sourcepub const fn name(self) -> &'static str
๐ฌThis is a nightly-only experimental API. (type_info)
pub const fn name(self) -> &'static str
type_info)Returns the name of the variant.
#![feature(type_info)]
use std::any::TypeId;
enum Enum {
Unit,
Tuple(bool),
Struct { a: bool },
}
assert_eq!(
const { TypeId::of::<Enum>().variant(1).name() },
"Tuple",
);Sourcepub const fn non_exhaustive(self) -> bool
๐ฌThis is a nightly-only experimental API. (type_info)
pub const fn non_exhaustive(self) -> bool
type_info)Returns whether this variant is marked with #[non_exhaustive].
Trait Implementationsยง
impl Copy for VariantId
impl Eq for VariantId
Sourceยงimpl Ord for VariantId
impl Ord for VariantId
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
Sourceยงimpl PartialOrd for VariantId
impl PartialOrd for VariantId
impl StructuralPartialEq for VariantId
Auto Trait Implementationsยง
impl Freeze for VariantId
impl RefUnwindSafe for VariantId
impl Send for VariantId
impl Sync for VariantId
impl Unpin for VariantId
impl UnsafeUnpin for VariantId
impl UnwindSafe for VariantId
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