pub struct Generics {
pub lt_token: Option<Lt>,
pub params: Punctuated<GenericParam, Comma>,
pub gt_token: Option<Gt>,
pub where_clause: Option<WhereClause>,
}
Expand description
Lifetimes and type parameters attached to a declaration of a function, enum, trait, etc.
This struct represents two distinct optional syntactic elements, generic parameters and where clause. In some locations of the grammar, there may be other tokens in between these two things.
Fields§
§lt_token: Option<Lt>
§params: Punctuated<GenericParam, Comma>
§gt_token: Option<Gt>
§where_clause: Option<WhereClause>
Implementations§
source§impl Generics
impl Generics
sourcepub fn lifetimes(&self) -> Lifetimes<'_>
pub fn lifetimes(&self) -> Lifetimes<'_>
Returns an
Iterator<Item = &
LifetimeParam
>
over the lifetime parameters in self.params
.
sourcepub fn lifetimes_mut(&mut self) -> LifetimesMut<'_>
pub fn lifetimes_mut(&mut self) -> LifetimesMut<'_>
Returns an
Iterator<Item = &mut
LifetimeParam
>
over the lifetime parameters in self.params
.
sourcepub fn type_params(&self) -> TypeParams<'_>
pub fn type_params(&self) -> TypeParams<'_>
Returns an
Iterator<Item = &
TypeParam
>
over the type parameters in self.params
.
sourcepub fn type_params_mut(&mut self) -> TypeParamsMut<'_>
pub fn type_params_mut(&mut self) -> TypeParamsMut<'_>
Returns an
Iterator<Item = &mut
TypeParam
>
over the type parameters in self.params
.
sourcepub fn const_params(&self) -> ConstParams<'_>
pub fn const_params(&self) -> ConstParams<'_>
Returns an
Iterator<Item = &
ConstParam
>
over the constant parameters in self.params
.
sourcepub fn const_params_mut(&mut self) -> ConstParamsMut<'_>
pub fn const_params_mut(&mut self) -> ConstParamsMut<'_>
Returns an
Iterator<Item = &mut
ConstParam
>
over the constant parameters in self.params
.
sourcepub fn make_where_clause(&mut self) -> &mut WhereClause
pub fn make_where_clause(&mut self) -> &mut WhereClause
Initializes an empty where
-clause if there is not one present already.