Struct neon::handle::Handle [−][src]
#[repr(C)]pub struct Handle<'a, T: Managed + 'a> { /* fields omitted */ }
A handle to a JavaScript value that is owned by the JavaScript engine.
Implementations
impl<'a, T: Value> Handle<'a, T>
[src]
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]
&self,
cx: &mut C
) -> JsResult<'a, U>
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
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Handle<'a, T> where
T: RefUnwindSafe,
impl<'a, T> RefUnwindSafe for Handle<'a, T> where
T: RefUnwindSafe,
impl<'a, T> UnwindSafe for Handle<'a, T> where
T: RefUnwindSafe + UnwindSafe,
impl<'a, T> UnwindSafe for Handle<'a, T> where
T: RefUnwindSafe + UnwindSafe,