README

#mizchi/js/builtins/arraybuffer

Binary data handling with ArrayBuffer and TypedArrays.

#Installation

Add to your moon.pkg.json:

{ "import": [ "mizchi/js", "mizchi/js/builtins/arraybuffer" ] }

#Overview

Provides bindings for JavaScript's binary data types:
  • ArrayBuffer - Raw binary data buffer
  • TypedArrays - Typed views over ArrayBuffer (Int8Array, Uint8Array, Float32Array, etc.)
  • DataView - Low-level interface for reading/writing binary data

#Usage Example

fn main {
// Create a Uint8Array
let arr = @typedarray.Uint8Array::from_size(10)

// Set values
arr.set_at(0, 42)
arr.set_at(1, 100)

// Get values
let value = arr.get_at(0) // 42

// Byte operations
let bytes = Bytes::new(10)
let typed_arr = @typedarray.bytes_to_uint8array(bytes)
}

#Available Types

  • Int8Array, Uint8Array, Uint8ClampedArray
  • Int16Array, Uint16Array
  • Int32Array, Uint32Array
  • BigInt64Array, BigUint64Array
  • Float32Array, Float64Array
  • ArrayBuffer
  • DataView

#Reference

#
ArrayBuffer

pub(all) struct ArrayBuffer {
byteLength : Int
maxByteLength : Int
resizable : Bool
}

https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer

#
ArrayBuffer::isView

fn ArrayBuffer::isView(arg :
Any
) -> Bool

#
ArrayBuffer::new

fn ArrayBuffer::new(byte_length : Int, max_byte_length? : Int) -> ArrayBuffer

#
ArrayBuffer::resize

fn ArrayBuffer::resize(self : ArrayBuffer, new_byte_length : Int) -> Unit

#
ArrayBuffer::slice

fn ArrayBuffer::slice(self : ArrayBuffer, begin? : Int, end? : Int) -> ArrayBuffer

#
ArrayBuffer::to_any

#
BigInt64Array

pub(all) struct BigInt64Array {
buffer : ArrayBuffer
byteLength : Int
byteOffset : Int
length : Int
}

#
BigInt64Array::as_any

#
BigInt64Array::as_typed_array

fn BigInt64Array::as_typed_array(self : BigInt64Array) -> TypedArray

#
BigInt64Array::byteLength

fn BigInt64Array::byteLength(self : BigInt64Array) -> Int

Inherited from TypedArray

#
BigInt64Array::byteOffset

fn BigInt64Array::byteOffset(self : BigInt64Array) -> Int

Inherited from TypedArray

#
BigInt64Array::cast_from_typed_array

fn BigInt64Array::cast_from_typed_array(value : TypedArray) -> BigInt64Array

Upcast from TypedArray to BigInt64Array

#
BigInt64Array::get_at

fn BigInt64Array::get_at(self : BigInt64Array, index : Int) -> Int

Inherited from TypedArray

#
BigInt64Array::includes

fn BigInt64Array::includes(self : BigInt64Array, search_element : Int, from_index? : Int) -> Bool

Inherited from TypedArray

#
BigInt64Array::indexOf

