DoxigAlpha

slice

Compute pointers to the start of each field of the array. If you need to access multiple fields, calling this may be more efficient than calling items() multiple times.

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 slice(self: Self) Slice {
    var result: Slice = .{
        .ptrs = undefined,
        .len = self.len,
        .capacity = self.capacity,
    };
    var ptr: [*]u8 = self.bytes;
    for (sizes.bytes, sizes.fields) |field_size, i| {
        result.ptrs[i] = ptr;
        ptr += field_size * self.capacity;
    }
    return result;
}