#[repr(C)]pub struct JSRuntime(/* private fields */);
Expand description
JSRuntime 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.
Implementations§
Source§impl JSRuntime
impl JSRuntime
Sourcepub fn new() -> OwnedJSRuntime
pub fn new() -> OwnedJSRuntime
Create a new JSRuntime. use JS_NewJSRuntime internally.
Sourcepub unsafe fn set_host_promise_rejection_tracker(
&mut self,
tracker: Option<unsafe extern "C" fn(ctx: *mut JSContext, promise: JSValue, reason: JSValue, is_handled: c_int, opaque: *mut c_void)>,
opaque: *mut c_void,
)
pub unsafe fn set_host_promise_rejection_tracker( &mut self, tracker: Option<unsafe extern "C" fn(ctx: *mut JSContext, promise: JSValue, reason: JSValue, is_handled: c_int, opaque: *mut c_void)>, opaque: *mut c_void, )
Set callback to handle host promise rejection. use JS_SetHostPromiseRejectionTracker internally.
§Safety
TODO: will use fn mapping or proc macro to abstract the unsafe
Sourcepub fn execute_pending_job(&mut self) -> Result<bool, JSContextException<'_>>
pub fn execute_pending_job(&mut self) -> Result<bool, JSContextException<'_>>
Executes next pending job, returns JSContextException if exception, false if no job pending, true if a job was executed successfully. use JS_ExecutePendingJob internally.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JSRuntime
impl RefUnwindSafe for JSRuntime
impl Send for JSRuntime
impl Sync for JSRuntime
impl Unpin for JSRuntime
impl UnwindSafe for JSRuntime
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