Trait neon::object::Object

source ·
pub trait Object: Value {
    fn get_opt<'a, V: Value, C: Context<'a>, K: PropertyKey>(
        &self,
        cx: &mut C,
        key: K
    ) -> NeonResult<Option<Handle<'a, V>>> { ... } fn get_value<'a, C: Context<'a>, K: PropertyKey>(
        &self,
        cx: &mut C,
        key: K
    ) -> NeonResult<Handle<'a, JsValue>> { ... } fn get<'a, V: Value, C: Context<'a>, K: PropertyKey>(
        &self,
        cx: &mut C,
        key: K
    ) -> NeonResult<Handle<'a, V>> { ... } fn get_own_property_names<'a, C: Context<'a>>(
        &self,
        cx: &mut C
    ) -> JsResult<'a, JsArray> { ... } fn freeze<'a, C: Context<'a>>(&self, cx: &mut C) -> NeonResult<&Self> { ... } fn seal<'a, C: Context<'a>>(&self, cx: &mut C) -> NeonResult<&Self> { ... } fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
        &self,
        cx: &mut C,
        key: K,
        val: Handle<'_, W>
    ) -> NeonResult<bool> { ... } fn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self> { ... } fn call_method_with<'a, C, K>(
        &self,
        cx: &mut C,
        method: K
    ) -> NeonResult<CallOptions<'a>>
    where
        C: Context<'a>,
        K: PropertyKey
, { ... } }
Expand description

The trait of all object types.

Provided Methods§

Gets a property from a JavaScript object that may be undefined and attempts to downcast the value if it existed.

Gets a property from a JavaScript object as a JsValue.

If a getter is defined on the object, it will be called.

Gets a property from a JavaScript object and attempts to downcast as a specific type. Equivalent to calling obj.get_value(&mut cx)?.downcast_or_throw(&mut cx).

Throws an exception if the value is a different type.

Available on crate feature napi-6 only.

Implementors§