fn BigInt64Array::indexOf(self : BigInt64Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
BigInt64Array::join

fn BigInt64Array::join(self : BigInt64Array, separator? : String) -> String

Inherited from TypedArray

#
BigInt64Array::lastIndexOf

fn BigInt64Array::lastIndexOf(self : BigInt64Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
BigInt64Array::length

fn BigInt64Array::length(self : BigInt64Array) -> Int

Inherited from TypedArray

#
BigInt64Array::reverse

fn BigInt64Array::reverse(self : BigInt64Array) -> TypedArray

Inherited from TypedArray

#
BigInt64Array::set

fn BigInt64Array::set(self : BigInt64Array, array : Array[Int], offset? : Int) -> Unit

Inherited from TypedArray

#
BigInt64Array::set_at

fn BigInt64Array::set_at(self : BigInt64Array, index : Int, value : Int) -> Unit

Inherited from TypedArray

#
BigInt64Array::sort

Inherited from TypedArray

#
BigInt64Array::toString

fn BigInt64Array::toString(self : BigInt64Array) -> String

Inherited from TypedArray

#
BigUint64Array

pub(all) struct BigUint64Array {
buffer : ArrayBuffer
byteLength : Int
byteOffset : Int
length : Int
}

#
BigUint64Array::as_any

#
BigUint64Array::as_typed_array

fn BigUint64Array::as_typed_array(self : BigUint64Array) -> TypedArray

#
BigUint64Array::byteLength

fn BigUint64Array::byteLength(self : BigUint64Array) -> Int

Inherited from TypedArray

#
BigUint64Array::byteOffset

fn BigUint64Array::byteOffset(self : BigUint64Array) -> Int

Inherited from TypedArray

#
BigUint64Array::cast_from_typed_array

fn BigUint64Array::cast_from_typed_array(value : TypedArray) -> BigUint64Array

Upcast from TypedArray to BigUint64Array

#
BigUint64Array::get_at

fn BigUint64Array::get_at(self : BigUint64Array, index : Int) -> Int

Inherited from TypedArray

#
BigUint64Array::includes

fn BigUint64Array::includes(self : BigUint64Array, search_element : Int, from_index? : Int) -> Bool

Inherited from TypedArray

#
BigUint64Array::indexOf

fn BigUint64Array::indexOf(self : BigUint64Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
BigUint64Array::join

fn BigUint64Array::join(self : BigUint64Array, separator? : String) -> String

Inherited from TypedArray

#
BigUint64Array::lastIndexOf

fn BigUint64Array::lastIndexOf(self : BigUint64Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
BigUint64Array::length

fn BigUint64Array::length(self : BigUint64Array) -> Int

Inherited from TypedArray

#
BigUint64Array::reverse

Inherited from TypedArray

#
BigUint64Array::set

fn BigUint64Array::set(self : BigUint64Array, array : Array[Int], offset? : Int) -> Unit

Inherited from TypedArray

#
BigUint64Array::set_at

fn BigUint64Array::set_at(self : BigUint64Array, index : Int, value : Int) -> Unit

Inherited from TypedArray

#
BigUint64Array::sort

Inherited from TypedArray

#
BigUint64Array::toString

fn BigUint64Array::toString(self : BigUint64Array) -> String

Inherited from TypedArray

#
DataView

pub(all) struct DataView {
buffer : ArrayBuffer
byteLength : Int
byteOffset : Int
}

#
DataView::as_any

#
DataView::get_float32

#alias(getFloat32)
fn DataView::get_float32(self : DataView, byte_offset : Int, little_endian? : Bool) -> Double

#
DataView::get_float64

#alias(getFloat64)
fn DataView::get_float64(self : DataView, byte_offset : Int, little_endian? : Bool) -> Double

#
DataView::get_int16

#alias(getInt16)
fn DataView::get_int16(self : DataView, byte_offset : Int, little_endian? : Bool) -> Int

#
DataView::get_int32

#alias(getInt32)
fn DataView::get_int32(self : DataView, byte_offset : Int, little_endian? : Bool) -> Int

#
DataView::get_int8

#alias(getInt8)
fn DataView::get_int8(self : DataView, byte_offset : Int) -> Int

#
DataView::get_uint16

#alias(getUint16)
fn DataView::get_uint16(self : DataView, byte_offset : Int, little_endian? : Bool) -> Int

#
DataView::get_uint32

#alias(getUint32)
fn DataView::get_uint32(self : DataView, byte_offset : Int, little_endian? : Bool) -> Int

#
DataView::get_uint8

#alias(getUint8)
fn DataView::get_uint8(self : DataView, byte_offset : Int) -> Int

#
DataView::new

fn DataView::new(buffer : ArrayBuffer, byte_offset? : Int, byte_length? : Int) -> DataView

#
DataView::set_float32

#alias(setFloat32)
fn DataView::set_float32(self : DataView, byte_offset : UInt, value : Double, little_endian? : Bool) -> Unit

#
DataView::set_float64

#alias(setFloat64)
fn DataView::set_float64(self : DataView, byte_offset : UInt, value : Double, little_endian? : Bool) -> Unit

#
DataView::set_int16

#alias(setInt16)
fn DataView::set_int16(self : DataView, byte_offset : Int, value : Int, little_endian? : Bool) -> Unit

#
DataView::set_int32

#alias(setInt32)
fn DataView::set_int32(self : DataView, byte_offset : UInt, value : Int, little_endian? : Bool) -> Unit

#
DataView::set_int8

#alias(setInt8)
fn DataView::set_int8(self : DataView, byte_offset : Int, value : Int) -> Unit

#
DataView::set_uint16

#alias(setUint16)
fn DataView::set_uint16(self : DataView, byte_offset : Int, value : Int, little_endian? : Bool) -> Unit

#
DataView::set_uint32

#alias(setUint32)
fn DataView::set_uint32(self : DataView, byte_offset : Int, value : Int, little_endian? : Bool) -> Unit

#
DataView::set_uint8

#alias(setUint8)
fn DataView::set_uint8(self : DataView, byte_offset : Int, value : Int) -> Unit

#
Float32Array

pub(all) struct Float32Array {
buffer : ArrayBuffer
byteLength : Int
byteOffset : Int
length : Int
}

#
Float32Array::as_any

#
Float32Array::as_typed_array

fn Float32Array::as_typed_array(self : Float32Array) -> TypedArray

#
Float32Array::byteLength

fn Float32Array::byteLength(self : Float32Array) -> Int

Inherited from TypedArray

#
Float32Array::byteOffset

fn Float32Array::byteOffset(self : Float32Array) -> Int

Inherited from TypedArray

#
Float32Array::cast_from_typed_array

fn Float32Array::cast_from_typed_array(value : TypedArray) -> Float32Array

Upcast from TypedArray to Float32Array

#
Float32Array::get_at

fn Float32Array::get_at(self : Float32Array, index : Int) -> Int

Inherited from TypedArray

#
Float32Array::includes

fn Float32Array::includes(self : Float32Array, search_element : Int, from_index? : Int) -> Bool

Inherited from TypedArray

#
Float32Array::indexOf

fn Float32Array::indexOf(self : Float32Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Float32Array::join

fn Float32Array::join(self : Float32Array, separator? : String) -> String

Inherited from TypedArray

#
Float32Array::lastIndexOf

fn Float32Array::lastIndexOf(self : Float32Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Float32Array::length

fn Float32Array::length(self : Float32Array) -> Int

Inherited from TypedArray

#
Float32Array::reverse

fn Float32Array::reverse(self : Float32Array) -> TypedArray

Inherited from TypedArray

#
Float32Array::set

fn Float32Array::set(self : Float32Array, array : Array[Int], offset? : Int) -> Unit

Inherited from TypedArray

#
Float32Array::set_at

fn Float32Array::set_at(self : Float32Array, index : Int, value : Int) -> Unit

Inherited from TypedArray

#
Float32Array::sort

Inherited from TypedArray

#
Float32Array::toString

fn Float32Array::toString(self : Float32Array) -> String

Inherited from TypedArray

#
Float64Array

pub(all) struct Float64Array {
buffer : ArrayBuffer
byteLength : Int
byteOffset : Int
length : Int
}

#
Float64Array::as_any

#
Float64Array::as_typed_array

fn Float64Array::as_typed_array(self : Float64Array) -> TypedArray

#
Float64Array::byteLength

fn Float64Array::byteLength(self : Float64Array) -> Int

Inherited from TypedArray

#
Float64Array::byteOffset

fn Float64Array::byteOffset(self : Float64Array) -> Int

Inherited from TypedArray

#
Float64Array::cast_from_typed_array

fn Float64Array::cast_from_typed_array(value : TypedArray) -> Float64Array

Upcast from TypedArray to Float64Array

#
Float64Array::get_at

fn Float64Array::get_at(self : Float64Array, index : Int) -> Int

Inherited from TypedArray

#
Float64Array::includes

fn Float64Array::includes(self : Float64Array, search_element : Int, from_index? : Int) -> Bool

Inherited from TypedArray

#
Float64Array::indexOf

fn Float64Array::indexOf(self : Float64Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Float64Array::join

fn Float64Array::join(self : Float64Array, separator? : String) -> String

Inherited from TypedArray

#
Float64Array::lastIndexOf

fn Float64Array::lastIndexOf(self : Float64Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Float64Array::length

fn Float64Array::length(self : Float64Array) -> Int

Inherited from TypedArray

#
Float64Array::reverse

fn Float64Array::reverse(self : Float64Array) -> TypedArray

Inherited from TypedArray

#
Float64Array::set

fn Float64Array::set(self : Float64Array, array : Array[Int], offset? : Int) -> Unit

Inherited from TypedArray

#
Float64Array::set_at

fn Float64Array::set_at(self : Float64Array, index : Int, value : Int) -> Unit

Inherited from TypedArray

#
Float64Array::sort

Inherited from TypedArray

#
Float64Array::toString

fn Float64Array::toString(self : Float64Array) -> String

Inherited from TypedArray

#
Int16Array

pub(all) struct Int16Array {
buffer : ArrayBuffer
byteLength : Int
byteOffset : Int
length : Int
}

#
Int16Array::as_typed_array

fn Int16Array::as_typed_array(self : Int16Array) -> TypedArray

#
Int16Array::byteLength

fn Int16Array::byteLength(self : Int16Array) -> Int

Inherited from TypedArray

#
Int16Array::byteOffset

fn Int16Array::byteOffset(self : Int16Array) -> Int

Inherited from TypedArray

#
Int16Array::cast_from_typed_array

fn Int16Array::cast_from_typed_array(value : TypedArray) -> Int16Array

Upcast from TypedArray to Int16Array

#
Int16Array::get_at

fn Int16Array::get_at(self : Int16Array, index : Int) -> Int

Inherited from TypedArray

#
Int16Array::includes

fn Int16Array::includes(self : Int16Array, search_element : Int, from_index? : Int) -> Bool

Inherited from TypedArray

#
Int16Array::indexOf

fn Int16Array::indexOf(self : Int16Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Int16Array::join

fn Int16Array::join(self : Int16Array, separator? : String) -> String

Inherited from TypedArray

#
Int16Array::lastIndexOf

fn Int16Array::lastIndexOf(self : Int16Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Int16Array::length

fn Int16Array::length(self : Int16Array) -> Int

Inherited from TypedArray

#
Int16Array::reverse

fn Int16Array::reverse(self : Int16Array) -> TypedArray

Inherited from TypedArray

#
Int16Array::set

fn Int16Array::set(self : Int16Array, array : Array[Int], offset? : Int) -> Unit

Inherited from TypedArray

#
Int16Array::set_at

fn Int16Array::set_at(self : Int16Array, index : Int, value : Int) -> Unit

Inherited from TypedArray

#
Int16Array::sort

fn Int16Array::sort(self : Int16Array) -> TypedArray

Inherited from TypedArray

#
Int16Array::toString

fn Int16Array::toString(self : Int16Array) -> String

Inherited from TypedArray

#
Int32Array

pub(all) struct Int32Array {
buffer : ArrayBuffer
byteLength : Int
byteOffset : Int
length : Int
}

#
Int32Array::as_any

#
Int32Array::as_typed_array

fn Int32Array::as_typed_array(self : Int32Array) -> TypedArray

#
Int32Array::byteLength

fn Int32Array::byteLength(self : Int32Array) -> Int

Inherited from TypedArray

#
Int32Array::byteOffset

fn Int32Array::byteOffset(self : Int32Array) -> Int

Inherited from TypedArray

#
Int32Array::cast_from_typed_array

fn Int32Array::cast_from_typed_array(value : TypedArray) -> Int32Array

Upcast from TypedArray to Int32Array

#
Int32Array::get_at

fn Int32Array::get_at(self : Int32Array, index : Int) -> Int

Inherited from TypedArray

#
Int32Array::includes

fn Int32Array::includes(self : Int32Array, search_element : Int, from_index? : Int) -> Bool

Inherited from TypedArray

#
Int32Array::indexOf

fn Int32Array::indexOf(self : Int32Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Int32Array::join

fn Int32Array::join(self : Int32Array, separator? : String) -> String

Inherited from TypedArray

#
Int32Array::lastIndexOf

fn Int32Array::lastIndexOf(self : Int32Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Int32Array::length

fn Int32Array::length(self : Int32Array) -> Int

Inherited from TypedArray

#
Int32Array::reverse

fn Int32Array::reverse(self : Int32Array) -> TypedArray

Inherited from TypedArray

#
Int32Array::set

fn Int32Array::set(self : Int32Array, array : Array[Int], offset? : Int) -> Unit

Inherited from TypedArray

#
Int32Array::set_at

fn Int32Array::set_at(self : Int32Array, index : Int, value : Int) -> Unit

Inherited from TypedArray

#
Int32Array::sort

fn Int32Array::sort(self : Int32Array) -> TypedArray

Inherited from TypedArray

#
Int32Array::toString

fn Int32Array::toString(self : Int32Array) -> String

Inherited from TypedArray

#
Int8Array

pub(all) struct Int8Array {
buffer : ArrayBuffer
byteLength : UInt
byteOffset : UInt
length : UInt
}

#
Int8Array::as_any

#
Int8Array::as_typed_array

fn Int8Array::as_typed_array(self : Int8Array) -> TypedArray

#
Int8Array::byteLength

fn Int8Array::byteLength(self : Int8Array) -> Int

Inherited from TypedArray

#
Int8Array::byteOffset

fn Int8Array::byteOffset(self : Int8Array) -> Int

Inherited from TypedArray

#
Int8Array::cast_from_typed_array

fn Int8Array::cast_from_typed_array(value : TypedArray) -> Int8Array

Upcast from TypedArray to Int8Array

#
Int8Array::get_at

fn Int8Array::get_at(self : Int8Array, index : Int) -> Int

Inherited from TypedArray

#
Int8Array::includes

fn Int8Array::includes(self : Int8Array, search_element : Int, from_index? : Int) -> Bool

Inherited from TypedArray

#
Int8Array::indexOf

fn Int8Array::indexOf(self : Int8Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Int8Array::join

fn Int8Array::join(self : Int8Array, separator? : String) -> String

Inherited from TypedArray

#
Int8Array::lastIndexOf

fn Int8Array::lastIndexOf(self : Int8Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Int8Array::length

fn Int8Array::length(self : Int8Array) -> Int

Inherited from TypedArray

#
Int8Array::reverse

fn Int8Array::reverse(self : Int8Array) -> TypedArray

Inherited from TypedArray

#
Int8Array::set

fn Int8Array::set(self : Int8Array, array : Array[Int], offset? : Int) -> Unit

Inherited from TypedArray

#
Int8Array::set_at

fn Int8Array::set_at(self : Int8Array, index : Int, value : Int) -> Unit

Inherited from TypedArray

#
Int8Array::sort

fn Int8Array::sort(self : Int8Array) -> TypedArray

Inherited from TypedArray

#
Int8Array::toString

fn Int8Array::toString(self : Int8Array) -> String

Inherited from TypedArray

#
SharedArrayBuffer

pub(all) struct SharedArrayBuffer {
byteLength : Int
}

#
SharedArrayBuffer::new

fn SharedArrayBuffer::new(byte_length : Int) -> SharedArrayBuffer

#
SharedArrayBuffer::slice

fn SharedArrayBuffer::slice(self : SharedArrayBuffer, begin? : Int, end? : Int) -> SharedArrayBuffer

#
SharedArrayBuffer::to_any

#
TypedArray

#external
pub type TypedArray

Base type that consolidates common operations for TypedArray. Downcast from concrete TypedArray types using as_typed_array() to use.

#
TypedArray::as_any

#
TypedArray::byteLength

fn TypedArray::byteLength(self : TypedArray) -> Int

#
TypedArray::byteOffset

fn TypedArray::byteOffset(self : TypedArray) -> Int

#
TypedArray::copyWithin

fn TypedArray::copyWithin(self : TypedArray, target : Int, start : Int, end? : Int) -> TypedArray

#
TypedArray::fill

fn TypedArray::fill(self : TypedArray, value : Int, start? : Int, end? : Int) -> TypedArray

#
TypedArray::get_at

#alias("_[_]")
fn TypedArray::get_at(self : TypedArray, index : Int) -> Int

#
TypedArray::includes

fn TypedArray::includes(self : TypedArray, search_element : Int, from_index? : Int) -> Bool

#
TypedArray::indexOf

fn TypedArray::indexOf(self : TypedArray, search_element : Int, from_index? : Int) -> Int

#
TypedArray::join

fn TypedArray::join(self : TypedArray, separator? : String) -> String

#
TypedArray::lastIndexOf

fn TypedArray::lastIndexOf(self : TypedArray, search_element : Int, from_index? : Int) -> Int

#
TypedArray::length

fn TypedArray::length(self : TypedArray) -> Int

Common methods

#
TypedArray::reverse

fn TypedArray::reverse(self : TypedArray) -> TypedArray

#
TypedArray::set

fn TypedArray::set(self : TypedArray, array : Array[Int], offset? : Int) -> Unit

#
TypedArray::set_at

#alias("_[_]=_")
fn TypedArray::set_at(self : TypedArray, index : Int, value : Int) -> Unit

#
TypedArray::slice

fn TypedArray::slice(self : TypedArray, start? : Int, end? : Int) -> TypedArray

#
TypedArray::sort

fn TypedArray::sort(self : TypedArray) -> TypedArray

#
TypedArray::subarray

fn TypedArray::subarray(self : TypedArray, begin? : Int, end? : Int) -> TypedArray

#
TypedArray::toString

fn TypedArray::toString(self : TypedArray) -> String

#
Uint16Array

pub(all) struct Uint16Array {
buffer : ArrayBuffer
byteLength : UInt
byteOffset : UInt
length : UInt
}

#
Uint16Array::as_any

#
Uint16Array::as_typed_array

fn Uint16Array::as_typed_array(self : Uint16Array) -> TypedArray

#
Uint16Array::byteLength

fn Uint16Array::byteLength(self : Uint16Array) -> Int

Inherited from TypedArray

#
Uint16Array::byteOffset

fn Uint16Array::byteOffset(self : Uint16Array) -> Int

Inherited from TypedArray

#
Uint16Array::cast_from_typed_array

fn Uint16Array::cast_from_typed_array(value : TypedArray) -> Uint16Array

Upcast from TypedArray to Uint16Array

#
Uint16Array::from_array_buffer

fn Uint16Array::from_array_buffer(buffer : ArrayBuffer, byte_offset? : Int, length? : Int) -> Uint16Array

#
Uint16Array::get_at

fn Uint16Array::get_at(self : Uint16Array, index : Int) -> Int

Inherited from TypedArray

#
Uint16Array::includes

fn Uint16Array::includes(self : Uint16Array, search_element : Int, from_index? : Int) -> Bool

Inherited from TypedArray

#
Uint16Array::indexOf

fn Uint16Array::indexOf(self : Uint16Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Uint16Array::join

fn Uint16Array::join(self : Uint16Array, separator? : String) -> String

Inherited from TypedArray

#
Uint16Array::lastIndexOf

fn Uint16Array::lastIndexOf(self : Uint16Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Uint16Array::length

fn Uint16Array::length(self : Uint16Array) -> Int

Inherited from TypedArray

#
Uint16Array::reverse

fn Uint16Array::reverse(self : Uint16Array) -> TypedArray

Inherited from TypedArray

#
Uint16Array::set

fn Uint16Array::set(self : Uint16Array, array : Array[Int], offset? : Int) -> Unit

Inherited from TypedArray

#
Uint16Array::set_at

fn Uint16Array::set_at(self : Uint16Array, index : Int, value : Int) -> Unit

Inherited from TypedArray

#
Uint16Array::sort

fn Uint16Array::sort(self : Uint16Array) -> TypedArray

Inherited from TypedArray

#
Uint16Array::toString

fn Uint16Array::toString(self : Uint16Array) -> String

Inherited from TypedArray

#
Uint32Array

pub(all) struct Uint32Array {
buffer : ArrayBuffer
byteLength : UInt
byteOffset : UInt
length : UInt
}

#
Uint32Array::as_typed_array

fn Uint32Array::as_typed_array(self : Uint32Array) -> TypedArray

#
Uint32Array::byteLength

fn Uint32Array::byteLength(self : Uint32Array) -> Int

Inherited from TypedArray

#
Uint32Array::byteOffset

fn Uint32Array::byteOffset(self : Uint32Array) -> Int

Inherited from TypedArray

#
Uint32Array::cast_from_typed_array

fn Uint32Array::cast_from_typed_array(value : TypedArray) -> Uint32Array

Upcast from TypedArray to Uint32Array

#
Uint32Array::get_at

fn Uint32Array::get_at(self : Uint32Array, index : Int) -> Int

Inherited from TypedArray

#
Uint32Array::includes

fn Uint32Array::includes(self : Uint32Array, search_element : Int, from_index? : Int) -> Bool

Inherited from TypedArray

#
Uint32Array::indexOf

fn Uint32Array::indexOf(self : Uint32Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Uint32Array::join

fn Uint32Array::join(self : Uint32Array, separator? : String) -> String

Inherited from TypedArray

#
Uint32Array::lastIndexOf

fn Uint32Array::lastIndexOf(self : Uint32Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Uint32Array::length

fn Uint32Array::length(self : Uint32Array) -> Int

Inherited from TypedArray

#
Uint32Array::reverse

fn Uint32Array::reverse(self : Uint32Array) -> TypedArray

Inherited from TypedArray

#
Uint32Array::set

fn Uint32Array::set(self : Uint32Array, array : Array[Int], offset? : Int) -> Unit

Inherited from TypedArray

#
Uint32Array::set_at

fn Uint32Array::set_at(self : Uint32Array, index : Int, value : Int) -> Unit

Inherited from TypedArray

#
Uint32Array::sort

fn Uint32Array::sort(self : Uint32Array) -> TypedArray

Inherited from TypedArray

#
Uint32Array::toString

fn Uint32Array::toString(self : Uint32Array) -> String

Inherited from TypedArray

#
Uint8Array

pub(all) struct Uint8Array {
buffer : ArrayBuffer
byteLength : Int
byteOffset : Int
length : Int
}

#
Uint8Array::as_any

#
Uint8Array::as_typed_array

fn Uint8Array::as_typed_array(self : Uint8Array) -> TypedArray

#
Uint8Array::byteLength

fn Uint8Array::byteLength(self : Uint8Array) -> Int

Inherited from TypedArray

#
Uint8Array::byteOffset

fn Uint8Array::byteOffset(self : Uint8Array) -> Int

Inherited from TypedArray

#
Uint8Array::cast_from_typed_array

fn Uint8Array::cast_from_typed_array(value : TypedArray) -> Uint8Array

Upcast from TypedArray to Uint8Array

#
Uint8Array::from_array

fn Uint8Array::from_array(array : Array[Int]) -> Uint8Array

#
Uint8Array::from_array_buffer

fn Uint8Array::from_array_buffer(buffer : ArrayBuffer, byte_offset? : Int, length? : Int) -> Uint8Array

#
Uint8Array::from_bytes

fn Uint8Array::from_bytes(bytes : Bytes) -> Uint8Array

Create a Uint8Array from a Bytes value (alias for bytes_to_uint8array)

#
Uint8Array::from_size

fn Uint8Array::from_size(length : Int) -> Uint8Array

#
Uint8Array::get_at

fn Uint8Array::get_at(self : Uint8Array, index : Int) -> Int

Inherited from TypedArray

#
Uint8Array::includes

fn Uint8Array::includes(self : Uint8Array, search_element : Int, from_index? : Int) -> Bool

Inherited from TypedArray

#
Uint8Array::indexOf

fn Uint8Array::indexOf(self : Uint8Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Uint8Array::join

fn Uint8Array::join(self : Uint8Array, separator? : String) -> String

Inherited from TypedArray

#
Uint8Array::lastIndexOf

fn Uint8Array::lastIndexOf(self : Uint8Array, search_element : Int, from_index? : Int) -> Int

Inherited from TypedArray

#
Uint8Array::length

fn Uint8Array::length(self : Uint8Array) -> Int

Inherited from TypedArray

#
Uint8Array::reverse

fn Uint8Array::reverse(self : Uint8Array) -> TypedArray

Inherited from TypedArray

#
Uint8Array::set

fn Uint8Array::set(self : Uint8Array, array : Array[Int], offset? : Int) -> Unit

Inherited from TypedArray

#
Uint8Array::set_at

fn Uint8Array::set_at(self : Uint8Array, index : Int, value : Int) -> Unit

Inherited from TypedArray

#
Uint8Array::sort

fn Uint8Array::sort(self : Uint8Array) -> TypedArray

Inherited from TypedArray

#
Uint8Array::toString

fn Uint8Array::toString(self : Uint8Array) -> String

Inherited from TypedArray

#
Uint8Array::to_bytes

fn Uint8Array::to_bytes(self : Uint8Array) -> Bytes

Convert Uint8Array to Bytes (alias for uint8array_to_bytes)

#
bytes_to_uint8array

fn bytes_to_uint8array(bytes : Bytes) -> Uint8Array

Convert MoonBit Bytes to JavaScript Uint8Array

This is a zero-cost conversion on the JS backend, as both types share the same underlying representation.

Example:
let bytes = Bytes::from_array([1, 2, 3, 4, 5])
let uint8array = bytes_to_uint8array(bytes).as_typed_array()
assert_eq(uint8array.length(), 5)

#
uint8array_to_bytes

fn uint8array_to_bytes(uint8array : Uint8Array) -> Bytes

Convert JavaScript Uint8Array to MoonBit Bytes

This is a zero-cost conversion on the JS backend, as both types share the same underlying representation.

Example:
let uint8array = Uint8Array::from_array([1, 2, 3, 4, 5])
let bytes = uint8array_to_bytes(uint8array)
assert_eq(bytes.length(), 5)