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

#[repr(C)]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.

Implementations

impl<'a, T: Value> Handle<'a, T>[src]

pub fn upcast<U: Value + SuperType<T>>(&self) -> Handle<'a, U>[src]

Safely upcast a handle to a supertype.

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

pub fn is_a<U: Value>(&self) -> bool[src]

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

Example:

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

pub fn downcast<U: Value>(&self) -> DowncastResult<'a, T, U>[src]

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.

pub fn downcast_or_throw<'b, U: Value, C: Context<'b>>(
    &self,
    cx: &mut C
) -> JsResult<'a, U>
[src]

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>[src]

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

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

type Target = T

The resulting type after dereferencing.

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

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

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

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

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for Handle<'a, T> where
    T: RefUnwindSafe
[src]

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

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

impl<'a, T> Unpin for Handle<'a, T> where
    T: Unpin
[src]

impl<'a, T> UnwindSafe for Handle<'a, T> where
    T: RefUnwindSafe + UnwindSafe
[src]

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.