pub struct Runtime(/* private fields */);Expand description
A ref counted handle to runtime. When last handle dropped, associated runtime will be dropped.
Implementations§
Methods from Deref<Target = RuntimeImpl>§
Sourcepub fn is_class_registered(&self, class_id: ClassID) -> bool
pub fn is_class_registered(&self, class_id: ClassID) -> bool
test if class_id exists.
Sourcepub fn register_class(&mut self, class_def: &ClassDef) -> Result<ClassID, i32>
pub fn register_class(&mut self, class_def: &ClassDef) -> Result<ClassID, i32>
register a class defination. returns the assigned class_id.
Sourcepub fn create_context_ecma<'a>(&mut self) -> Result<Context<'a>, i32>
pub fn create_context_ecma<'a>(&mut self) -> Result<Context<'a>, i32>
Creates new context initialized with ECMA standard classes and global entries.
This also provides a demostration on how to use ContextBuilder to customize a context.
pub fn set_interrupt_handler<F: InterruptFn + 'static>(&mut self, f: F)
pub fn unset_interrupt_handler(&mut self)
pub fn gc_set_threshold(&mut self, threshold: usize)
pub fn gc_info(&self) -> &GcPartition
Sourcepub fn gc_alloc<T: GcTracable>(
&mut self,
data: T,
) -> Result<GcRef<T>, (GcError, T)>
pub fn gc_alloc<T: GcTracable>( &mut self, data: T, ) -> Result<GcRef<T>, (GcError, T)>
alloc data in gc
Sourcepub fn gc_collect(&mut self) -> usize
pub fn gc_collect(&mut self) -> usize
collect garbage.
pub fn gc_set_trace_handler(&mut self, f: impl Fn(&mut GcTracer) + 'static)
Sourcepub fn gc_request(&mut self)
pub fn gc_request(&mut self)
request gc collect
Sourcepub fn gc_has_request(&self) -> bool
pub fn gc_has_request(&self) -> bool
request gc collect
Sourcepub fn set_module_loader(
&mut self,
norm_func: Option<fn(ctx: Context<'_>, base_name: &str, name: &str, opaque: *mut c_void) -> Result<String, i32>>,
load_func: fn(ctx: Context<'_>, module_name: &str, opaque: *mut c_void) -> Result<ModuleDef, i32>,
opaque: *mut c_void,
)
pub fn set_module_loader( &mut self, norm_func: Option<fn(ctx: Context<'_>, base_name: &str, name: &str, opaque: *mut c_void) -> Result<String, i32>>, load_func: fn(ctx: Context<'_>, module_name: &str, opaque: *mut c_void) -> Result<ModuleDef, i32>, opaque: *mut c_void, )
set module loader callbacks
pub fn id(&self) -> usize
Sourcepub fn set_stack_size(&mut self, stack_size: usize)
pub fn set_stack_size(&mut self, stack_size: usize)
set max stack size. 0 for unlimited
Sourcepub fn take_exception(&mut self) -> JSValue
pub fn take_exception(&mut self) -> JSValue
get current exception value, then reset current_exception to null.
pub fn stop(&mut self, code: i32)
pub fn tick(&mut self) -> Result<TickStatus, i32>
Trait Implementations§
impl StructuralPartialEq for Runtime
Auto Trait Implementations§
impl Freeze for Runtime
impl !RefUnwindSafe for Runtime
impl !Send for Runtime
impl !Sync for Runtime
impl Unpin for Runtime
impl !UnwindSafe for Runtime
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