FunctionDefinition
std::meta::function_def
contains methods on the built-in FunctionDefinition
type representing
a function definition in the source program.
Methods
add_attribute
fn add_attribute<let N: u32>(self, attribute: str<N>) {}
Adds an attribute to the function. This is only valid on functions in the current crate which have not yet been resolved. This means any functions called at compile-time are invalid targets for this method.
body
fn body(self) -> Expr {}
Returns the body of the function as an expression. This is only valid on functions in the current crate which have not yet been resolved. This means any functions called at compile-time are invalid targets for this method.
has_named_attribute
fn has_named_attribute(self, name: Quoted) -> bool {}
Returns true if this function has a custom attribute with the given name.
module
fn module(self) -> Module {}
Returns the module where the function is defined.
name
fn name(self) -> Quoted {}
Returns the name of the function.
parameters
fn parameters(self) -> [(Quoted, Type)] {}
Returns each parameter of the function as a tuple of (parameter pattern, parameter type).