PinnedRef

Struct PinnedRef 

Source
pub struct PinnedRef<'p, T>(/* private fields */);

Implementations§

Source§

impl<'s> PinnedRef<'s, HandleScope<'_>>

Source

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

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

Source

pub fn get_entered_or_microtask_context(&self) -> Local<'_, Context>

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.

Source

pub fn get_isolate_data_from_snapshot_once<T>( &self, index: usize, ) -> Result<Local<'s, T>, DataError>
where T: 'static, for<'l> <Local<'l, Data> as TryInto<Local<'l, T>>>::Error: ToDataError, for<'l> Local<'l, Data>: TryInto<Local<'l, T>>,

Return data that was previously attached to the isolate snapshot via SnapshotCreator, and removes the reference to it. If called again with same index argument, this function returns DataError::NoData.

The value that was stored in the snapshot must either match or be convertible to type parameter T, otherwise DataError::BadType is returned.

Source

pub fn get_context_data_from_snapshot_once<T>( &self, index: usize, ) -> Result<Local<'s, T>, DataError>
where T: 'static, for<'l> <Local<'l, Data> as TryInto<Local<'l, T>>>::Error: ToDataError, for<'l> Local<'l, Data>: TryInto<Local<'l, T>>,

Return data that was previously attached to the context snapshot via SnapshotCreator, and removes the reference to it. If called again with same index argument, this function returns DataError::NoData.

The value that was stored in the snapshot must either match or be convertible to type parameter T, otherwise DataError::BadType is returned.

Source

pub fn set_promise_hooks( &self, init_hook: Option<Local<'_, Function>>, before_hook: Option<Local<'_, Function>>, after_hook: Option<Local<'_, Function>>, resolve_hook: Option<Local<'_, Function>>, )

Source

