Documentation ¶
Overview ¶
package array implements slice encoding, ArrayBuffer and TypedArray.
Index ¶
- func Decode[E constraints.Integer | constraints.Float](target *[]E, b []byte)
- func Encode[E constraints.Integer | constraints.Float](s []E) []byte
- type TypedArray
- func NewBigInt64Array(ab js.Value) TypedArray
- func NewBigUint64Array(ab js.Value) TypedArray
- func NewFloat32Array(ab js.Value) TypedArray
- func NewFloat64Array(ab js.Value) TypedArray
- func NewFromSlice[E constraints.Integer | constraints.Float](s []E) TypedArray
- func NewInt16Array(ab js.Value) TypedArray
- func NewInt32Array(ab js.Value) TypedArray
- func NewInt8Array(ab js.Value) TypedArray
- func NewUint16Array(ab js.Value) TypedArray
- func NewUint32Array(ab js.Value) TypedArray
- func NewUint8Array(ab js.Value) TypedArray
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
func Decode[E constraints.Integer | constraints.Float](target *[]E, b []byte)
Decode bytes into target numeric slice.
func Encode ¶
func Encode[E constraints.Integer | constraints.Float](s []E) []byte
Encode a numeric slice into bytes.
Types ¶
type TypedArray ¶
TypedArray is a JS TypedArray.
func NewBigInt64Array ¶
func NewBigInt64Array(ab js.Value) TypedArray
NewBigInt64Array creates a new BigInt64Array view over the buffer.
func NewBigUint64Array ¶
func NewBigUint64Array(ab js.Value) TypedArray
NewBigUint64Array creates a new BigUint64Array view over the buffer.
func NewFloat32Array ¶
func NewFloat32Array(ab js.Value) TypedArray
NewFloat32Array creates a new Float32Array view over the buffer.
func NewFloat64Array ¶
func NewFloat64Array(ab js.Value) TypedArray
NewFloat64Array creates a new Float64Array view over the buffer.
func NewFromSlice ¶
func NewFromSlice[E constraints.Integer | constraints.Float](s []E) TypedArray
NewFromSlice creates a new read-only TypedArray.
func NewInt16Array ¶
func NewInt16Array(ab js.Value) TypedArray
NewInt16Array creates a new Int16Array view over the buffer.
func NewInt32Array ¶
func NewInt32Array(ab js.Value) TypedArray
NewInt32Array creates a new Int32Array view over the buffer.
func NewInt8Array ¶
func NewInt8Array(ab js.Value) TypedArray
NewInt8Array creates a new Int8Array view over the buffer.
func NewUint16Array ¶
func NewUint16Array(ab js.Value) TypedArray
NewUint16Array creates a new Uint16Array view over the buffer.
func NewUint32Array ¶
func NewUint32Array(ab js.Value) TypedArray
NewUint32Array creates a new Uint32Array view over the buffer.
func NewUint8Array ¶
func NewUint8Array(ab js.Value) TypedArray
NewUint8Array creates a new Uint8Array view over the buffer.
func (TypedArray) ArrayBuffer ¶
func (a TypedArray) ArrayBuffer() js.Value
ArrayBuffer returns the underlying ArrayBuffer.
func (TypedArray) ByteLength ¶
func (a TypedArray) ByteLength() int
ByteLength returns the byte length of the array.
func (TypedArray) CopyBytesToGo ¶
func (a TypedArray) CopyBytesToGo(dst []byte) int
CopyBytesToGo copies bytes from the underlying ArrayBuffer to dst.