pub struct JsTypedArray<T: Binary>(/* private fields */);
Expand description
The family of JavaScript typed array types.
§Typed Arrays
JavaScript’s typed arrays are objects that allow efficiently reading
and writing raw binary data in memory. In Neon, the generic type JsTypedArray<T>
represents a JavaScript typed array with element type T
. For example, a JavaScript
Uint32Array
represents a compact array of 32-bit unsigned integers,
and is represented in Neon as a JsTypedArray<u32>
.
Neon also offers a set of convenience shorthands for concrete instances of
JsTypedArray
, named after their corresponding JavaScript type. For example,
JsTypedArray<u32>
can also be referred to as JsUint32Array
.
The following table shows the complete set of typed array types, with both their JavaScript and Neon types:
Rust Type | Convenience Type | JavaScript Type |
---|---|---|
JsTypedArray< u8 > | JsUint8Array | Uint8Array |
JsTypedArray< i8 > | JsInt8Array | Int8Array |
JsTypedArray< u16 > | JsUint16Array | Uint16Array |
JsTypedArray< i16 > | JsInt16Array | Int16Array |
JsTypedArray< u32 > | JsUint32Array | Uint32Array |
JsTypedArray< i32 > | JsInt32Array | Int32Array |
JsTypedArray< u64 > | JsBigUint64Array | BigUint64Array |
JsTypedArray< i64 > | JsBigInt64Array | BigInt64Array |
JsTypedArray< f32 > | JsFloat32Array | Float32Array |
JsTypedArray< f64 > | JsFloat64Array | Float64Array |
§Example: Creating an integer array
This example creates a typed array of unsigned 32-bit integers with a user-specified length:
fn create_int_array(mut cx: FunctionContext) -> JsResult<JsTypedArray<u32>> {
let len = cx.argument::<JsNumber>(0)?.value(&mut cx) as usize;
JsTypedArray::new(&mut cx, len)
}
§Buffers
Typed arrays are managed with the ArrayBuffer
type, which controls
the storage of the underlying data buffer, and several typed views for managing access
to the buffer. Neon provides access to the ArrayBuffer
class with the
JsArrayBuffer
type.
Node also provides a Buffer
type, which is built on top of ArrayBuffer
and provides additional functionality. Neon provides access to the Buffer
class
with the JsBuffer
type.
Many of Node’s I/O APIs work with these types, and they can also be used for compact in-memory data structures, which can be shared efficiently between JavaScript and Rust without copying.
Implementations§
Source§impl<T: Binary> JsTypedArray<T>where
JsTypedArray<T>: Value,
impl<T: Binary> JsTypedArray<T>where
JsTypedArray<T>: Value,
Sourcepub fn from_slice<'cx, C>(cx: &mut C, slice: &[T]) -> JsResult<'cx, Self>where
C: Context<'cx>,
pub fn from_slice<'cx, C>(cx: &mut C, slice: &[T]) -> JsResult<'cx, Self>where
C: Context<'cx>,
Constructs an instance from a slice by copying its contents.
This method is defined on JsTypedArray
as a convenience and delegates to
TypedArray::from_slice
.
Source§impl<T> JsTypedArray<T>
impl<T> JsTypedArray<T>
Sourcepub fn from_buffer<'cx, 'b: 'cx, C>(
cx: &mut C,
buffer: Handle<'b, JsArrayBuffer>,
) -> JsResult<'cx, Self>where
C: Context<'cx>,
pub fn from_buffer<'cx, 'b: 'cx, C>(
cx: &mut C,
buffer: Handle<'b, JsArrayBuffer>,
) -> JsResult<'cx, Self>where
C: Context<'cx>,
Constructs a typed array that views buffer
.
The resulting typed array has (buffer.size() / size_of::<T>())
elements.
Sourcepub fn from_region<'c, 'r, C>(
cx: &mut C,
region: &Region<'r, T>,
) -> JsResult<'c, Self>where
C: Context<'c>,
pub fn from_region<'c, 'r, C>(
cx: &mut C,
region: &Region<'r, T>,
) -> JsResult<'c, Self>where
C: Context<'c>,
Constructs a typed array for the specified buffer region.
The resulting typed array has region.len()
elements and a size of
region.size()
bytes.
Throws an exception if the region is invalid, for example if the starting offset is not properly aligned, or the length goes beyond the end of the buffer.
Sourcepub fn region<'cx, C>(&self, cx: &mut C) -> Region<'cx, T>where
C: Context<'cx>,
pub fn region<'cx, C>(&self, cx: &mut C) -> Region<'cx, T>where
C: Context<'cx>,
Returns information about the backing buffer region for this typed array.
Sourcepub fn new<'cx, C>(cx: &mut C, len: usize) -> JsResult<'cx, Self>where
C: Context<'cx>,
pub fn new<'cx, C>(cx: &mut C, len: usize) -> JsResult<'cx, Self>where
C: Context<'cx>,
Constructs a new typed array of length len
.
The resulting typed array has a newly allocated storage buffer of
size (len * size_of::<T>())
bytes.
Sourcepub fn buffer<'cx, C>(&self, cx: &mut C) -> Handle<'cx, JsArrayBuffer>where
C: Context<'cx>,
pub fn buffer<'cx, C>(&self, cx: &mut C) -> Handle<'cx, JsArrayBuffer>where
C: Context<'cx>,
Returns the JsArrayBuffer
that owns the underlying storage buffer
for this typed array.
Note that the typed array might only reference a region of the buffer; use the
offset()
and
size()
methods to
determine the region.
Trait Implementations§
Source§impl Object for JsTypedArray<f32>
impl Object for JsTypedArray<f32>
Source§fn prop<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> PropOptions<'a, 'cx, Self, K>
fn prop<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> PropOptions<'a, 'cx, Self, K>
PropOptions
for accessing a property. Read moreSource§fn method<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> NeonResult<BindOptions<'a, 'cx>>
fn method<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> NeonResult<BindOptions<'a, 'cx>>
this
to the object. Read moreSource§fn 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>>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>
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>
Source§fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
&self,
cx: &mut C,
key: K,
val: Handle<'_, W>,
) -> NeonResult<bool>
fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>( &self, cx: &mut C, key: K, val: Handle<'_, W>, ) -> NeonResult<bool>
Object::prop()
insteadfn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self>
Source§fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
Object::method()
insteadSource§impl Object for JsTypedArray<f64>
impl Object for JsTypedArray<f64>
Source§fn prop<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> PropOptions<'a, 'cx, Self, K>
fn prop<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> PropOptions<'a, 'cx, Self, K>
PropOptions
for accessing a property. Read moreSource§fn method<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> NeonResult<BindOptions<'a, 'cx>>
fn method<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> NeonResult<BindOptions<'a, 'cx>>
this
to the object. Read moreSource§fn 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>>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>
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>
Source§fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
&self,
cx: &mut C,
key: K,
val: Handle<'_, W>,
) -> NeonResult<bool>
fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>( &self, cx: &mut C, key: K, val: Handle<'_, W>, ) -> NeonResult<bool>
Object::prop()
insteadfn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self>
Source§fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
Object::method()
insteadSource§impl Object for JsTypedArray<i16>
impl Object for JsTypedArray<i16>
Source§fn prop<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> PropOptions<'a, 'cx, Self, K>
fn prop<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> PropOptions<'a, 'cx, Self, K>
PropOptions
for accessing a property. Read moreSource§fn method<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> NeonResult<BindOptions<'a, 'cx>>
fn method<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> NeonResult<BindOptions<'a, 'cx>>
this
to the object. Read moreSource§fn 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>>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>
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>
Source§fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
&self,
cx: &mut C,
key: K,
val: Handle<'_, W>,
) -> NeonResult<bool>
fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>( &self, cx: &mut C, key: K, val: Handle<'_, W>, ) -> NeonResult<bool>
Object::prop()
insteadfn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self>
Source§fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
Object::method()
insteadSource§impl Object for JsTypedArray<i32>
impl Object for JsTypedArray<i32>
Source§fn prop<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> PropOptions<'a, 'cx, Self, K>
fn prop<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> PropOptions<'a, 'cx, Self, K>
PropOptions
for accessing a property. Read moreSource§fn method<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> NeonResult<BindOptions<'a, 'cx>>
fn method<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> NeonResult<BindOptions<'a, 'cx>>
this
to the object. Read moreSource§fn 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>>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>
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>
Source§fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
&self,
cx: &mut C,
key: K,
val: Handle<'_, W>,
) -> NeonResult<bool>
fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>( &self, cx: &mut C, key: K, val: Handle<'_, W>, ) -> NeonResult<bool>
Object::prop()
insteadfn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self>
Source§fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
Object::method()
insteadSource§impl Object for JsTypedArray<i64>
impl Object for JsTypedArray<i64>
Source§fn prop<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> PropOptions<'a, 'cx, Self, K>
fn prop<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> PropOptions<'a, 'cx, Self, K>
PropOptions
for accessing a property. Read moreSource§fn method<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> NeonResult<BindOptions<'a, 'cx>>
fn method<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> NeonResult<BindOptions<'a, 'cx>>
this
to the object. Read moreSource§fn 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>>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>
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>
Source§fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
&self,
cx: &mut C,
key: K,
val: Handle<'_, W>,
) -> NeonResult<bool>
fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>( &self, cx: &mut C, key: K, val: Handle<'_, W>, ) -> NeonResult<bool>
Object::prop()
insteadfn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self>
Source§fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
Object::method()
insteadSource§impl Object for JsTypedArray<i8>
impl Object for JsTypedArray<i8>
Source§fn prop<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> PropOptions<'a, 'cx, Self, K>
fn prop<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> PropOptions<'a, 'cx, Self, K>
PropOptions
for accessing a property. Read moreSource§fn method<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> NeonResult<BindOptions<'a, 'cx>>
fn method<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> NeonResult<BindOptions<'a, 'cx>>
this
to the object. Read moreSource§fn 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>>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>
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>
Source§fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
&self,
cx: &mut C,
key: K,
val: Handle<'_, W>,
) -> NeonResult<bool>
fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>( &self, cx: &mut C, key: K, val: Handle<'_, W>, ) -> NeonResult<bool>
Object::prop()
insteadfn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self>
Source§fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
Object::method()
insteadSource§impl Object for JsTypedArray<u16>
impl Object for JsTypedArray<u16>
Source§fn prop<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> PropOptions<'a, 'cx, Self, K>
fn prop<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> PropOptions<'a, 'cx, Self, K>
PropOptions
for accessing a property. Read moreSource§fn method<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> NeonResult<BindOptions<'a, 'cx>>
fn method<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> NeonResult<BindOptions<'a, 'cx>>
this
to the object. Read moreSource§fn 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>>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>
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>
Source§fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
&self,
cx: &mut C,
key: K,
val: Handle<'_, W>,
) -> NeonResult<bool>
fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>( &self, cx: &mut C, key: K, val: Handle<'_, W>, ) -> NeonResult<bool>
Object::prop()
insteadfn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self>
Source§fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
Object::method()
insteadSource§impl Object for JsTypedArray<u32>
impl Object for JsTypedArray<u32>
Source§fn prop<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> PropOptions<'a, 'cx, Self, K>
fn prop<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> PropOptions<'a, 'cx, Self, K>
PropOptions
for accessing a property. Read moreSource§fn method<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> NeonResult<BindOptions<'a, 'cx>>
fn method<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> NeonResult<BindOptions<'a, 'cx>>
this
to the object. Read moreSource§fn 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>>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>
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>
Source§fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
&self,
cx: &mut C,
key: K,
val: Handle<'_, W>,
) -> NeonResult<bool>
fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>( &self, cx: &mut C, key: K, val: Handle<'_, W>, ) -> NeonResult<bool>
Object::prop()
insteadfn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self>
Source§fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
Object::method()
insteadSource§impl Object for JsTypedArray<u64>
impl Object for JsTypedArray<u64>
Source§fn prop<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> PropOptions<'a, 'cx, Self, K>
fn prop<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> PropOptions<'a, 'cx, Self, K>
PropOptions
for accessing a property. Read moreSource§fn method<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> NeonResult<BindOptions<'a, 'cx>>
fn method<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> NeonResult<BindOptions<'a, 'cx>>
this
to the object. Read moreSource§fn 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>>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>
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>
Source§fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
&self,
cx: &mut C,
key: K,
val: Handle<'_, W>,
) -> NeonResult<bool>
fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>( &self, cx: &mut C, key: K, val: Handle<'_, W>, ) -> NeonResult<bool>
Object::prop()
insteadfn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self>
Source§fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
Object::method()
insteadSource§impl Object for JsTypedArray<u8>
impl Object for JsTypedArray<u8>
Source§fn prop<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> PropOptions<'a, 'cx, Self, K>
fn prop<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> PropOptions<'a, 'cx, Self, K>
PropOptions
for accessing a property. Read moreSource§fn method<'a, 'cx: 'a, K: PropertyKey>(
&self,
cx: &'a mut Cx<'cx>,
key: K,
) -> NeonResult<BindOptions<'a, 'cx>>
fn method<'a, 'cx: 'a, K: PropertyKey>( &self, cx: &'a mut Cx<'cx>, key: K, ) -> NeonResult<BindOptions<'a, 'cx>>
this
to the object. Read moreSource§fn 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>>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>>
Object::prop()
insteadSource§fn 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>
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>
Source§fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
&self,
cx: &mut C,
key: K,
val: Handle<'_, W>,
) -> NeonResult<bool>
fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>( &self, cx: &mut C, key: K, val: Handle<'_, W>, ) -> NeonResult<bool>
Object::prop()
insteadfn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self>
Source§fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
fn call_method_with<'a, C, K>(
&self,
cx: &mut C,
method: K,
) -> NeonResult<CallOptions<'a>>where
C: Context<'a>,
K: PropertyKey,
Object::method()
insteadSource§impl<T> TypedArray for JsTypedArray<T>
impl<T> TypedArray for JsTypedArray<T>
type Item = T
Source§fn as_slice<'cx, 'a, C>(&self, cx: &'a C) -> &'a [Self::Item]where
C: Context<'cx>,
fn as_slice<'cx, 'a, C>(&self, cx: &'a C) -> &'a [Self::Item]where
C: Context<'cx>,
Source§fn as_mut_slice<'cx, 'a, C>(&mut self, cx: &'a mut C) -> &'a mut [Self::Item]where
C: Context<'cx>,
fn as_mut_slice<'cx, 'a, C>(&mut self, cx: &'a mut C) -> &'a mut [Self::Item]where
C: Context<'cx>,
Source§fn try_borrow<'cx, 'b, C>(
&self,
lock: &'b Lock<'b, C>,
) -> Result<Ref<'b, Self::Item>, BorrowError>where
C: Context<'cx>,
fn try_borrow<'cx, 'b, C>(
&self,
lock: &'b Lock<'b, C>,
) -> Result<Ref<'b, Self::Item>, BorrowError>where
C: Context<'cx>,
Source§fn try_borrow_mut<'cx, 'a, C>(
&mut self,
lock: &'a Lock<'a, C>,
) -> Result<RefMut<'a, Self::Item>, BorrowError>where
C: Context<'cx>,
fn try_borrow_mut<'cx, 'a, C>(
&mut self,
lock: &'a Lock<'a, C>,
) -> Result<RefMut<'a, Self::Item>, BorrowError>where
C: Context<'cx>,
Source§impl Value for JsTypedArray<f32>
impl Value for JsTypedArray<f32>
Source§impl Value for JsTypedArray<f64>
impl Value for JsTypedArray<f64>
Source§impl Value for JsTypedArray<i16>
impl Value for JsTypedArray<i16>
Source§impl Value for JsTypedArray<i32>
impl Value for JsTypedArray<i32>
Source§impl Value for JsTypedArray<i64>
impl Value for JsTypedArray<i64>
Source§impl Value for JsTypedArray<i8>
impl Value for JsTypedArray<i8>
Source§impl Value for JsTypedArray<u16>
impl Value for JsTypedArray<u16>
Source§impl Value for JsTypedArray<u32>
impl Value for JsTypedArray<u32>
Source§impl Value for JsTypedArray<u64>
impl Value for JsTypedArray<u64>
Source§impl Value for JsTypedArray<u8>
impl Value for JsTypedArray<u8>
Auto Trait Implementations§
impl<T> Freeze for JsTypedArray<T>
impl<T> RefUnwindSafe for JsTypedArray<T>where
T: RefUnwindSafe,
impl<T> !Send for JsTypedArray<T>
impl<T> !Sync for JsTypedArray<T>
impl<T> Unpin for JsTypedArray<T>where
T: Unpin,
impl<T> UnwindSafe for JsTypedArray<T>where
T: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more