pub struct Function { /* private fields */ }Expand description
An ECMAScript function definition.
Distinguishes declarations from expressions only by where the value is used; the structural shape is identical, so both share this type.
Implementations§
Source§impl Function
impl Function
Sourcepub fn new(
id: Option<Identifier>,
params: Vec<Pattern>,
body: Vec<Statement>,
is_async: bool,
is_generator: bool,
) -> Self
pub fn new( id: Option<Identifier>, params: Vec<Pattern>, body: Vec<Statement>, is_async: bool, is_generator: bool, ) -> Self
Build a function definition.
Sourcepub fn id(&self) -> Option<&Identifier>
pub fn id(&self) -> Option<&Identifier>
The function’s name, if any. Function declarations always have one; expressions may be anonymous.
Sourcepub fn is_generator(&self) -> bool
pub fn is_generator(&self) -> bool
Whether the function was declared a generator (function*).
Trait Implementations§
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 UnsafeUnpin 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