[]Struct qjs::Runtime

pub struct 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]

Construct a new Runtime with custom memory allocation functions.

impl Runtime[src]

Methods from Deref<Target = RuntimeRef>

pub fn free_atom(&self, atom: JSAtom)[src]

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 set_module_loader<T>(
    &self,
    module_normalize: ModuleNormalizeFunc,
    module_loader: ModuleLoaderFunc,
    opaque: Option<NonNull<T>>
)
[src]

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 free_value(&self, v: Value)[src]

Trait Implementations

impl Send for Runtime

impl Drop for Runtime

impl AsMut<RuntimeRef> for Runtime

impl PartialEq<Runtime> for Runtime[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl PartialEq<RuntimeRef> for Runtime[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl PartialEq<Runtime> for RuntimeRef[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl Default for Runtime[src]

impl AsRef<RuntimeRef> for Runtime

impl DerefMut for Runtime

impl Deref for Runtime

type Target = RuntimeRef

The resulting type after dereferencing.

impl Debug for Runtime[src]

impl Borrow<RuntimeRef> for Runtime

impl BorrowMut<RuntimeRef> for Runtime

impl ForeignType for Runtime

type CType = JSRuntime

The raw C type.

type Ref = RuntimeRef

The type representing a reference to this type.

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]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]