pub trait Object: Value {
// Provided methods
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§
sourcefn get_opt<'a, V: Value, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Option<Handle<'a, V>>>
fn get_opt<'a, V: Value, C: Context<'a>, K: PropertyKey>( &self, cx: &mut C, key: K ) -> NeonResult<Option<Handle<'a, V>>>
Gets a property from a JavaScript object that may be undefined
and
attempts to downcast the value if it existed.
sourcefn get_value<'a, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Handle<'a, JsValue>>
fn get_value<'a, C: Context<'a>, K: PropertyKey>( &self, cx: &mut C, key: K ) -> NeonResult<Handle<'a, JsValue>>
sourcefn get<'a, V: Value, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Handle<'a, V>>
fn get<'a, V: Value, C: Context<'a>, K: PropertyKey>( &self, cx: &mut C, key: K ) -> NeonResult<Handle<'a, V>>
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.
sourcefn get_own_property_names<'a, C: Context<'a>>(
&self,
cx: &mut C
) -> JsResult<'a, JsArray>
fn get_own_property_names<'a, C: Context<'a>>( &self, cx: &mut C ) -> JsResult<'a, JsArray>
Available on crate feature
napi-6
only.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,
Object Safety§
This trait is not object safe.