Struct Uint8ClampedArray

#[repr(transparent)]
pub struct Uint8ClampedArray { /* private fields */ }

Implementations

impl Uint8ClampedArray

fn new(constructor_arg: &JsValue) -> Uint8ClampedArray

The Uint8ClampedArray() constructor creates a new array.

MDN documentation

impl Uint8ClampedArray

fn new_with_byte_offset(buffer: &JsValue, byte_offset: u32) -> Uint8ClampedArray

An Uint8ClampedArray() which creates an array with the given buffer but is a view starting at byte_offset.

MDN documentation

impl Uint8ClampedArray

fn buffer(&self) -> ArrayBuffer

The buffer accessor property represents the ArrayBuffer referenced by a TypedArray at construction time.

impl Uint8ClampedArray

fn for_each(&self, callback: &mut impl FnMut(u8, u32, Uint8ClampedArray) + MaybeUnwindSafe)

The forEach() method executes a provided function once per array element. This method has the same algorithm as Array.prototype.forEach(). TypedArray is one of the typed array types here.

impl Uint8ClampedArray

fn byte_length(&self) -> u32

The byteLength accessor property represents the length (in bytes) of a typed array.

impl Uint8ClampedArray

fn at(&self, idx: i32) -> Option<u8>

Gets the value at idx, counting from the end if negative.

impl Uint8ClampedArray

fn set_index(&self, idx: u32, value: u8)

Sets the value at idx, equivalent to the javascript arr[idx] = value.

impl Uint8ClampedArray

fn new_with_length(length: u32) -> Uint8ClampedArray

An Uint8ClampedArray() which creates an array with an internal buffer large enough for length elements.

MDN documentation

impl Uint8ClampedArray

fn new_with_byte_offset_and_length(buffer: &JsValue, byte_offset: u32, length: u32) -> Uint8ClampedArray

An Uint8ClampedArray() which creates an array with the given buffer but is a view starting at byte_offset for length elements.

MDN documentation

impl Uint8ClampedArray

fn subarray(&self, begin: u32, end: u32) -> Uint8ClampedArray

The subarray() method returns a new TypedArray on the same ArrayBuffer store and with the same element types as for this TypedArray object.

impl Uint8ClampedArray

fn try_for_each(&self, callback: &mut impl FnMut(u8, u32, Uint8ClampedArray) -> Result<(), JsError> + MaybeUnwindSafe) -> Result<(), JsValue>

The forEach() method executes a provided function once per array element. This method has the same algorithm as Array.prototype.forEach(). TypedArray is one of the typed array types here.

impl Uint8ClampedArray

fn byte_offset(&self) -> u32

The byteOffset accessor property represents the offset (in bytes) of a typed array from the start of its ArrayBuffer.

impl Uint8ClampedArray

fn copy_within(&self, target: i32, start: i32, end: i32) -> Uint8ClampedArray

The copyWithin() method shallow copies part of a typed array to another location in the same typed array and returns it, without modifying its size.

MDN documentation

impl Uint8ClampedArray

unsafe fn view(rust: &[u8]) -> Uint8ClampedArray

Creates a JS typed array which is a view into wasm's linear memory at the slice specified.

This function returns a new typed array which is a view into wasm's memory. This view does not copy the underlying data.

Safety

Views into WebAssembly memory are only valid so long as the backing buffer isn't resized in JS. Once this function is called any future calls to Box::new (or malloc of any form) may cause the returned value here to be invalidated. Use with caution!

Additionally the returned object can be safely mutated but the input slice isn't guaranteed to be mutable.

Finally, the returned object is disconnected from the input slice's lifetime, so there's no guarantee that the data is read at the right time.

unsafe fn view_mut_raw(ptr: *mut u8, length: usize) -> Uint8ClampedArray

Creates a JS typed array which is a view into wasm's linear memory at the specified pointer with specified length.

This function returns a new typed array which is a view into wasm's memory. This view does not copy the underlying data.

Safety

Views into WebAssembly memory are only valid so long as the backing buffer isn't resized in JS. Once this function is called any future calls to Box::new (or malloc of any form) may cause the returned value here to be invalidated. Use with caution!

Additionally the returned object can be safely mutated, the changes are guaranteed to be reflected in the input array.

unsafe fn raw_copy_to_ptr(&self, dst: *mut u8)

Copy the contents of this JS typed array into the destination Rust pointer.

This function will efficiently copy the memory from a typed array into this Wasm module's own linear memory, initializing the memory destination provided.

Safety

This function requires dst to point to a buffer large enough to fit this array's contents.

fn copy_to(&self, dst: &mut [u8])

Copy the contents of this JS typed array into the destination Rust slice.

This function will efficiently copy the memory from a typed array into this Wasm module's own linear memory, initializing the memory destination provided.

Panics

This function will panic if this typed array's length is different than the length of the provided dst array.

fn copy_to_uninit<'dst>(&self, dst: &'dst mut [MaybeUninit<u8>]) -> &'dst mut [u8]

Copy the contents of this JS typed array into the destination Rust slice.

This function will efficiently copy the memory from a typed array into this Wasm module's own linear memory, initializing the memory destination provided.

Panics

This function will panic if this typed array's length is different than the length of the provided dst array.

fn copy_from(&self, src: &[u8])