pub fn set_continuation_preserved_embedder_data(&self, data: Local<'_, Value>)

Source

pub fn get_continuation_preserved_embedder_data(&self) -> Local<'s, Value>

Source

pub fn get_current_host_defined_options(&self) -> Option<Local<'s, Data>>

Returns the host defined options set for currently running script or module, if available.

Source§

impl<'p> PinnedRef<'p, HandleScope<'_, ()>>

Source

pub fn throw_exception(&self, exception: Local<'p, Value>) -> Local<'p, Value>

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.

Source

pub unsafe fn unseal<'a, T>(&self, v: SealedLocal<T>) -> Local<'a, T>

Open a handle passed from V8 in the current scope.

§Safety

The handle must be rooted in this scope.

Source§

impl<'scope, 'obj: 'scope, 'iso: 'obj, P: GetIsolate> PinnedRef<'_, TryCatch<'scope, 'obj, P>>
where PinnedRef<'obj, P>: AsRef<PinnedRef<'obj, HandleScope<'iso>>>,

Source

pub fn has_caught(&self) -> bool

Returns true if an exception has been caught by this try/catch block.

Source

pub fn can_continue(&self) -> bool

For certain types of exceptions, it makes no sense to continue execution.

If CanContinue returns false, the correct action is to perform any C++ cleanup needed and then return. If CanContinue returns false and HasTerminated returns true, it is possible to call CancelTerminateExecution in order to continue calling into the engine.

Source

pub fn has_terminated(&self) -> bool

Returns true if an exception has been caught due to script execution being terminated.

There is no JavaScript representation of an execution termination exception. Such exceptions are thrown when the TerminateExecution methods are called to terminate a long-running script.

If such an exception has been thrown, HasTerminated will return true, indicating that it is possible to call CancelTerminateExecution in order to continue calling into the engine.

Source

pub fn is_verbose(&self) -> bool

Returns true if verbosity is enabled.

Source

pub fn set_verbose(&mut self, value: bool)

Set verbosity of the external exception handler.

By default, exceptions that are caught by an external exception handler are not reported. Call SetVerbose with true on an external exception handler to have exceptions caught by the handler reported as if they were not caught.

Source

pub fn set_capture_message(&mut self, value: bool)

Set whether or not this TryCatch should capture a Message object which holds source information about where the exception occurred. True by default.

Source

pub fn reset(&mut self)

Clears any exceptions that may have been caught by this try/catch block. After this method has been called, HasCaught() will return false. Cancels the scheduled exception if it is caught and ReThrow() is not called before.

It is not necessary to clear a try/catch block before using it again; if another exception is thrown the previously caught exception will just be overwritten. However, it is often a good idea since it makes it easier to determine which operation threw a given exception.

Source

pub fn exception(&self) -> Option<Local<'obj, Value>>

Source

pub fn message(&self) -> Option<Local<'obj, Message>>

Source

pub fn rethrow(&mut self) -> Option<Local<'obj, Value>>

Source

pub fn stack_trace(&self) -> Option<Local<'obj, Value>>

Source§

impl<'s, 'esc: 's, C> PinnedRef<'_, EscapableHandleScope<'s, 'esc, C>>

Source

pub fn escape<'a, T>(&mut self, value: Local<'a, T>) -> Local<'esc, T>
where for<'l> Local<'l, T>: Into<Local<'l, Data>>,

Pushes the value into the previous scope and returns a handle to it. Cannot be called twice.

Source§

impl<T> PinnedRef<'_, T>

Source

pub fn as_mut_ref(&mut self) -> PinnedRef<'_, T>

Trait Implementations§

Source§

impl<C> AsMut<Isolate> for PinnedRef<'_, CallbackScope<'_, C>>

Source§

fn as_mut(&mut self) -> &mut Isolate

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<C> AsMut<Isolate> for PinnedRef<'_, HandleScope<'_, C>>

Source§

fn as_mut(&mut self) -> &mut Isolate

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<C> AsMut<Isolate> for PinnedRef<'_, TryCatch<'_, '_, HandleScope<'_, C>>>

Source§

fn as_mut(&mut self) -> &mut Isolate

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<C> AsRef<Isolate> for PinnedRef<'_, AllowJavascriptExecutionScope<'_, '_, HandleScope<'_, C>>>

Source§

fn as_ref(&self) -> &Isolate

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<C> AsRef<Isolate> for PinnedRef<'_, CallbackScope<'_, C>>

Source§

fn as_ref(&self) -> &Isolate

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<C> AsRef<Isolate> for PinnedRef<'_, DisallowJavascriptExecutionScope<'_, '_, HandleScope<'_, C>>>

Source§

fn as_ref(&self) -> &Isolate

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<Isolate> for PinnedRef<'_, EscapableHandleScope<'_, '_>>

Source§

fn as_ref(&self) -> &Isolate

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<C> AsRef<Isolate> for PinnedRef<'_, HandleScope<'_, C>>

Source§

fn as_ref(&self) -> &Isolate

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<C> AsRef<Isolate> for PinnedRef<'_, TryCatch<'_, '_, HandleScope<'_, C>>>

Source§

fn as_ref(&self) -> &Isolate

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'obj, 'inner, C> AsRef<PinnedRef<'obj, HandleScope<'inner, C>>> for PinnedRef<'obj, HandleScope<'inner, C>>

Source§

fn as_ref(&self) -> &PinnedRef<'obj, HandleScope<'inner, C>>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'pin, 's, 'esc: 's, C> AsRef<PinnedRef<'pin, HandleScope<'s, C>>> for PinnedRef<'pin, EscapableHandleScope<'s, 'esc, C>>

Source§

fn as_ref(&self) -> &PinnedRef<'pin, HandleScope<'s, C>>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'obj, P> Deref for PinnedRef<'_, AllowJavascriptExecutionScope<'_, 'obj, P>>

Source§

type Target = PinnedRef<'obj, P>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'i> Deref for PinnedRef<'_, CallbackScope<'i>>

Source§

type Target = PinnedRef<'i, HandleScope<'i>>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'i> Deref for PinnedRef<'_, CallbackScope<'i, ()>>

Source§

type Target = PinnedRef<'i, HandleScope<'i, ()>>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'obj, P> Deref for PinnedRef<'_, DisallowJavascriptExecutionScope<'_, 'obj, P>>

Source§

type Target = PinnedRef<'obj, P>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Deref for PinnedRef<'_, HandleScope<'_, ()>>

Source§

type Target = Isolate

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'obj, 'iso, C> Deref for PinnedRef<'_, TryCatch<'_, 'obj, HandleScope<'iso, C>>>

Source§

type Target = PinnedRef<'obj, HandleScope<'iso, C>>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'borrow, 'scope: 'borrow, 'obj: 'borrow, 'esc: 'obj, C> Deref for PinnedRef<'_, TryCatch<'borrow, 'scope, EscapableHandleScope<'obj, 'esc, C>>>

Source§

type Target = PinnedRef<'scope, EscapableHandleScope<'obj, 'esc, C>>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'p, 's, 'esc: 's, C> Deref for PinnedRef<'p, EscapableHandleScope<'s, 'esc, C>>

Source§

type Target = PinnedRef<'p, HandleScope<'s, C>>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'p, 'i> Deref for PinnedRef<'p, HandleScope<'i>>

Source§

type Target = PinnedRef<'p, HandleScope<'i, ()>>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<P> DerefMut for PinnedRef<'_, AllowJavascriptExecutionScope<'_, '_, P>>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl DerefMut for PinnedRef<'_, CallbackScope<'_>>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl DerefMut for PinnedRef<'_, CallbackScope<'_, ()>>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<P> DerefMut for PinnedRef<'_, DisallowJavascriptExecutionScope<'_, '_, P>>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'s, 'esc: 's, C> DerefMut for PinnedRef<'_, EscapableHandleScope<'s, 'esc, C>>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl DerefMut for PinnedRef<'_, HandleScope<'_>>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl DerefMut for PinnedRef<'_, HandleScope<'_, ()>>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<C> DerefMut for PinnedRef<'_, TryCatch<'_, '_, HandleScope<'_, C>>>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'borrow, 'scope: 'borrow, 'obj: 'borrow, 'esc: 'obj, C> DerefMut for PinnedRef<'_, TryCatch<'borrow, 'scope, EscapableHandleScope<'obj, 'esc, C>>>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'p, T> From<Pin<&'p mut T>> for PinnedRef<'p, T>

Source§

fn from(value: Pin<&'p mut T>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'p, T> Freeze for PinnedRef<'p, T>

§

impl<'p, T> RefUnwindSafe for PinnedRef<'p, T>
where T: RefUnwindSafe,

§

impl<'p, T> Send for PinnedRef<'p, T>
where T: Send,

§

impl<'p, T> Sync for PinnedRef<'p, T>
where T: Sync,

§

impl<'p, T> Unpin for PinnedRef<'p, T>

§

impl<'p, T> !UnwindSafe for PinnedRef<'p, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,