[][src]Struct rusty_v8::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.

Methods

impl Isolate[src]

pub fn new(params: UniqueRef<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() -> UniqueRef<CreateParams>[src]

Initial configuration parameters for a new Isolate.

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 enter(&mut self)[src]

Sets this isolate as the entered one for the current thread. Saves the previously entered one (if any), so that it can be restored when exiting. Re-entering an isolate is allowed.

pub fn exit(&mut self)[src]

Exits this isolate by restoring the previously entered one in the current thread. The isolate may still stay the same, if it was entered more than once.

Requires: self == Isolate::GetCurrent().

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>(&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 unsafe fn dispose(&mut self)[src]

Disposes the isolate. The isolate must not be entered by any thread to be disposable.

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.