Struct syn::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 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§

Returns an Iterator<Item = &LifetimeParam> over the lifetime parameters in self.params.

Returns an Iterator<Item = &mut LifetimeParam> over the lifetime parameters in self.params.

Returns an Iterator<Item = &TypeParam> over the type parameters in self.params.

Returns an Iterator<Item = &mut TypeParam> over the type parameters in self.params.

Returns an Iterator<Item = &ConstParam> over the constant parameters in self.params.

Returns an Iterator<Item = &mut ConstParam> over the constant parameters in self.params.

Initializes an empty where-clause if there is not one present already.

Trait Implementations§

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.