Struct Generics
struct Generics { ... }
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
impl Generics
fn lifetimes(self: &Self) -> Lifetimes<'_>Iterator over the lifetime parameters in
self.params.fn lifetimes_mut(self: &mut Self) -> LifetimesMut<'_>Iterator over the lifetime parameters in
self.params.fn type_params(self: &Self) -> TypeParams<'_>Iterator over the type parameters in
self.params.fn type_params_mut(self: &mut Self) -> TypeParamsMut<'_>Iterator over the type parameters in
self.params.fn const_params(self: &Self) -> ConstParams<'_>Iterator over the constant parameters in
self.params.fn const_params_mut(self: &mut Self) -> ConstParamsMut<'_>Iterator over the constant parameters in
self.params.fn make_where_clause(self: &mut Self) -> &mut WhereClauseInitializes an empty
where-clause if there is not one present already.fn split_for_impl(self: &Self) -> (ImplGenerics<'_>, TypeGenerics<'_>, Option<&WhereClause>)Split a type's generics into the pieces required for impl'ing a trait for that type.
# use ; # use quote; # # let generics: Generics = Defaultdefault; # let name = new; # let = generics.split_for_impl; quote! # ;
impl Clone for Generics
fn clone(self: &Self) -> Self
impl Debug for Generics
fn fmt(self: &Self, formatter: &mut Formatter<'_>) -> Result
impl Default for Generics
fn default() -> Self
impl Eq for Generics
impl Freeze for Generics
impl Hash for Generics
fn hash<H>(self: &Self, state: &mut H) where H: Hasher
impl Parse for Generics
fn parse(input: ParseStream<'_>) -> Result<Self>
impl PartialEq for Generics
fn eq(self: &Self, other: &Self) -> bool
impl RefUnwindSafe for Generics
impl Send for Generics
impl Sync for Generics
impl ToTokens for Generics
fn to_tokens(self: &Self, tokens: &mut TokenStream)
impl Unpin for Generics
impl UnsafeUnpin for Generics
impl UnwindSafe for Generics
impl<T> Any for Generics
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Generics
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Generics
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Generics
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Generics
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Spanned for Generics
fn span(self: &Self) -> Span
impl<T> ToOwned for Generics
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for Generics
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Generics
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Generics
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>