pub struct FunctionDecl {
pub matching_source: Fragment,
pub modifiers: Vec<FunctionModifier>,
pub name: Identifier,
pub generics: Vec<Identifier>,
pub params: Vec<Param>,
pub return_ty: Option<Type>,
pub body: Option<Block>,
}Available on crate feature
ast-models only.Expand description
A function declaration.
Fields§
§matching_source: FragmentFull matching source of the declaration.
modifiers: Vec<FunctionModifier>Modifiers such as pure or unsafe, in source order. The parser rejects duplicates.
name: IdentifierThe name of the function.
generics: Vec<Identifier>Generic type parameters, such as the T in func id<T>(t: T) -> T.
params: Vec<Param>The function’s parameters, in order.
return_ty: Option<Type>The declared return type, if any.
body: Option<Block>The body of the function. Functions declared without a body (func f();) have None.
Implementations§
Source§impl FunctionDecl
impl FunctionDecl
Sourcepub fn has_modifier(&self, kind: FunctionModifierKind) -> bool
pub fn has_modifier(&self, kind: FunctionModifierKind) -> bool
Does this function have the given modifier?
Trait Implementations§
Source§impl Clone for FunctionDecl
impl Clone for FunctionDecl
Source§impl Debug for FunctionDecl
impl Debug for FunctionDecl
Source§impl PartialEq for FunctionDecl
impl PartialEq for FunctionDecl
impl StructuralPartialEq for FunctionDecl
Auto Trait Implementations§
impl Forget for FunctionDecl
impl Freeze for FunctionDecl
impl RefUnwindSafe for FunctionDecl
impl Send for FunctionDecl
impl Sync for FunctionDecl
impl Unpin for FunctionDecl
impl UnsafeUnpin for FunctionDecl
impl UnwindSafe for FunctionDecl
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more