pub struct QuickJsRuntimeAdapter { /* private fields */ }Implementations
sourceimpl QuickJsRuntimeAdapter
impl QuickJsRuntimeAdapter
sourcepub fn memory_usage(&self) -> MemoryUsage
pub fn memory_usage(&self) -> MemoryUsage
get memory usage for this runtime
pub fn add_context_init_hook<H>(&self, hook: H) -> Result<(), JsError>where
H: Fn(&QuickJsRuntimeAdapter, &QuickJsRealmAdapter) -> Result<(), JsError> + 'static,
pub fn create_context(id: &str) -> Result<(), JsError>
pub fn remove_context(id: &str)
pub fn get_context(&self, id: &str) -> &QuickJsRealmAdapter
pub fn opt_context(&self, id: &str) -> Option<&QuickJsRealmAdapter>
pub fn has_context(&self, id: &str) -> bool
sourcepub unsafe fn get_quickjs_context(
&self,
context: *mut JSContext
) -> &QuickJsRealmAdapter
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
pub fn get_rti_ref(&self) -> Option<Arc<QuickjsRuntimeFacadeInner>>
pub fn set_interrupt_handler<I: Fn(&QuickJsRuntimeAdapter) -> bool + 'static>(
&mut self,
interrupt_handler: I
) -> &mut Self
pub fn add_script_module_loader(&mut self, sml: ScriptModuleLoaderAdapter)
pub fn add_compiled_module_loader(&mut self, cml: CompiledModuleLoaderAdapter)
pub fn add_native_module_loader(&mut self, nml: NativeModuleLoaderAdapter)
pub fn get_main_context(&self) -> &QuickJsRealmAdapter
pub fn with_all_module_loaders<C, R>(&self, consumer: C) -> Option<R>where
C: Fn(&dyn ModuleLoader) -> Option<R>,
pub fn do_with<C, R>(task: C) -> Rwhere
C: FnOnce(&QuickJsRuntimeAdapter) -> R,
pub fn do_with_mut<C, R>(task: C) -> Rwhere
C: FnOnce(&mut QuickJsRuntimeAdapter) -> R,
sourcepub fn run_pending_jobs_if_any(&self)
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()
pub fn has_pending_jobs(&self) -> bool
pub fn run_pending_job(&self) -> Result<(), JsError>
pub fn get_id(&self) -> &str
Trait Implementations
sourceimpl Drop for QuickJsRuntimeAdapter
impl Drop for QuickJsRuntimeAdapter
sourceimpl JsRuntimeAdapter for QuickJsRuntimeAdapter
impl JsRuntimeAdapter for QuickJsRuntimeAdapter
type JsRealmAdapterType = QuickJsRealmAdapter
type JsRuntimeFacadeType = QuickJsRuntimeFacade
sourcefn js_load_module_script(&self, ref_path: &str, path: &str) -> Option<Script>
fn js_load_module_script(&self, ref_path: &str, path: &str) -> Option<Script>
this method can be used to load the script code for a module (via any ScriptModuleLoader)
sourcefn js_create_realm(
&self,
_id: &str
) -> Result<&Self::JsRealmAdapterType, JsError>
fn js_create_realm(
&self,
_id: &str
) -> Result<&Self::JsRealmAdapterType, JsError>
create a new Realm
sourcefn js_remove_realm(&self, _id: &str)
fn js_remove_realm(&self, _id: &str)
drop a Realm, please note that the Realm might not really be dropped until all promises have fulfilled
please note that this should not be able to remove the main realm Read more
sourcefn js_get_realm(&self, id: &str) -> Option<&Self::JsRealmAdapterType>
fn js_get_realm(&self, id: &str) -> Option<&Self::JsRealmAdapterType>
get a Realm, if the realm does not exists None will be returned
sourcefn js_get_main_realm(&self) -> &Self::JsRealmAdapterType
fn js_get_main_realm(&self) -> &Self::JsRealmAdapterType
get the main realm, this realm is always present and cannot be removed
sourcefn js_add_realm_init_hook<H>(&self, hook: H) -> Result<(), JsError>where
H: Fn(&Self, &QuickJsRealmAdapter) -> Result<(), JsError> + 'static,
fn js_add_realm_init_hook<H>(&self, hook: H) -> Result<(), JsError>where
H: Fn(&Self, &QuickJsRealmAdapter) -> Result<(), JsError> + 'static,
add a hook to add custom code for when a Realm is initialized
when adding a hook it will also be called for existing realms including the main realm Read more
Auto Trait Implementations
impl !RefUnwindSafe for QuickJsRuntimeAdapter
impl !Send for QuickJsRuntimeAdapter
impl !Sync for QuickJsRuntimeAdapter
impl Unpin for QuickJsRuntimeAdapter
impl !UnwindSafe for QuickJsRuntimeAdapter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more