[][src]Struct rusty_v8::HandleScope

pub struct HandleScope<'s, C = Context> { /* fields omitted */ }

A stack-allocated class that governs a number of local handles. After a handle scope has been created, all local handles will be allocated within that handle scope until either the handle scope is deleted or another handle scope is created. If there is already a handle scope and a new one is created, all allocations will take place in the new handle scope until it is deleted. After that, new handles will again be allocated in the original handle scope.

After the handle scope of a local handle has been deleted the garbage collector will no longer track the object stored in the handle and may deallocate it. The behavior of accessing a handle for which the handle scope has been deleted is undefined.

Implementations

impl<'s> HandleScope<'s>[src]

pub fn new<P: NewHandleScope<'s>>(param: &'s mut P) -> P::NewScope[src]

pub fn get_current_context(&self) -> Local<'s, Context>[src]

Returns the context of the currently running JavaScript, or the context on the top of the stack if no JavaScript is running.

pub fn get_entered_or_microtask_context(&self) -> Local<'s, Context>[src]

Returns either the last context entered through V8's C++ API, or the context of the currently running microtask while processing microtasks. If a context is entered while executing a microtask, that context is returned.

impl<'s> HandleScope<'s, ()>[src]

pub fn throw_exception(&mut self, exception: Local<Value>) -> Local<'s, 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.

This function always returns the undefined value.

Methods from Deref<Target = Isolate>

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

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

Get mutable reference to embedder data.

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

Get reference to embedder data.

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

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.

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 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, 'p> AsMut<HandleScope<'p, ()>> for ContextScope<'s, HandleScope<'p>>[src]

impl<'s, 'p, 'e> AsMut<HandleScope<'p, ()>> for ContextScope<'s, EscapableHandleScope<'p, 'e>>[src]

impl<'s, 'p, C> AsMut<HandleScope<'p, ()>> for TryCatch<'s, HandleScope<'p, C>>[src]

impl<'s, 'p, 'e, C> AsMut<HandleScope<'p, ()>> for TryCatch<'s, EscapableHandleScope<'p, 'e, C>>[src]

impl<'s, 'p> AsMut<HandleScope<'p, Context>> for ContextScope<'s, HandleScope<'p>>[src]

impl<'s, 'p, 'e> AsMut<HandleScope<'p, Context>> for ContextScope<'s, EscapableHandleScope<'p, 'e>>[src]

impl<'s, 'p> AsMut<HandleScope<'p, Context>> for TryCatch<'s, HandleScope<'p>>[src]

impl<'s, 'p, 'e> AsMut<HandleScope<'p, Context>> for TryCatch<'s, EscapableHandleScope<'p, 'e>>[src]

impl<'s, C> AsMut<HandleScope<'s, ()>> for HandleScope<'s, C>[src]

impl<'s, 'e, C> AsMut<HandleScope<'s, ()>> for EscapableHandleScope<'s, 'e, C>[src]

impl<'s> AsMut<HandleScope<'s, ()>> for CallbackScope<'s>[src]

impl<'s> AsMut<HandleScope<'s, Context>> for HandleScope<'s>[src]

impl<'s, 'e> AsMut<HandleScope<'s, Context>> for EscapableHandleScope<'s, 'e>[src]

impl<'s> AsMut<HandleScope<'s, Context>> for CallbackScope<'s>[src]

impl<'s, C> AsMut<Isolate> for HandleScope<'s, C>[src]

impl<'s, 'p> AsRef<HandleScope<'p, ()>> for ContextScope<'s, HandleScope<'p>>[src]

impl<'s, 'p, 'e> AsRef<HandleScope<'p, ()>> for ContextScope<'s, EscapableHandleScope<'p, 'e>>[src]

impl<'s, 'p, C> AsRef<HandleScope<'p, ()>> for TryCatch<'s, HandleScope<'p, C>>[src]

impl<'s, 'p, 'e, C> AsRef<HandleScope<'p, ()>> for TryCatch<'s, EscapableHandleScope<'p, 'e, C>>[src]

impl<'s, 'p> AsRef<HandleScope<'p, Context>> for ContextScope<'s, HandleScope<'p>>[src]

impl<'s, 'p, 'e> AsRef<HandleScope<'p, Context>> for ContextScope<'s, EscapableHandleScope<'p, 'e>>[src]

impl<'s, 'p> AsRef<HandleScope<'p, Context>> for TryCatch<'s, HandleScope<'p>>[src]

impl<'s, 'p, 'e> AsRef<HandleScope<'p, Context>> for TryCatch<'s, EscapableHandleScope<'p, 'e>>[src]

impl<'s, C> AsRef<HandleScope<'s, ()>> for HandleScope<'s, C>[src]

impl<'s, 'e, C> AsRef<HandleScope<'s, ()>> for EscapableHandleScope<'s, 'e, C>[src]

impl<'s> AsRef<HandleScope<'s, ()>> for CallbackScope<'s>[src]

impl<'s> AsRef<HandleScope<'s, Context>> for HandleScope<'s>[src]

impl<'s, 'e> AsRef<HandleScope<'s, Context>> for EscapableHandleScope<'s, 'e>[src]

impl<'s> AsRef<HandleScope<'s, Context>> for CallbackScope<'s>[src]

impl<'s, C> AsRef<Isolate> for HandleScope<'s, C>[src]

impl<'s> Deref for HandleScope<'s, ()>[src]

type Target = Isolate

The resulting type after dereferencing.

impl<'s> Deref for HandleScope<'s>[src]

type Target = HandleScope<'s, ()>

The resulting type after dereferencing.

impl<'s> DerefMut for HandleScope<'s, ()>[src]

impl<'s> DerefMut for HandleScope<'s>[src]

impl<'s, C> Drop for HandleScope<'s, C>[src]

Auto Trait Implementations

impl<'s, C = Context> !RefUnwindSafe for HandleScope<'s, C>

impl<'s, C = Context> !Send for HandleScope<'s, C>

impl<'s, C = Context> !Sync for HandleScope<'s, C>

impl<'s, C> Unpin for HandleScope<'s, C>

impl<'s, C = Context> !UnwindSafe for HandleScope<'s, C>

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.