From

Derive Macro From 

Source
#[derive(From)]
{
    // Attributes available to this derive:
    #[convert_enum]
}
Expand description

Automatically generate From implementations for enum variants, ignoring ones marked #[convert_enum(optout)].

All variants not affected by the opt-out must be tuple-like variants with exactly one field. A variant of the form E::V(T) will cause the generation of the following code:

impl From<T> for E {
    fn from(val: T) -> Self {
        Self::V(val)
    }
}