pub struct VariantDef<'a> { /* fields omitted */ }
Expand description
An enum variant definition.
Included with EnumDef
returned by Enumerable::definition()
,
VariantDef
provides the caller with information about a specific variant.
Creates a new VariantDef
instance.
use valuable::{Fields, VariantDef};
let def = VariantDef::new("Foo", Fields::Unnamed(2));
Returns the variant’s name
use valuable::{Fields, VariantDef};
let def = VariantDef::new("Foo", Fields::Unnamed(2));
assert_eq!("Foo", def.name());
Returns the variant’s fields
use valuable::{Fields, VariantDef};
let def = VariantDef::new("Foo", Fields::Unnamed(3));
assert!(matches!(def.fields(), Fields::Unnamed(_)));
Formats the value using the given formatter. Read more
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.