[−][src]Struct rusty_v8::Global
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
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
Auto Trait Implementations
impl<T> RefUnwindSafe for Global<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> !Sync for Global<T>
impl<T> Unpin for Global<T>
impl<T> UnwindSafe for Global<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,