Struct TypedArray

Source
pub struct TypedArray<T: ArrayKind>(/* private fields */);
Expand description

JavaScript typed arrays are array-like objects and provide a mechanism for accessing raw binary data.

(JavaScript docs)

Implementations§

Source§

impl<T: ArrayKind> TypedArray<T>

Source

pub fn buffer(&self) -> ArrayBuffer

Returns the TypedArray referenced by this typed array.

(JavaScript docs)

Source

pub fn len(&self) -> u32

Returns the number of elements in the buffer.

(JavaScript docs)

Source

pub fn to_vec(&self) -> Vec<T>

Copies self into a new Vec.

Trait Implementations§

Source§

impl<T: ArrayKind> AsRef<Reference> for TypedArray<T>

Source§

fn as_ref(&self) -> &Reference

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

impl<T: Clone + ArrayKind> Clone for TypedArray<T>

Source§

fn clone(&self) -> TypedArray<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + ArrayKind> Debug for TypedArray<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, T: ArrayKind> From<&'a [T]> for TypedArray<T>

Source§

fn from(slice: &'a [T]) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: ArrayKind> From<&'a ArrayBuffer> for TypedArray<T>

Source§

fn from(buffer: &'a ArrayBuffer) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a TypedArray<f32>> for Vec<f32>

Source§

fn from(array: &'a TypedArray<f32>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a TypedArray<f64>> for Vec<f64>

Source§

fn from(array: &'a TypedArray<f64>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a TypedArray<i16>> for Vec<i16>

Source§

fn from(array: &'a TypedArray<i16>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a TypedArray<i32>> for Vec<i32>

Source§

fn from(array: &'a TypedArray<i32>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a TypedArray<i8>> for Vec<i8>

Source§

fn from(array: &'a TypedArray<i8>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a TypedArray<u16>> for Vec<u16>

Source§

fn from(array: &'a TypedArray<u16>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a TypedArray<u32>> for Vec<u32>

Source§

fn from(array: &'a TypedArray<u32>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a TypedArray<u8>> for Vec<u8>

Source§

fn from(array: &'a TypedArray<u8>) -> Self

Converts to this type from the input type.
Source§

impl<T: ArrayKind> From<ArrayBuffer> for TypedArray<T>

Source§

fn from(buffer: ArrayBuffer) -> Self

Converts to this type from the input type.
Source§

impl<T: ArrayKind> From<TypedArray<T>> for Reference

Source§

fn from(value: TypedArray<T>) -> Self

Converts to this type from the input type.
Source§

impl From<TypedArray<f32>> for Vec<f32>

Source§

fn from(array: TypedArray<f32>) -> Self

Converts to this type from the input type.
Source§

impl From<TypedArray<f64>> for Vec<f64>

Source§

fn from(array: TypedArray<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<TypedArray<i16>> for Vec<i16>

Source§

fn from(array: TypedArray<i16>) -> Self

Converts to this type from the input type.
Source§

impl From<TypedArray<i32>> for Vec<i32>

Source§

fn from(array: TypedArray<i32>) -> Self

Converts to this type from the input type.
Source§

impl From<TypedArray<i8>> for Vec<i8>

Source§

fn from(array: TypedArray<i8>) -> Self

Converts to this type from the input type.
Source§

impl From<TypedArray<u16>> for Vec<u16>

Source§

fn from(array: TypedArray<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<TypedArray<u32>> for Vec<u32>

Source§

fn from(array: TypedArray<u32>) -> Self

Converts to this type from the input type.
Source§

impl From<TypedArray<u8>> for Vec<u8>

Source§

fn from(array: TypedArray<u8>) -> Self

Converts to this type from the input type.
Source§

impl<T: ArrayKind> InstanceOf for TypedArray<T>

Source§

fn instance_of(reference: &Reference) -> bool

Checks whenever a given Reference if of type Self.
Source§

impl<T: PartialEq + ArrayKind> PartialEq for TypedArray<T>

Source§

fn eq(&self, other: &TypedArray<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: ArrayKind> ReferenceType for TypedArray<T>

Source§

unsafe fn from_reference_unchecked(reference: Reference) -> Self

Converts a given reference into a concrete reference-like wrapper. Doesn’t do any type checking; highly unsafe to use!
Source§

impl<'_r, T: ArrayKind> TryFrom<&'_r Reference> for TypedArray<T>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(reference: &Reference) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'_r, T: ArrayKind> TryFrom<&'_r Value> for TypedArray<T>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(value: &Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<T: ArrayKind> TryFrom<Reference> for TypedArray<T>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(reference: Reference) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<T: ArrayKind> TryFrom<TypedArray<T>> for Reference

Source§

type Error = Void

The type returned in the event of a conversion error.
Source§

fn try_from(value: TypedArray<T>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<T: ArrayKind> TryFrom<Value> for TypedArray<T>

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(value: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<T: Eq + ArrayKind> Eq for TypedArray<T>

Source§

impl<T: ArrayKind> JsSerialize for TypedArray<T>

Source§

impl<T: ArrayKind> StructuralPartialEq for TypedArray<T>

Auto Trait Implementations§

§

impl<T> Freeze for TypedArray<T>

§

impl<T> RefUnwindSafe for TypedArray<T>
where T: RefUnwindSafe,

§

impl<T> Send for TypedArray<T>
where T: Send,

§

impl<T> Sync for TypedArray<T>
where T: Sync,

§

impl<T> Unpin for TypedArray<T>
where T: Unpin,

§

impl<T> UnwindSafe for TypedArray<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.