#[repr(transparent)]
pub struct TypedArray<'js, T>(_, _);
Available on crate feature array-buffer only.
Expand description

Rust representation of a javascript objects of TypedArray classes.

ES TypeRust Type
Int8ArrayTypedArray<i8>
Uint8ArrayTypedArray<u8>
Int16ArrayTypedArray<i16>
Uint16ArrayTypedArray<u16>
Int32ArrayTypedArray<i32>
Uint32ArrayTypedArray<u32>
Float32ArrayTypedArray<f32>
Float64ArrayTypedArray<f64>
BigInt64ArrayTypedArray<i64>
BigUint64ArrayTypedArray<u64>

Implementations

Create typed array from vector data

Create typed array from slice

Get the length of the typed array in elements.

Returns wether a typed array is empty.

Reference to value

Convert into value

Convert from value

Reference as an object

Convert into an object

Convert from an object

Get underlaying ArrayBuffer

Convert from an ArrayBuffer

Methods from Deref<Target = Object<'js>>

Initialize an object using ObjectDef

Get a new value

check wether the object contains a certain key.

Set a member of an object to a certain value

Remove a member of an object

Check the object for empty

Get the number of properties

Get own string enumerable property names of an object

Get own property names of an object

Get own string enumerable properties of an object

Get own properties of an object

Get own string enumerable property values of an object

Get own property values of an object

Get an object prototype

Set an object prototype

Check instance of object

Reference to value

Available on crate feature classes only.

Check the object for instance of

Available on crate feature properties only.

Define a property of an object

// Define readonly property without value
obj.prop("no_val", ()).unwrap();
// Define readonly property with value
obj.prop("ro_str", "Some const text").unwrap();
// Define readonly property with value and make it to be writable
obj.prop("ro_str2", Property::from("Some const text").writable()).unwrap();
// Define readonly property using getter and make it to be enumerable
obj.prop("ro_str_get", Accessor::from(|| "Some readable text").enumerable()).unwrap();
// Define readonly property using getter and setter
obj.prop("ro_str_get_set",
    Accessor::from(|| "Some text")
        .set(|new_val: String| { /* do something */ })
).unwrap();

Methods from Deref<Target = Value<'js>>

Try get bool from value

Try get int from value

Try get float from value

Try get any number from value

Check if the value is a bool

Check if the value is an int

Check if the value is a float

Check if the value is an any number

Check if the value is a string

Check if the value is a symbol

Check if the value is an object

Check if the value is a module

Check if the value is an array

Check if the value is a function

Check if the value is an error

Reference as value

Convert from value to specified type

Get the type of value

Get the name of type

Interprete as

Safety

You should be sure that the value already is of required type before to do it.

Try reinterprete as

Interprete as

Safety

You should be sure that the value already is of required type before to do it.

Try reinterprete as

Interprete as

Safety

You should be sure that the value already is of required type before to do it.

Try reinterprete as

Interprete as

Safety

You should be sure that the value already is of required type before to do it.

Try reinterprete as

Interprete as

Safety

You should be sure that the value already is of required type before to do it.

Try reinterprete as

Interprete as

Safety

You should be sure that the value already is of required type before to do it.

Try reinterprete as

Trait Implementations

Converts this type into a mutable reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.