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
Auto Trait Implementations§
impl Freeze for Generics
impl RefUnwindSafe for Generics
impl !Send for Generics
impl !Sync for Generics
impl Unpin for Generics
impl UnwindSafe for Generics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more