Kite

buffer

std/buffer — flat numeric buffers.

A [Point] is an array of references to Point objects rather than a flat run of coordinates: WasmGC has no unboxed aggregates inside arrays, which the specification records as a known consequence. For numeric work where the layout matters, a buffer is a flat sequence of numbers with the shape written down separately — which is what a layout engine or a renderer wants anyway.

This is the version over slices. A buffer.F64 over linear memory would let the host read it without copying, and is what the canvas renderer will want; nothing in the language stops it, but the Wasm backend has no linear memory today and adding one for this alone would cost every program the bytes.

F64

struct F64

A flat run of floats, read and written in fixed-size records.

f64

pub fn f64(stride: int) -> F64

count

pub fn count(b: F64) -> int

How many records the buffer holds.

get

pub fn get(b: F64, record: int, field: int) -> float

One number of one record.

record

pub fn record(b: F64, index: int) -> [float]

A whole record, as a slice of stride numbers.

push

pub fn push(b: F64, values: [float]) -> F64

A buffer with one record appended. Buffers are values, like slices: this produces a new one rather than editing the one it was given.

set

pub fn set(b: F64, record: int, field: int, value: float) -> F64

A buffer with one number replaced.

column

pub fn column(b: F64, field: int) -> [float]

Every value of one field, across every record — the column form, which is what a bounds check or a sum wants.

extent

pub fn extent(b: F64, field: int) -> (float, float)

The smallest and largest value in a field.