Struct napi::JsObject[][src]

pub struct JsObject(_);

Implementations

impl JsObject[src]

pub fn add_finalizer<T, Hint, F>(
    &mut self,
    native: T,
    finalize_hint: Hint,
    finalize_cb: F
) -> Result<()> where
    T: 'static,
    Hint: 'static,
    F: FnOnce(FinalizeContext<T, Hint>), 
[src]

impl JsObject[src]

pub fn into_unknown(self) -> JsUnknown[src]

pub fn coerce_to_number(self) -> Result<JsNumber>[src]

pub fn coerce_to_string(self) -> Result<JsString>[src]

pub fn coerce_to_object(self) -> Result<JsObject>[src]

pub fn is_date(&self) -> Result<bool>[src]

pub fn is_promise(&self) -> Result<bool>[src]

pub fn is_error(&self) -> Result<bool>[src]

pub fn is_typedarray(&self) -> Result<bool>[src]

pub fn is_dataview(&self) -> Result<bool>[src]

pub fn is_array(&self) -> Result<bool>[src]

pub fn is_buffer(&self) -> Result<bool>[src]

pub fn instanceof<Constructor>(&self, constructor: Constructor) -> Result<bool> where
    Constructor: NapiRaw
[src]

pub fn freeze(&mut self) -> Result<()>[src]

pub fn seal(&mut self) -> Result<()>[src]

impl JsObject[src]

pub fn set_property<V>(&mut self, key: JsString, value: V) -> Result<()> where
    V: NapiRaw
[src]

pub fn get_property<K, T>(&self, key: K) -> Result<T> where
    K: NapiRaw,
    T: NapiValue
[src]

pub fn get_property_unchecked<K, T>(&self, key: K) -> Result<T> where
    K: NapiRaw,
    T: NapiValue
[src]

pub fn set_named_property<T>(&mut self, name: &str, value: T) -> Result<()> where
    T: NapiRaw
[src]

pub fn create_named_method(
    &mut self,
    name: &str,
    function: Callback
) -> Result<()>
[src]

pub fn get_named_property<T>(&self, name: &str) -> Result<T> where
    T: NapiValue
[src]

pub fn get_named_property_unchecked<T>(&self, name: &str) -> Result<T> where
    T: NapiValue
[src]

pub fn has_named_property(&self, name: &str) -> Result<bool>[src]

pub fn delete_property<S>(&mut self, name: S) -> Result<bool> where
    S: NapiRaw
[src]

pub fn delete_named_property(&mut self, name: &str) -> Result<bool>[src]

pub fn has_own_property(&self, key: &str) -> Result<bool>[src]

pub fn has_own_property_js<K>(&self, key: K) -> Result<bool> where
    K: NapiRaw
[src]

pub fn has_property(&self, name: &str) -> Result<bool>[src]

pub fn has_property_js<K>(&self, name: K) -> Result<bool> where
    K: NapiRaw
[src]

pub fn get_property_names(&self) -> Result<JsObject>[src]

pub fn get_all_property_names(
    &self,
    mode: KeyCollectionMode,
    filter: KeyFilter,
    conversion: KeyConversion
) -> Result<JsObject>
[src]

https://nodejs.org/api/n-api.html#n_api_napi_get_all_property_names return Array of property names

pub fn get_prototype<T>(&self) -> Result<T> where
    T: NapiValue
[src]

This returns the equivalent of Object.getPrototypeOf (which is not the same as the function’s prototype property).

pub fn get_prototype_unchecked<T>(&self) -> Result<T> where
    T: NapiValue
[src]

pub fn set_element<T>(&mut self, index: u32, value: T) -> Result<()> where
    T: NapiRaw
[src]

pub fn has_element(&self, index: u32) -> Result<bool>[src]

pub fn delete_element(&mut self, index: u32) -> Result<bool>[src]

pub fn get_element<T>(&self, index: u32) -> Result<T> where
    T: NapiValue
[src]

pub fn get_element_unchecked<T>(&self, index: u32) -> Result<T> where
    T: NapiValue
[src]

pub fn define_properties(&mut self, properties: &[Property<'_>]) -> Result<()>[src]

This method allows the efficient definition of multiple properties on a given object.

pub fn get_array_length(&self) -> Result<u32>[src]

Perform is_array check before get the length if Object is not array, ArrayExpected error returned

pub fn get_array_length_unchecked(&self) -> Result<u32>[src]

use this API if you can ensure this Object is Array

Trait Implementations

impl NapiRaw for JsObject[src]

unsafe fn raw(&self) -> napi_value[src]

impl<'env> NapiRaw for &'env JsObject[src]

unsafe fn raw(&self) -> napi_value[src]

impl NapiValue for JsObject[src]

impl TryFrom<JsUnknown> for JsObject[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(value: JsUnknown) -> Result<JsObject>[src]

Performs the conversion.

Auto Trait Implementations

impl RefUnwindSafe for JsObject

impl !Send for JsObject

impl !Sync for JsObject

impl Unpin for JsObject

impl UnwindSafe for JsObject

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.