Struct valuable::VariantDef[][src]

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.

Implementations

Creates a new VariantDef instance.

Examples
use valuable::{Fields, VariantDef};

let def = VariantDef::new("Foo", Fields::Unnamed(2));

Returns the variant’s name

Examples
use valuable::{Fields, VariantDef};

let def = VariantDef::new("Foo", Fields::Unnamed(2));
assert_eq!("Foo", def.name());

Returns the variant’s fields

Examples
use valuable::{Fields, VariantDef};

let def = VariantDef::new("Foo", Fields::Unnamed(3));
assert!(matches!(def.fields(), Fields::Unnamed(_)));

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.