Debian Codegraph @

third_party/rust/darling_core/src/from_generic_param.rs

raw
1 use 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.
5 pub trait FromGenericParam: Sized {
6 fn from_generic_param(param: &syn::GenericParam) -> Result<Self>;
7 }
8
9 impl FromGenericParam for () {
10 fn from_generic_param(_param: &syn::GenericParam) -> Result<Self> {
11 Ok(())
12 }
13 }
14
15 impl FromGenericParam for syn::GenericParam {
16 fn from_generic_param(param: &syn::GenericParam) -> Result<Self> {
17 Ok(param.clone())
18 }
19 }