Struct napi_h::JsArrayBuffer
source · pub struct JsArrayBuffer(/* private fields */);
Implementations§
source§impl JsArrayBuffer
impl JsArrayBuffer
pub fn detach(self) -> Result<()>
pub fn is_detached(&self) -> Result<bool>
pub fn into_value(self) -> Result<JsArrayBufferValue>
pub fn into_typedarray( self, typedarray_type: TypedArrayType, length: usize, byte_offset: usize ) -> Result<JsTypedArray>
pub fn into_dataview( self, length: usize, byte_offset: usize ) -> Result<JsDataView>
pub fn into_ref(self) -> Result<Ref<JsArrayBufferValue>>
source§impl JsArrayBuffer
impl JsArrayBuffer
pub fn into_unknown(self) -> JsUnknown
pub fn coerce_to_bool(self) -> Result<JsBoolean>
pub fn coerce_to_number(self) -> Result<JsNumber>
pub fn coerce_to_string(self) -> Result<JsString>
pub fn coerce_to_object(self) -> Result<JsObject>
pub fn is_date(&self) -> Result<bool>
pub fn is_promise(&self) -> Result<bool>
pub fn is_error(&self) -> Result<bool>
pub fn is_typedarray(&self) -> Result<bool>
pub fn is_dataview(&self) -> Result<bool>
pub fn is_array(&self) -> Result<bool>
pub fn is_buffer(&self) -> Result<bool>
pub fn instanceof<Constructor>(&self, constructor: Constructor) -> Result<bool>where
Constructor: NapiRaw,
source§impl JsArrayBuffer
impl JsArrayBuffer
pub fn set_property<K, V>(&mut self, key: K, value: V) -> Result<()>
pub fn get_property<K, T>(&self, key: K) -> Result<T>
pub fn get_property_unchecked<K, T>(&self, key: K) -> Result<T>
pub fn set_named_property<T>(&mut self, name: &str, value: T) -> Result<()>where
T: ToNapiValue,
pub fn create_named_method( &mut self, name: &str, function: Callback ) -> Result<()>
pub fn get_named_property<T>(&self, name: &str) -> Result<T>where
T: FromNapiValue + ValidateNapiValue,
pub fn get_named_property_unchecked<T>(&self, name: &str) -> Result<T>where
T: FromNapiValue,
pub fn has_named_property<N: AsRef<str>>(&self, name: N) -> Result<bool>
pub fn delete_property<S>(&mut self, name: S) -> Result<bool>where
S: NapiRaw,
pub fn delete_named_property(&mut self, name: &str) -> Result<bool>
pub fn has_own_property(&self, key: &str) -> Result<bool>
pub fn has_own_property_js<K>(&self, key: K) -> Result<bool>where
K: NapiRaw,
pub fn has_property(&self, name: &str) -> Result<bool>
pub fn has_property_js<K>(&self, name: K) -> Result<bool>where
K: NapiRaw,
pub fn get_property_names(&self) -> Result<JsObject>
sourcepub fn get_all_property_names(
&self,
mode: KeyCollectionMode,
filter: KeyFilter,
conversion: KeyConversion
) -> Result<JsObject>
pub fn get_all_property_names( &self, mode: KeyCollectionMode, filter: KeyFilter, conversion: KeyConversion ) -> Result<JsObject>
https://nodejs.org/api/n-api.html#n_api_napi_get_all_property_names
return Array
of property names
sourcepub fn get_prototype<T>(&self) -> Result<T>where
T: NapiValue,
pub fn get_prototype<T>(&self) -> Result<T>where
T: NapiValue,
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,
pub fn set_element<T>(&mut self, index: u32, value: T) -> Result<()>where
T: NapiRaw,
pub fn has_element(&self, index: u32) -> Result<bool>
pub fn delete_element(&mut self, index: u32) -> Result<bool>
pub fn get_element<T>(&self, index: u32) -> Result<T>where
T: NapiValue,
pub fn get_element_unchecked<T>(&self, index: u32) -> Result<T>where
T: NapiValue,
sourcepub fn define_properties(&mut self, properties: &[Property]) -> Result<()>
pub fn define_properties(&mut self, properties: &[Property]) -> Result<()>
This method allows the efficient definition of multiple properties on a given object.
sourcepub fn get_array_length(&self) -> Result<u32>
pub fn get_array_length(&self) -> Result<u32>
Perform is_array
check before get the length
if Object
is not array, ArrayExpected
error returned
sourcepub fn get_array_length_unchecked(&self) -> Result<u32>
pub fn get_array_length_unchecked(&self) -> Result<u32>
use this API if you can ensure this Object
is Array
pub fn freeze(&mut self) -> Result<()>
pub fn seal(&mut self) -> Result<()>
Trait Implementations§
source§impl<'env> NapiRaw for &'env JsArrayBuffer
impl<'env> NapiRaw for &'env JsArrayBuffer
unsafe fn raw(&self) -> napi_value
source§impl NapiRaw for JsArrayBuffer
impl NapiRaw for JsArrayBuffer
unsafe fn raw(&self) -> napi_value
source§impl NapiValue for JsArrayBuffer
impl NapiValue for JsArrayBuffer
unsafe fn from_raw(env: napi_env, value: napi_value) -> Result<JsArrayBuffer>
unsafe fn from_raw_unchecked(env: napi_env, value: napi_value) -> JsArrayBuffer
source§impl TryFrom<JsUnknown> for JsArrayBuffer
impl TryFrom<JsUnknown> for JsArrayBuffer
source§impl TypeName for JsArrayBuffer
impl TypeName for JsArrayBuffer
source§impl ValidateNapiValue for JsArrayBuffer
impl ValidateNapiValue for JsArrayBuffer
source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Auto Trait Implementations§
impl Freeze for JsArrayBuffer
impl RefUnwindSafe for JsArrayBuffer
impl !Send for JsArrayBuffer
impl !Sync for JsArrayBuffer
impl Unpin for JsArrayBuffer
impl UnwindSafe for JsArrayBuffer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> FromNapiValue for Twhere
T: NapiValue,
impl<T> FromNapiValue for Twhere
T: NapiValue,
source§unsafe fn from_napi_value(
env: *mut napi_env__,
napi_val: *mut napi_value__
) -> Result<T, Error>
unsafe fn from_napi_value( env: *mut napi_env__, napi_val: *mut napi_value__ ) -> Result<T, Error>
Safety Read more
fn from_unknown(value: JsUnknown) -> Result<Self>
source§impl<T> JsValuesTupleIntoVec for Twhere
T: ToNapiValue,
impl<T> JsValuesTupleIntoVec for Twhere
T: ToNapiValue,
fn into_vec(self, env: *mut napi_env__) -> Result<Vec<*mut napi_value__>, Error>
source§impl<T> ToNapiValue for Twhere
T: NapiRaw,
impl<T> ToNapiValue for Twhere
T: NapiRaw,
source§unsafe fn to_napi_value(
_env: *mut napi_env__,
val: T
) -> Result<*mut napi_value__, Error>
unsafe fn to_napi_value( _env: *mut napi_env__, val: T ) -> Result<*mut napi_value__, Error>
Safety Read more