Skip to main content

Module typed_array

Module typed_array 

Source
Expand description

Typed contiguous array for v2 runtime.

TypedArray<T> is a 24-byte #[repr(C)] heap object with a HeapHeader, a pointer to a contiguous T buffer, length, and capacity. The compiler monomorphizes: Array<number> and Array<i32> are different TypedArray instantiations with no element-level type checking.

§Memory layout (24 bytes)

Offset  Size  Field
------  ----  -----
  0       8   header (HeapHeader — refcount at offset 0)
  8       8   data (*mut T — pointer to contiguous T buffer)
 16       4   len (element count)
 20       4   cap (allocated capacity)

Structs§

TypedArray
Typed contiguous array with refcounted header.