1use crate::Result;
2
3/// Creates an instance by parsing a specific `syn::GenericParam`.
4/// This can be a type param, a lifetime, or a const param.
5pub trait FromGenericParam: Sized {
6 fn from_generic_param(param: &syn::GenericParam) -> Result<Self>;
7}
8
9impl FromGenericParam for () {
10 fn from_generic_param(_param: &syn::GenericParam) -> Result<Self> {
11 Ok(())
12 }
13}
14
15impl FromGenericParam for syn::GenericParam {
16 fn from_generic_param(param: &syn::GenericParam) -> Result<Self> {
17 Ok(param.clone())
18 }
19}
20