Skip to main content

UnenteredIsolate

Struct UnenteredIsolate 

Source
pub struct UnenteredIsolate { /* private fields */ }
Expand description

An isolate that must be accessed via Locker.

Unlike OwnedIsolate, this isolate does not automatically enter itself upon creation. Instead, you must use a Locker to access it:

let mut isolate = v8::Isolate::new_unentered(Default::default());

// Access the isolate through a Locker
{
    let mut locker = v8::Locker::new(&mut isolate);
    let scope = &mut v8::HandleScope::new(&mut *locker);
    // ... use scope ...
}

// The locker is dropped, isolate can be used from another thread

§Thread Safety

UnenteredIsolate implements Send, meaning it can be transferred between threads. However, V8 isolates are not thread-safe by themselves. You must:

  1. Only access the isolate through a Locker
  2. Never have multiple Lockers for the same isolate simultaneously (V8 will block if you try)

§Dropping

When dropped, the isolate will be properly disposed. The drop will panic if a Locker is currently held for this isolate.

Implementations§

Source§

impl UnenteredIsolate

Source

pub fn as_raw(&self) -> *mut RealIsolate

Returns the raw pointer to the underlying V8 isolate.

§Safety

The returned pointer is only valid while this UnenteredIsolate exists and should only be used while a Locker is held.

Trait Implementations§

Source§

impl Debug for UnenteredIsolate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for UnenteredIsolate

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for UnenteredIsolate

Auto Trait Implementations§

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<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,