Struct neon::handle::Handle[][src]

pub struct Handle<'a, T: Managed + 'a> { /* fields omitted */ }

A safely rooted handle to a JS value in memory that is managed by the garbage collector.


impl<'a, T: Value> Handle<'a, T>

Safely upcast a handle to a supertype.

This method does not require an execution context because it only copies a handle.

Tests whether this value is an instance of the given type.


let v: Handle<JsValue> = cx.number(17).upcast();
v.is_a::<JsString>(); // false
v.is_a::<JsNumber>(); // true
v.is_a::<JsValue>();  // true

Attempts to downcast a handle to another type, which may fail. A failure to downcast does not throw a JavaScript exception, so it's OK to continue interacting with the JS engine if this method produces an Err result.

Attempts to downcast a handle to another type, raising a JavaScript TypeError exception on failure. This method is a convenient shorthand, equivalent to self.downcast::<U>().or_throw::<C>(cx).

Trait Implementations

impl<'a, T: Clone + Managed + 'a> Clone for Handle<'a, T>

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a, T: Copy + Managed + 'a> Copy for Handle<'a, T>

impl<'a, T: Managed + 'a> PartialEq for Handle<'a, T>

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a, T: Managed + 'a> Eq for Handle<'a, T>

impl<'a, T: Managed> Deref for Handle<'a, T>

The resulting type after dereferencing.

Dereferences the value.

impl<'a, T: Managed> DerefMut for Handle<'a, T>

Mutably dereferences the value.

impl<'a, K: Value> PropertyKey for Handle<'a, K>

Auto Trait Implementations

impl<'a, T> Send for Handle<'a, T> where
    T: Send + Sync

impl<'a, T> Sync for Handle<'a, T> where
    T: Sync