Trait darling::ast::GenericParamExt [−][src]
pub trait GenericParamExt { type TypeParam; type LifetimeDef; type ConstParam; pub fn as_type_param(&self) -> Option<&Self::TypeParam> { ... } pub fn as_lifetime_def(&self) -> Option<&Self::LifetimeDef> { ... } pub fn as_const_param(&self) -> Option<&Self::ConstParam> { ... } }
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.
Associated Types
type TypeParam
[src]
The type this GenericParam uses to represent type params and their bounds
type LifetimeDef
[src]
type ConstParam
[src]
Provided methods
pub fn as_type_param(&self) -> Option<&Self::TypeParam>
[src]
If this GenericParam is a type param, get the underlying value.
pub fn as_lifetime_def(&self) -> Option<&Self::LifetimeDef>
[src]
If this GenericParam is a lifetime, get the underlying value.
pub fn as_const_param(&self) -> Option<&Self::ConstParam>
[src]
If this GenericParam is a const param, get the underlying value.
Implementations on Foreign Types
impl GenericParamExt for TypeParam
[src]
impl GenericParamExt for TypeParam
[src]type TypeParam = TypeParam
type LifetimeDef = ()
type ConstParam = ()
pub fn as_type_param(
&self
) -> Option<&<TypeParam as GenericParamExt>::TypeParam>
[src]
&self
) -> Option<&<TypeParam as GenericParamExt>::TypeParam>
impl GenericParamExt for GenericParam
[src]
impl GenericParamExt for GenericParam
[src]type TypeParam = TypeParam
type LifetimeDef = LifetimeDef
type ConstParam = ConstParam
pub fn as_type_param(
&self
) -> Option<&<GenericParam as GenericParamExt>::TypeParam>
[src]
&self
) -> Option<&<GenericParam as GenericParamExt>::TypeParam>
pub fn as_lifetime_def(
&self
) -> Option<&<GenericParam as GenericParamExt>::LifetimeDef>
[src]
&self
) -> Option<&<GenericParam as GenericParamExt>::LifetimeDef>
pub fn as_const_param(
&self
) -> Option<&<GenericParam as GenericParamExt>::ConstParam>
[src]
&self
) -> Option<&<GenericParam as GenericParamExt>::ConstParam>
Implementors
impl<T, L, C> GenericParamExt for darling::ast::GenericParam<T, L, C>
[src]
impl<T, L, C> GenericParamExt for darling::ast::GenericParam<T, L, C>
[src]