Skip to main content

JSFunction

Struct JSFunction 

Source
pub struct JSFunction {
Show 13 fields pub base: JSObject, pub name: Atom, pub param_count: u32, pub locals_count: u32, pub arity: u32, pub builtin_atom: Option<Atom>, pub builtin_func: Option<HostFunc>, pub upvalues: Option<Box<UpvalueData>>, pub bytecode: Option<Box<Bytecode>>, pub shared_nb_for_ic: Option<Arc<NestedBytecode>>, pub cached_prototype_ptr: *mut JSObject, pub source_filename: String, pub line_number_table: Option<LineNumberTable>, /* private fields */
}

Fields§

§base: JSObject§name: Atom§param_count: u32§locals_count: u32§arity: u32§builtin_atom: Option<Atom>§builtin_func: Option<HostFunc>§upvalues: Option<Box<UpvalueData>>§bytecode: Option<Box<Bytecode>>§shared_nb_for_ic: Option<Arc<NestedBytecode>>§cached_prototype_ptr: *mut JSObject§source_filename: String§line_number_table: Option<LineNumberTable>

Implementations§

Source§

impl JSFunction

Source

pub fn new() -> Self

Source

pub fn new_builtin(name: Atom, arity: u32) -> Self

Source

pub fn with_upvalues(self, upvalues_map: FxHashMap<Atom, JSValue>) -> Self

Source

pub fn is_callable(&self) -> bool

Source

pub fn is_arrow(&self) -> bool

Source

pub fn set_is_arrow(&mut self, val: bool)

Source

pub fn is_async(&self) -> bool

Source

pub fn set_is_async(&mut self, val: bool)

Source

pub fn is_generator(&self) -> bool

Source

pub fn set_is_generator(&mut self, val: bool)

Source

pub fn is_builtin(&self) -> bool

Source

pub fn set_is_builtin(&mut self, val: bool)

Source

pub fn uses_arguments(&self) -> bool

Source

pub fn set_uses_arguments(&mut self, val: bool)

Source

pub fn is_strict(&self) -> bool

Source

pub fn set_is_strict(&mut self, val: bool)

Source

pub fn has_symbol_on_base(&self) -> bool

Source

pub fn mark_has_symbol_prop(&mut self)

Source

pub fn upvalues_mut(&mut self) -> &mut UpvalueData

Source

pub fn upvalues_ref(&self) -> Option<&UpvalueData>

Source

pub fn set_builtin_marker(&mut self, ctx: &mut JSContext, builtin_name: &str)

Trait Implementations§

Source§

impl Default for JSFunction

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.