pub struct Function {
pub name: Option<Ident>,
pub params: Vec<Pattern>,
pub body: FunctionBody,
pub is_async: bool,
pub is_generator: bool,
pub strict: bool,
pub is_arrow: bool,
pub span: Span,
pub params_span: Span,
}Expand description
A function in any of its forms (declaration, expression, arrow, method).
Fields§
§name: Option<Ident>Name: required for declarations, optional for expressions and arrows.
params: Vec<Pattern>Parameters, in source order; a rest parameter is [Pattern::Rest].
body: FunctionBodyBody.
is_async: boolasync
is_generator: boolfunction* / *method / async function*
strict: boolWhether the body is strict: either an enclosing strict context or the
function’s own "use strict" directive.
Recorded per function because strictness is not a property of the source but of
the enclosing context: a "use strict" inside one function body leaves the code
after it sloppy, so the compiler cannot infer a body’s mode from the program’s.
is_arrow: bool=>
span: SpanSource range.
params_span: SpanRange of the parameter list, for error messages and length.
Trait Implementations§
impl StructuralPartialEq for Function
Auto Trait Implementations§
impl Forget for Function
impl Freeze for Functionwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Pattern>: Freeze,
PhantomData<Stmt>: Freeze,
*const Expr is !null: Freeze,
PhantomData<Expr>: Freeze,
impl Move for Function
impl RefUnwindSafe for Function
impl Send for Functionwhere
RawVecInner: Send,
BoxRaw<Expr>: Send,
BoxRaw<RestElement>: Send,
BoxRaw<Pattern>: Send,
BoxRaw<MemberPattern>: Send,
BoxRaw<Stmt>: Send,
BoxRaw<Function>: Send,
BoxRaw<Class>: Send,
BoxRaw<ImportDecl>: Send,
BoxRaw<ExportDecl>: Send,
impl Sync for Functionwhere
RawVecInner: Sync,
BoxRaw<Expr>: Sync,
BoxRaw<RestElement>: Sync,
BoxRaw<Pattern>: Sync,
BoxRaw<MemberPattern>: Sync,
BoxRaw<Stmt>: Sync,
BoxRaw<Function>: Sync,
BoxRaw<Class>: Sync,
BoxRaw<ImportDecl>: Sync,
BoxRaw<ExportDecl>: Sync,
impl Unpin for Function
impl UnsafeUnpin for Functionwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Pattern>: UnsafeUnpin,
PhantomData<Stmt>: UnsafeUnpin,
*const Expr is !null: UnsafeUnpin,
PhantomData<Expr>: UnsafeUnpin,
impl UnwindSafe for Functionwhere
RawVecInner: UnwindSafe,
BoxRaw<Expr>: UnwindSafe,
BoxRaw<RestElement>: UnwindSafe,
BoxRaw<Pattern>: UnwindSafe,
BoxRaw<MemberPattern>: UnwindSafe,
BoxRaw<Stmt>: UnwindSafe,
BoxRaw<Function>: UnwindSafe,
BoxRaw<Class>: UnwindSafe,
BoxRaw<ImportDecl>: UnwindSafe,
BoxRaw<ExportDecl>: UnwindSafe,
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