pub unsafe fn lean_alloc_sarray(
elem_size: u32,
size: usize,
capacity: usize,
) -> lean_obj_resExpand description
Allocate a freshly initialised scalar-array (lean.h:1004–1010).
Returns a LeanScalarArray-tagged object with m_size = size,
m_capacity = capacity, and elem_size bytes per element. The
payload bytes are uninitialised; the caller must write to
lean_sarray_cptr before the array escapes.
§Safety
elem_sizemust fit au8(Lean stores it inm_other) and must be one of{1, 2, 4, 8}for the existing scalar-array consumers (ByteArrayuses1).size <= capacity.size_of::<LeanSArrayObjectRepr>() + elem_size * capacitymust not overflowusize; the helper checks this withstrict_*arithmetic and panics on overflow (mirroringlean_alloc_sarray_would_overflow).