Skip to main content

JSContext

Struct JSContext 

Source
pub struct JSContext {
    pub finalization_registries: RefCell<Vec<usize>>,
    pub pending_exception: Option<JSValue>,
    pub common_atoms: CommonAtoms,
    /* private fields */
}

Fields§

§finalization_registries: RefCell<Vec<usize>>§pending_exception: Option<JSValue>§common_atoms: CommonAtoms

Implementations§

Source§

impl JSContext

Source

pub fn new(runtime: &mut JSRuntime) -> Self

Source

pub fn check_interrupt(&mut self) -> Result<(), String>

Source

pub fn reset_interrupt_counter(&mut self)

Source

pub fn runtime(&self) -> &JSRuntime

Source

pub fn runtime_mut(&mut self) -> &mut JSRuntime

Source

pub fn atom_table(&self) -> &AtomTable

Source

pub fn atom_table_mut(&mut self) -> &mut AtomTable

Source

pub fn shape_cache(&self) -> &ShapeCache

Source

pub fn shape_cache_mut(&mut self) -> &mut ShapeCache

Source

pub fn get_or_create_args_length_shape(&mut self) -> NonNull<Shape>

Source

pub fn global(&self) -> JSValue

Source

pub fn set_global(&mut self, value: JSValue)

Source

pub fn intern(&mut self, s: &str) -> Atom

Source

pub fn intern_concat(&mut self, a: &str, b: &str) -> Atom

Source

pub fn intern_concat_atoms(&mut self, a: Atom, b: Atom) -> Atom

Source

pub fn int_atom(&self, n: usize) -> Atom

Source

pub fn int_atom_mut(&mut self, n: usize) -> Atom

Source

pub fn intern_fast(&mut self, s: &str) -> Atom

Source

pub fn lookup_atom(&self, s: &str) -> Option<Atom>

Source

pub fn get_atom_str(&self, atom: Atom) -> &str

Source

pub fn string_char_count(&self, atom: Atom) -> usize

Source

pub fn string_char_code_at(&self, atom: Atom, index: usize) -> Option<u32>

Source

pub fn mark_symbol_atom(&mut self, atom: Atom)

Source

pub fn is_symbol_atom(&self, atom: Atom) -> bool

Source

pub fn register_builtin(&mut self, name: &str, func: HostFunction)

Source

pub fn register_global_builtin( &mut self, name: &'static str, arity: u32, func: HostFunc, )

Source

pub fn call_builtin(&mut self, name: &str, args: &[JSValue]) -> JSValue

Source

pub fn get_builtin_func(&self, name: &str) -> Option<HostFunc>

Source

pub fn call_builtin_direct( &mut self, func: HostFunc, args: &[JSValue], ) -> JSValue

Source

pub fn set_string_prototype(&mut self, ptr: usize)

Source

pub fn set_number_prototype(&mut self, ptr: usize)

Source

pub fn set_array_prototype(&mut self, ptr: usize)

Source

pub fn set_regexp_prototype(&mut self, ptr: usize)

Source

pub fn set_object_prototype(&mut self, ptr: usize)

Source

pub fn set_function_prototype(&mut self, ptr: usize)

Source

pub fn set_map_prototype(&mut self, ptr: usize)

Source

pub fn set_set_prototype(&mut self, ptr: usize)

Source

pub fn get_string_prototype(&self) -> Option<*mut JSObject>

Source

pub fn get_number_prototype(&self) -> Option<*mut JSObject>

Source

pub fn get_array_prototype(&self) -> Option<*mut JSObject>

Source

pub fn get_regexp_prototype(&self) -> Option<*mut JSObject>

Source

pub fn get_object_prototype(&self) -> Option<*mut JSObject>

Source

pub fn get_function_prototype(&self) -> Option<*mut JSObject>

Source

pub fn get_map_prototype(&self) -> Option<*mut JSObject>

Source

pub fn get_set_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_weakmap_prototype(&mut self, ptr: usize)

Source

pub fn get_weakmap_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_weakset_prototype(&mut self, ptr: usize)

Source

pub fn get_weakset_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_error_prototype(&mut self, ptr: usize)

Source

pub fn get_error_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_type_error_prototype(&mut self, ptr: usize)

Source

pub fn get_type_error_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_reference_error_prototype(&mut self, ptr: usize)

Source

pub fn get_reference_error_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_range_error_prototype(&mut self, ptr: usize)

Source

pub fn get_range_error_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_syntax_error_prototype(&mut self, ptr: usize)

Source

pub fn get_syntax_error_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_symbol_prototype(&mut self, ptr: usize)

Source

pub fn get_symbol_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_weakref_prototype(&mut self, ptr: usize)

Source

pub fn get_weakref_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_finalization_registry_prototype(&mut self, ptr: usize)

Source

pub fn get_finalization_registry_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_generator_prototype(&mut self, ptr: usize)

Source

pub fn get_generator_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_async_generator_prototype(&mut self, ptr: usize)

Source

pub fn get_async_generator_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_promise_prototype(&mut self, ptr: usize)

Source

pub fn get_promise_prototype(&self) -> Option<*mut JSObject>

Source

pub fn set_register_vm_ptr(&mut self, ptr: Option<usize>)

Source

pub fn get_register_vm_ptr(&self) -> Option<usize>

Source

pub fn add_extension(&mut self, ext: Box<dyn MacroTaskExtension>)

Source

pub fn set_compiler_opt_level(&mut self, opt_level: OptLevel)

Source

pub fn get_compiler_opt_level(&self) -> OptLevel

Source

pub fn set_pending_callback(&mut self, callback: PendingCallback)

Source

pub fn take_pending_callback(&mut self) -> Option<PendingCallback>

Source

pub fn has_pending_callback(&self) -> bool

Source

pub fn microtask_enqueue(&mut self, task: Microtask)

Source

pub fn microtask_is_empty(&self) -> bool

Source

pub fn microtask_dequeue(&mut self) -> Option<Microtask>

Source

pub fn set_current_module(&mut self, specifier: Option<String>)

Source

pub fn get_current_module(&self) -> Option<&str>

Source

pub fn set_import_meta(&mut self, ptr: Option<usize>)

Source

pub fn get_import_meta(&self) -> Option<usize>

Source

pub fn event_loop(&self) -> &EventLoop

Source

pub fn event_loop_mut(&mut self) -> &mut EventLoop

Source

pub fn run_event_loop(&mut self) -> Result<EventLoopResult, String>

Source

pub fn run_event_loop_with_timeout( &mut self, timeout_ms: u64, ) -> Result<EventLoopResult, String>

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.