pub struct FnDecl {
pub type_name: Option<String>,
pub name: String,
pub params: Vec<Param>,
pub ret_ty: Option<TypeExpr>,
pub effect: Option<Effect>,
pub body: Block,
pub span: Span,
}Expand description
a fn declaration. type_name is Some for a fn Type.method definition
(the receiver type’s name) and None for a free function. ret_ty is the
-> T return type, omitted for void. effect is the is pure/io/
alloc/panic annotation, omitted when Phase 3 should infer it.
Fields§
§type_name: Option<String>the receiver type’s name for a fn Type.method definition, else None.
name: Stringthe function (or method) name.
params: Vec<Param>the parameter list, in order; for a method, the first may be self.
ret_ty: Option<TypeExpr>the -> T return type, or None for void.
effect: Option<Effect>the is pure/io/alloc/panic annotation, or None to infer.
body: Blockthe function body; an empty { } body is a Block with no statements.
span: Spanfn keyword to closing }.
Trait Implementations§
impl StructuralPartialEq for FnDecl
Auto Trait Implementations§
impl Freeze for FnDecl
impl RefUnwindSafe for FnDecl
impl Send for FnDecl
impl Sync for FnDecl
impl Unpin for FnDecl
impl UnsafeUnpin for FnDecl
impl UnwindSafe for FnDecl
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