pub struct QuickJsRuntimeAdapter { /* private fields */ }

Implementations§

source§

impl QuickJsRuntimeAdapter

source

pub fn memory_usage(&self) -> MemoryUsage

get memory usage for this runtime

source

pub fn add_context_init_hook<H>(&self, hook: H) -> Result<(), JsError>where H: Fn(&QuickJsRuntimeAdapter, &QuickJsRealmAdapter) -> Result<(), JsError> + 'static,

source

pub fn create_context(id: &str) -> Result<(), JsError>

source

pub fn remove_context(id: &str)

source

pub fn get_context(&self, id: &str) -> &QuickJsRealmAdapter

source

pub fn opt_context(&self, id: &str) -> Option<&QuickJsRealmAdapter>

source

pub fn has_context(&self, id: &str) -> bool

source

pub unsafe fn get_quickjs_context( &self, context: *mut JSContext ) -> &QuickJsRealmAdapter

Safety

When passing a context pointer please make sure the corresponding QuickJsContext is still valid

source

pub fn get_rti_ref(&self) -> Option<Arc<QuickjsRuntimeFacadeInner>>

source

pub fn set_interrupt_handler<I: Fn(&QuickJsRuntimeAdapter) -> bool + 'static>( &mut self, interrupt_handler: I ) -> &mut Self

source

pub fn add_script_module_loader(&mut self, sml: ScriptModuleLoaderAdapter)

source

pub fn add_compiled_module_loader(&mut self, cml: CompiledModuleLoaderAdapter)

source

pub fn add_native_module_loader(&mut self, nml: NativeModuleLoaderAdapter)

source

pub fn get_main_realm(&self) -> &QuickJsRealmAdapter

source

pub fn with_all_module_loaders<C, R>(&self, consumer: C) -> Option<R>where C: Fn(&dyn ModuleLoader) -> Option<R>,

source

pub fn gc(&self)

run the garbage collector

source

pub fn do_with<C, R>(task: C) -> Rwhere C: FnOnce(&QuickJsRuntimeAdapter) -> R,

source

pub fn do_with_mut<C, R>(task: C) -> Rwhere C: FnOnce(&mut QuickJsRuntimeAdapter) -> R,

source

pub fn run_pending_jobs_if_any(&self)

run pending jobs if avail

todo

move this to a quickjs_utils::pending_jobs so it can be used without doing QuickjsRuntime.do_with()

source

pub fn has_pending_jobs(&self) -> bool

source

pub fn run_pending_job(&self) -> Result<(), JsError>

source

pub fn get_id(&self) -> &str

source

pub fn load_module_script_opt( &self, ref_path: &str, path: &str ) -> Option<Script>

this method tries to load a module script using the runtimes script_module loaders

source§

impl QuickJsRuntimeAdapter

source

pub fn load_module_script(&self, ref_path: &str, path: &str) -> Option<Script>

source

pub fn js_create_realm( &self, _id: &str ) -> Result<&QuickJsRealmAdapter, JsError>

source

pub fn remove_realm(&self, _id: &str)

source

pub fn get_realm(&self, id: &str) -> Option<&QuickJsRealmAdapter>

source

pub fn add_realm_init_hook<H>(&self, hook: H) -> Result<(), JsError>where H: Fn(&Self, &QuickJsRealmAdapter) -> Result<(), JsError> + 'static,

Trait Implementations§

source§

impl Drop for QuickJsRuntimeAdapter

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V