[][src]Struct rusty_v8_m::Global

#[repr(C)]pub struct Global<T> { /* fields omitted */ }

An object reference that is independent of any handle scope. Where a Local handle only lives as long as the HandleScope in which it was allocated, a global handle remains valid until it is explicitly disposed using reset().

A global handle contains a reference to a storage cell within the V8 engine which holds an object value and which is updated by the garbage collector whenever the object is moved. A new storage cell can be created using the constructor or Global::set and existing handles can be disposed using Global::reset.

Methods

impl<T> Global<T>[src]

pub fn new() -> Self[src]

Construct a Global with no storage cell.

pub fn new_from(scope: &mut impl InIsolate, other: impl AnyHandle<T>) -> Self[src]

Construct a new Global from an existing handle. When the existing handle is non-empty, a new storage cell is created pointing to the same object, and no flags are set.

pub fn is_empty(&self) -> bool[src]

Returns true if this Global is empty, i.e., has not been assigned an object.

pub fn get<'sc>(&self, scope: &mut impl ToLocal<'sc>) -> Option<Local<'sc, T>>[src]

Construct a Local from this global handle.

pub fn set(&mut self, scope: &mut impl InIsolate, other: impl AnyHandle<T>)[src]

If non-empty, destroy the underlying storage cell and create a new one with the contents of other if other is non empty.

pub fn reset(&mut self, scope: &mut impl InIsolate)[src]

If non-empty, destroy the underlying storage cell IsEmpty() will return true after this call.

Trait Implementations

impl<T> Default for Global<T>[src]

impl<T> Drop for Global<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Global<T>

impl<T> !Send for Global<T>

impl<T> !Sync for Global<T>

impl<T> Unpin for Global<T>

impl<T> !UnwindSafe for Global<T>

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.