Copy the contents of the source Rust slice into this JS typed array.

This function will efficiently copy the memory from within the Wasm module's own linear memory to this typed array.

Panics

This function will panic if this typed array's length is different than the length of the provided src array.

fn to_vec(&self) -> Vec<u8>

Efficiently copies the contents of this JS typed array into a new Vec.

impl Uint8ClampedArray

fn new_from_slice(slice: &[u8]) -> Uint8ClampedArray

An Uint8ClampedArray() which creates an array from a Rust slice.

MDN documentation

impl Uint8ClampedArray

fn fill(&self, value: u8, start: u32, end: u32) -> Uint8ClampedArray

The fill() method fills all the elements of an array from a start index to an end index with a static value. The end index is not included.

MDN documentation

impl Uint8ClampedArray

fn slice(&self, begin: u32, end: u32) -> Uint8ClampedArray

The slice() method returns a shallow copy of a portion of a typed array into a new typed array object. This method has the same algorithm as Array.prototype.slice().

impl Uint8ClampedArray

fn length(&self) -> u32

The length accessor property represents the length (in elements) of a typed array.

impl Uint8ClampedArray

fn set(&self, src: &JsValue, offset: u32)

The set() method stores multiple values in the typed array, reading input values from a specified array.

impl Uint8ClampedArray

fn get_index(&self, idx: u32) -> u8

Gets the value at idx, equivalent to the javascript my_var = arr[idx].

Trait Implementations

impl AsRef<JsValue> for Uint8ClampedArray

fn as_ref(&self) -> &JsValue

impl AsRef<Object> for Uint8ClampedArray

fn as_ref(&self) -> &Object

impl AsRef<Uint8ClampedArray> for Uint8ClampedArray

fn as_ref(&self) -> &Uint8ClampedArray

impl Clone for Uint8ClampedArray

fn clone(&self) -> Self

impl Debug for Uint8ClampedArray

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

impl Default for Uint8ClampedArray

fn default() -> Self

impl Deref for Uint8ClampedArray

type Target = Object;
fn deref(&self) -> &Object

impl ErasableGeneric for Uint8ClampedArray

type Repr = JsValue;

impl From<JsValue> for Uint8ClampedArray

fn from(obj: JsValue) -> Self

impl FromWasmAbi for Uint8ClampedArray

type Abi = <JsValue as FromWasmAbi>::Abi;
unsafe fn from_abi(js: Self::Abi) -> Self

impl IntoJsGeneric for Uint8ClampedArray where Uint8ClampedArray: JsGeneric,

type JsCanon = Uint8ClampedArray;
fn to_js(self) -> Uint8ClampedArray

impl IntoWasmAbi for Uint8ClampedArray

type Abi = <JsValue as IntoWasmAbi>::Abi;
fn into_abi(self) -> Self::Abi

impl JsCast for Uint8ClampedArray

fn instanceof(val: &JsValue) -> bool
fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self

impl LongRefFromWasmAbi for Uint8ClampedArray

type Abi = <JsValue as LongRefFromWasmAbi>::Abi;
type Anchor = Uint8ClampedArray;
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

impl OptionFromWasmAbi for Uint8ClampedArray

fn is_none(abi: &Self::Abi) -> bool

impl OptionIntoWasmAbi for Uint8ClampedArray

fn none() -> Self::Abi

impl Promising for Uint8ClampedArray

type Resolution = Uint8ClampedArray;

impl RefFromWasmAbi for Uint8ClampedArray

type Abi = <JsValue as RefFromWasmAbi>::Abi;
type Anchor = ManuallyDrop<Uint8ClampedArray>;
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

impl TypedArray for Uint8ClampedArray

impl UpcastFrom<Uint8ClampedArray> for Uint8ClampedArray

impl WasmDescribe for Uint8ClampedArray

fn describe()

impl<'a> From<&'a [u8]> for Uint8ClampedArray

fn from(slice: &'a [u8]) -> Uint8ClampedArray

Auto Trait Implementations

impl Freeze for Uint8ClampedArray

impl RefUnwindSafe for Uint8ClampedArray

impl Send for Uint8ClampedArray

impl Sync for Uint8ClampedArray

impl Unpin for Uint8ClampedArray

impl UnsafeUnpin for Uint8ClampedArray

impl UnwindSafe for Uint8ClampedArray

Blanket Implementations

impl<P, T> Receiver for Uint8ClampedArray where P: Deref<Target = T> + ?Sized, T: ?Sized,

impl<S, T> Upcast<T> for Uint8ClampedArray where T: UpcastFrom<S> + ?Sized, S: ?Sized,

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

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

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

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

impl<T> From<T> for Uint8ClampedArray

impl<T> JsGeneric for Uint8ClampedArray where T: ErasableGeneric<Repr = JsValue> + UpcastFrom<T> + Upcast<JsValue> + JsCast + 'static,

impl<T> ReturnWasmAbi for Uint8ClampedArray where T: IntoWasmAbi,

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

impl<T> TryFromJsValue for Uint8ClampedArray where T: JsCast,

impl<T> VectorFromWasmAbi for Uint8ClampedArray where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorIntoWasmAbi for Uint8ClampedArray where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorRefIntoWasmAbi for Uint8ClampedArray where &'a T: for<'a> Into<JsValue>,

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

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

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