struct Array [src]
This data structure is used by the Zig language code generation and
therefore must be kept in sync with the compiler implementation.
Fields
len: comptime_int
child: type
sentinel_ptr: ?*const anyopaqueThe type of the sentinel is the element type of the array, which is
the value of the child field in this struct. However there is no way
to refer to that type here, so we use *const anyopaque.
See also: sentinel.
Members
- sentinel (Function)
Source
pub const Array = struct {
len: comptime_int,
child: type,
/// The type of the sentinel is the element type of the array, which is
/// the value of the `child` field in this struct. However there is no way
/// to refer to that type here, so we use `*const anyopaque`.
/// See also: `sentinel`.
sentinel_ptr: ?*const anyopaque,
/// Loads the array type's sentinel value from `sentinel_ptr`.
/// Returns `null` if the array type has no sentinel.
pub inline fn sentinel(comptime arr: Array) ?arr.child {
const sp: *const arr.child = @ptrCast(@alignCast(arr.sentinel_ptr orelse return null));
return sp.*;
}
}