[][src]Struct rusty_v8_m::Isolate

#[repr(C)]pub struct Isolate(_);

Isolate represents an isolated instance of the V8 engine. V8 isolates have completely separate states. Objects from one isolate must not be used in other isolates. The embedder can create multiple isolates and use them in parallel in multiple threads. An isolate can be entered by at most one thread at any given time. The Locker/Unlocker API must be used to synchronize.

Implementations

impl Isolate[src]

pub fn new(params: CreateParams) -> OwnedIsolate[src]

Creates a new isolate. Does not change the currently entered isolate.

When an isolate is no longer used its resources should be freed by calling V8::dispose(). Using the delete operator is not allowed.

V8::initialize() must have run prior to this.

pub fn create_params() -> CreateParams[src]

Initial configuration parameters for a new Isolate.

pub fn thread_safe_handle(&mut self) -> IsolateHandle[src]

pub unsafe fn set_data(&mut self, slot: u32, ptr: *mut c_void)[src]

Associate embedder-specific data with the isolate. |slot| has to be between 0 and GetNumberOfDataSlots() - 1.

pub fn get_data(&self, slot: u32) -> *mut c_void[src]

Retrieve embedder-specific data from the isolate. Returns NULL if SetData has never been called for the given |slot|.

pub fn get_number_of_data_slots(&self) -> u32[src]

Returns the maximum number of available embedder data slots. Valid slots are in the range of 0 - GetNumberOfDataSlots() - 1.

pub fn get_slot_mut<T: 'static>(&self) -> Option<RefMut<T>>[src]

Safe alternative to Isolate::get_data

Warning: will be renamed to get_data_mut() after original unsafe version is removed.

pub fn get_slot<T: 'static>(&self) -> Option<Ref<T>>[src]

Safe alternative to Isolate::get_data

Warning: will be renamed to get_data() after original unsafe version is removed.

pub fn set_slot<T: 'static>(&mut self, value: T) -> bool[src]

Safe alternative to Isolate::set_data

Use with Isolate::get_slot and Isolate::get_slot_mut to associate state with an Isolate.

This method gives ownership of value to the Isolate. Exactly one object of each type can be associated with an Isolate. If called more than once with an object of the same type, the earlier version will be dropped and replaced.

Returns true if value was set without replacing an existing value.

The value will be dropped when the isolate is dropped.

Warning: will be renamed to set_data() after original unsafe version is removed.

pub fn set_capture_stack_trace_for_uncaught_exceptions(
    &mut self,
    capture: bool,
    frame_limit: i32
)
[src]

Tells V8 to capture current stack trace when uncaught exception occurs and report it to the message listeners. The option is off by default.

pub fn add_message_listener(&mut self, callback: MessageCallback) -> bool[src]

Adds a message listener (errors only).

The same message listener can be added more than once and in that case it will be called more than once for each message.

The exception object will be passed to the callback.

pub fn set_promise_reject_callback(&mut self, callback: PromiseRejectCallback)[src]

Set callback to notify about promise reject with no handler, or revocation of such a previous notification once the handler is added.

pub fn set_host_initialize_import_meta_object_callback(
    &mut self,
    callback: HostInitializeImportMetaObjectCallback
)
[src]

This specifies the callback called by the upcoming importa.meta language feature to retrieve host-defined meta data for a module.

pub fn set_host_import_module_dynamically_callback(
    &mut self,
    callback: HostImportModuleDynamicallyCallback
)
[src]

This specifies the callback called by the upcoming dynamic import() language feature to load modules.

pub fn throw_exception<'sc>(
    &mut self,
    exception: Local<Value>
) -> Local<'sc, Value>
[src]

Schedules an exception to be thrown when returning to JavaScript. When an exception has been scheduled it is illegal to invoke any JavaScript operation; the caller must return immediately and only after the exception has been handled does it become legal to invoke JavaScript operations.

pub fn run_microtasks(&mut self)[src]

Runs the default MicrotaskQueue until it gets empty. Any exceptions thrown by microtask callbacks are swallowed.

pub fn enqueue_microtask(&mut self, microtask: Local<Function>)[src]

Enqueues the callback to the default MicrotaskQueue

pub fn take_heap_snapshot<F>(&mut self, callback: F) where
    F: FnMut(&[u8]) -> bool
[src]

Take a heap snapshot. The callback is invoked one or more times with byte slices containing the snapshot serialized as JSON. It's the callback's responsibility to reassemble them into a single document, e.g., by writing them to a file. Note that Chrome DevTools refuses to load snapshots without a .heapsnapshot suffix.

Trait Implementations

impl<'s, X> From<&'s mut Isolate> for Scope<'s, CallbackScope<X>>[src]

Auto Trait Implementations

impl RefUnwindSafe for Isolate

impl Send for Isolate

impl Sync for Isolate

impl Unpin for Isolate

impl UnwindSafe for Isolate

Blanket Implementations

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

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

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

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.