Variation
A procedural macro to generate enum to variant conversion methods.
Methods generated
is_*
methods
An is_variant
method is generated for each for variant in an enum.
use Variation;
as_*
& as_*_mut
methods
Variants that have one or more inner types have as
and as_mut
allowing you
to get a immutable or mutable reference to the inner types. Variants with a
single inner type will return &{mut} T
. Variants that have more than one inner
type will return a tuple with a reference to each type.
use Variation;
into_*
methods
Variants that have one or more inner types have an into
method, allowing you
to attempt to convert a enum into its inner values. This method will panic when
called on a variant that does not match the method.
use Variation;