pub struct Function {Show 13 fields
pub attributes: Vec<Attribute>,
pub vis_marker: Option<VisMarker>,
pub qualifiers: FnQualifiers,
pub tk_fn_keyword: Ident,
pub name: Ident,
pub generic_params: Option<GenericParamList>,
pub tk_params_parens: GroupSpan,
pub params: Punctuated<FnParam>,
pub where_clause: Option<WhereClause>,
pub tk_return_arrow: Option<[Punct; 2]>,
pub return_ty: Option<TypeExpr>,
pub tk_semicolon: Option<Punct>,
pub body: Option<Group>,
}Expand description
Declaration of a function.
See also https://doc.rust-lang.org/reference/items/functions.html.
Example input:
const fn hello(a: i32, b: f32) -> f32 { return 0.0; }
unsafe fn eval(c: String, b: i32) { return; }
fn do_thing<T: Clone>(t: T) where T: Default;Fields§
§attributes: Vec<Attribute>§vis_marker: Option<VisMarker>§qualifiers: FnQualifiers§tk_fn_keyword: Ident§name: Ident§generic_params: Option<GenericParamList>§tk_params_parens: GroupSpan§params: Punctuated<FnParam>§where_clause: Option<WhereClause>§tk_return_arrow: Option<[Punct; 2]>§return_ty: Option<TypeExpr>§tk_semicolon: Option<Punct>§body: Option<Group>Implementations§
Trait Implementations§
Source§impl ToTokens for Function
impl ToTokens for Function
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Auto Trait Implementations§
impl !Send for Function
impl !Sync for Function
impl Freeze for Function
impl RefUnwindSafe for Function
impl Unpin for Function
impl UnsafeUnpin for Function
impl UnwindSafe for Function
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