[−]Struct qjs::Runtime
Runtime
represents a Javascript runtime corresponding to an object heap.
Several runtimes can exist at the same time but they cannot exchange objects. Inside a given runtime, no multi-threading is supported.
Methods
impl Runtime
[src]
pub fn new_class_id() -> ClassId
[src]
New Class ID which are globally allocated (i.e. for all runtimes).
impl Runtime
[src]
pub fn new() -> Self
[src]
Construct a new Runtime
.
pub fn with_malloc_funcs<T>(
malloc_funcs: &MallocFunctions,
opaque: Option<NonNull<T>>
) -> Self
[src]
malloc_funcs: &MallocFunctions,
opaque: Option<NonNull<T>>
) -> Self
Construct a new Runtime
with custom memory allocation functions.
impl Runtime
[src]
pub fn userdata_class_id() -> ClassId
[src]
Methods from Deref<Target = RuntimeRef>
pub fn new_class(&self, class_id: ClassId, class_def: &ClassDef) -> bool
[src]
Register a new Javascript class.
pub fn is_registered_class(&self, class_id: ClassId) -> bool
[src]
Checks if a class ID has been registered.
pub fn is_job_pending(&self) -> bool
[src]
pub fn execute_pending_job(&self) -> Result<Option<&ContextRef>, Error>
[src]
pub fn set_module_loader<T>(
&self,
module_normalize: ModuleNormalizeFunc,
module_loader: ModuleLoaderFunc,
opaque: Option<NonNull<T>>
)
[src]
&self,
module_normalize: ModuleNormalizeFunc,
module_loader: ModuleLoaderFunc,
opaque: Option<NonNull<T>>
)
Set the module loader and normalizer functions.
pub fn set_memory_limit(&self, limit: Option<usize>) -> &Self
[src]
Set a global memory allocation limit to a given Runtime
.
pub fn set_gc_threshold(&self, gc_threshold: usize) -> &Self
[src]
Set the GC threshold to a given Runtime
.
pub fn run_gc(&self)
[src]
Force to run GC to a given Runtime
.
pub fn is_live_object(&self, obj: &Value) -> bool
[src]
pub fn is_gc_swap(&self) -> bool
[src]
pub fn memory_usage(&self) -> MemoryUsage
[src]
Compute memory used by various object types.
pub fn set_interrupt_handler(&self, handler: InterruptHandler)
[src]
Set a callback which is regularly called by the engine when it is executing code.
This callback can be used to implement an execution timeout.
pub fn std_free_handlers(&self)
[src]
pub fn free_value(&self, v: Value)
[src]
Trait Implementations
impl Send for Runtime
impl Drop for Runtime
fn drop(&mut self)
impl AsMut<RuntimeRef> for Runtime
fn as_mut(&mut self) -> &mut RuntimeRef
impl PartialEq<Runtime> for Runtime
[src]
fn eq(&self, other: &Runtime) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialEq<RuntimeRef> for Runtime
[src]
fn eq(&self, other: &RuntimeRef) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialEq<Runtime> for RuntimeRef
[src]
fn eq(&self, other: &Runtime) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Default for Runtime
[src]
impl AsRef<RuntimeRef> for Runtime
fn as_ref(&self) -> &RuntimeRef
impl DerefMut for Runtime
fn deref_mut(&mut self) -> &mut RuntimeRef
impl Deref for Runtime
impl Debug for Runtime
[src]
impl Borrow<RuntimeRef> for Runtime
fn borrow(&self) -> &RuntimeRef
impl BorrowMut<RuntimeRef> for Runtime
fn borrow_mut(&mut self) -> &mut RuntimeRef
impl ForeignType for Runtime
Auto Trait Implementations
impl Unpin for Runtime
impl !Sync for Runtime
impl UnwindSafe for Runtime
impl RefUnwindSafe for Runtime
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,