DoxigAlpha

subslice

Returns a Slice representing a range of elements in s, analagous to arr[off..len]. It is illegal to call deinit or toMultiArrayList on the returned Slice. Asserts that off + len <= s.len.

Function parameters

Parameters

#
off:usize
len:usize

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 subslice(s: Slice, off: usize, len: usize) Slice {
    assert(off + len <= s.len);
    var ptrs: [fields.len][*]u8 = undefined;
    inline for (s.ptrs, &ptrs, fields) |in, *out, field| {
        out.* = in + (off * @sizeOf(field.type));
    }
    return .{
        .ptrs = ptrs,
        .len = len,
        .capacity = len,
    };
}