array

package
v0.0.0-...-0b38cba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

package array implements slice encoding, ArrayBuffer and TypedArray.

Index

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

type TypedArray struct {
	js.Value
}

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.

func (TypedArray) Len

func (a TypedArray) Len() int

Len returns the length of the array.

func (TypedArray) Type

func (a TypedArray) Type() string

Type returns the type of the array.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL