use syn::Variant;
use crate::Result;
pub trait FromVariant: Sized {
fn from_variant(variant: &Variant) -> Result<Self>;
}
impl FromVariant for () {
fn from_variant(_: &Variant) -> Result<Self> {
Ok(())
}
}
impl FromVariant for Variant {
fn from_variant(variant: &Variant) -> Result<Self> {
Ok(variant.clone())
}
}
impl FromVariant for syn::Ident {
fn from_variant(variant: &Variant) -> Result<Self> {
Ok(variant.ident.clone())
}
}
impl FromVariant for Vec<syn::Attribute> {
fn from_variant(variant: &Variant) -> Result<Self> {
Ok(variant.attrs.clone())
}
}