Trait darling::ast::GenericParamExt
source · pub trait GenericParamExt {
type TypeParam;
type LifetimeParam;
type ConstParam;
// Provided methods
fn as_type_param(&self) -> Option<&Self::TypeParam> { ... }
fn as_lifetime_param(&self) -> Option<&Self::LifetimeParam> { ... }
fn as_const_param(&self) -> Option<&Self::ConstParam> { ... }
}
Expand description
Extension trait for GenericParam
to support getting values by variant.
§Usage
darling::ast::Generics
needs a way to test its params array in order to iterate over type params.
Rather than require callers to use darling::ast::GenericParam
in all cases, this trait makes that
polymorphic.
Required Associated Types§
type LifetimeParam
type ConstParam
Provided Methods§
sourcefn as_type_param(&self) -> Option<&Self::TypeParam>
fn as_type_param(&self) -> Option<&Self::TypeParam>
If this GenericParam is a type param, get the underlying value.
sourcefn as_lifetime_param(&self) -> Option<&Self::LifetimeParam>
fn as_lifetime_param(&self) -> Option<&Self::LifetimeParam>
If this GenericParam is a lifetime, get the underlying value.
sourcefn as_const_param(&self) -> Option<&Self::ConstParam>
fn as_const_param(&self) -> Option<&Self::ConstParam>
If this GenericParam is a const param, get the underlying value.