darling_core/
from_generics.rsuse syn::Generics;
use crate::Result;
pub trait FromGenerics: Sized {
fn from_generics(generics: &Generics) -> Result<Self>;
}
impl FromGenerics for () {
fn from_generics(_generics: &Generics) -> Result<Self> {
Ok(())
}
}
impl FromGenerics for Generics {
fn from_generics(generics: &Generics) -> Result<Self> {
Ok(generics.clone())
}
}
impl<T: FromGenerics> FromGenerics for Result<T> {
fn from_generics(generics: &Generics) -> Result<Self> {
Ok(FromGenerics::from_generics(generics))
}
}