Struct impl_tools_lib::generics::Generics
source · 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 an item
This is a custom variant of syn::Generics
which supports trait as a parameter bound.
Fields§
§lt_token: Option<Lt><
params: Punctuated<GenericParam, Comma>Parameters
gt_token: Option<Gt>>
where_clause: Option<WhereClause>where bounds
Implementations§
source§impl Generics
impl Generics
sourcepub fn impl_generics(
self,
item_generics: &Generics,
subst: &TokenStream
) -> (TokenStream, TokenStream)
pub fn impl_generics(
self,
item_generics: &Generics,
subst: &TokenStream
) -> (TokenStream, TokenStream)
Generate (impl_generics, where_clause) tokens
Combines generics from self and item_generics.
This is the equivalent of the first and third items output by
syn::Generics::split_for_impl. Any instance of trait as a parameter
bound is replaced by subst.
Note: use ty_generics from syn::Generics::split_for_impl or
Self::ty_generics as appropriate.
sourcepub fn ty_generics(&self, item_generics: &Generics) -> TokenStream
pub fn ty_generics(&self, item_generics: &Generics) -> TokenStream
Generate ty_generics tokens
Combines generics from self and item_generics.
This is the equivalent to the second item output by
syn::Generics::split_for_impl.
Trait Implementations§
source§impl ToTokensSubst for Generics
impl ToTokensSubst for Generics
source§fn to_tokens_subst(&self, tokens: &mut TokenStream, subst: &TokenStream)
fn to_tokens_subst(&self, tokens: &mut TokenStream, subst: &TokenStream)
Write
self to the given TokenStream