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§
- Typed
Array - Typed contiguous array with refcounted header.
Constants§
- ELEM_
TYPE_ BOOL _pad-byte discriminant forTypedArray<u8>carryingboolelements.- ELEM_
TYPE_ CHAR _pad-byte discriminant forTypedArray<char>.- ELEM_
TYPE_ DECIMAL _pad-byte discriminant forTypedArray<*const DecimalObj>.- ELEM_
TYPE_ F32 _pad-byte discriminant forTypedArray<f32>.- ELEM_
TYPE_ F64 _pad-byte discriminant forTypedArray<f64>.- ELEM_
TYPE_ I8 _pad-byte discriminant forTypedArray<i8>.- ELEM_
TYPE_ I16 _pad-byte discriminant forTypedArray<i16>.- ELEM_
TYPE_ I32 _pad-byte discriminant forTypedArray<i32>.- ELEM_
TYPE_ I64 _pad-byte discriminant forTypedArray<i64>.- ELEM_
TYPE_ STRING _pad-byte discriminant forTypedArray<*const StringObj>.- ELEM_
TYPE_ TYPED_ OBJECT _pad-byte discriminant forTypedArray<*const TypedObjectStorage>.- ELEM_
TYPE_ U8 _pad-byte discriminant forTypedArray<u8>carryingu8elements.- ELEM_
TYPE_ U16 _pad-byte discriminant forTypedArray<u16>.- ELEM_
TYPE_ U32 _pad-byte discriminant forTypedArray<u32>.- ELEM_
TYPE_ UNKNOWN _pad-byte discriminant for an unstamped / unknown element type.
Functions§
- read_
elem_ ⚠type - Read the element-type discriminant stamped in the
_padbyte (offset 7). - release_
v2_ ⚠typed_ array - Release one refcount share of a v2-raw
*mut TypedArray<T>carrier; on the last share, read the stamped element type and free the array via the matching monomorphizeddrop_array/drop_array_heap. - retain_
v2_ ⚠typed_ array - Retain (bump the refcount of) a v2-raw
*mut TypedArray<T>carrier.