Skip to main content Crate sparse_mem Copy item path Source alignment Alignment requirement for the sparse array.
Report 4 just for the benefit of values allocate ⚠ Allocate a new ID and generation. element_count ⚠ Get current element count element_size ⚠ Get current element size generation_ptr_const ⚠ get_value_ptr ⚠ Get value pointer for a valid handle
Returns None if the handle is invalid id_to_slot_ptr ⚠ Get a pointer to the id_to_slot array (forward lookup) id_to_slot_ptr_const ⚠ init ⚠ Initialize the sparse array to memory specified by the raw memory pointer.
base must point to a region of at least layout_size(capacity, element_size) bytes. insert ⚠ Insert raw bytes at handle id insert_if_alive ⚠ Safe wrapper for insert that validates the handle
Insert raw bytes at handle id, but only if the handle is valid
Returns true if successful, false if the handle is invalid is_alive ⚠ Check handle validity layout_size Compute total bytes needed in memory for a sparse array. Used for code generator to know
how much space to reserve. remove ⚠ Remove by handle; frees slot and bumps generation. Returns false on mismatching generations. slot_to_id_ptr ⚠ Get a pointer to the slot_to_id array (reverse lookup) slot_to_id_ptr_const ⚠ Get a pointer to the slot_to_id array (reverse lookup) values_offset Compute offset of values region (values are aligned to 8 bytes)