Struct swc_ecma_utils::function::FunctionWrapper
source · [−]pub struct FunctionWrapper<T> {
pub binding_ident: Option<Ident>,
pub function: Expr,
pub ignore_function_name: bool,
pub ignore_function_length: bool,
/* private fields */
}
Fields
binding_ident: Option<Ident>
function: Expr
ignore_function_name: bool
ignore_function_length: bool
Trait Implementations
sourceimpl From<ArrowExpr> for FunctionWrapper<Expr>
impl From<ArrowExpr> for FunctionWrapper<Expr>
sourceimpl From<FnDecl> for FunctionWrapper<FnDecl>
impl From<FnDecl> for FunctionWrapper<FnDecl>
sourceimpl From<FnExpr> for FunctionWrapper<Expr>
impl From<FnExpr> for FunctionWrapper<Expr>
sourceimpl From<FunctionWrapper<Expr>> for FnWrapperResult<FnExpr, FnDecl>
impl From<FunctionWrapper<Expr>> for FnWrapperResult<FnExpr, FnDecl>
sourcefn from(value: FunctionWrapper<Expr>) -> Self
fn from(value: FunctionWrapper<Expr>) -> Self
Converts to this type from the input type.
sourceimpl From<FunctionWrapper<FnDecl>> for FnWrapperResult<FnDecl, FnDecl>
impl From<FunctionWrapper<FnDecl>> for FnWrapperResult<FnDecl, FnDecl>
sourcefn from(value: FunctionWrapper<FnDecl>) -> Self
fn from(value: FunctionWrapper<FnDecl>) -> Self
Converts to this type from the input type.
sourceimpl Into<Expr> for FunctionWrapper<Expr>
impl Into<Expr> for FunctionWrapper<Expr>
sourcefn into(self) -> Expr
fn into(self) -> Expr
If a function has a function name, it may be called recursively. We use the named expression to hoist the function name internally Therefore, its recursive calls refer to the correct identity.
Else if a function has a binding name, it may be called recursively as well. But it refer the binding name which exist the outer scope. It is safe to using anonymous expression wrapper.
Optimization: A function without a name cannot be recursively referenced by Ident. It’s safe to return the expr without wrapper if the params.len is 0.
Auto Trait Implementations
impl<T> RefUnwindSafe for FunctionWrapper<T> where
T: RefUnwindSafe,
impl<T> Send for FunctionWrapper<T> where
T: Send,
impl<T> Sync for FunctionWrapper<T> where
T: Sync,
impl<T> Unpin for FunctionWrapper<T> where
T: Unpin,
impl<T> UnwindSafe for FunctionWrapper<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more