[−][src]Struct neon::handle::Handle
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]
&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
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]
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,
T: RefUnwindSafe,
impl<'a, T> Send for Handle<'a, T> where
T: Send + Sync,
T: Send + Sync,
impl<'a, T> Sync for Handle<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Unpin for Handle<'a, T> where
T: Unpin,
T: Unpin,
impl<'a, T> UnwindSafe for Handle<'a, T> where
T: RefUnwindSafe + UnwindSafe,
T: RefUnwindSafe + UnwindSafe,
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,