pub struct Function {
pub name: Identifier,
pub params: Vec<Param>,
pub return_type: Option<Type>,
pub body: Block,
pub generics: Vec<String>,
pub is_async: bool,
pub is_unsafe: bool,
pub is_extern: bool,
pub span: Range<usize>,
}Expand description
Represents a function definition in Rust source code.
Functions are fundamental building blocks in Rust that encapsulate reusable logic. They can have parameters, return types, and contain executable code blocks.
Fields§
§name: IdentifierThe name identifier of the function
params: Vec<Param>List of function parameters
return_type: Option<Type>Optional return type
body: BlockThe function body containing executable statements
generics: Vec<String>Generic parameters
is_async: boolWhether the function is async
is_unsafe: boolWhether the function is unsafe
is_extern: boolWhether the function is extern
span: Range<usize>Source code span where this function appears
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Function
impl<'de> Deserialize<'de> for Function
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Function
impl StructuralPartialEq for Function
Auto Trait Implementations§
impl Freeze for Function
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin 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