items
Function parameters
Parameters
A MultiArrayList stores a list of a struct or tagged union type.
Functions
- MultiArrayList
- A MultiArrayList stores a list of a struct or tagged union type.
Source
Implementation
pub fn items(self: Slice, comptime field: Field) []FieldType(field) {
const F = FieldType(field);
if (self.capacity == 0) {
return &[_]F{};
}
const byte_ptr = self.ptrs[@intFromEnum(field)];
const casted_ptr: [*]F = if (@sizeOf(F) == 0)
undefined
else
@ptrCast(@alignCast(byte_ptr));
return casted_ptr[0..self.len];
}