struct StructField [src]

This data structure is used by the Zig language code generation and therefore must be kept in sync with the compiler implementation.

Fields

name: [:0]const u8
type: type
default_value_ptr: ?*const anyopaqueThe type of the default value is the type of this struct field, which is the value of the type field in this struct. However there is no way to refer to that type here, so we use *const anyopaque. See also: defaultValue.
is_comptime: bool
alignment: comptime_int

Members

Source

pub const StructField = struct { name: [:0]const u8, type: type, /// The type of the default value is the type of this struct field, which /// is the value of the `type` field in this struct. However there is no /// way to refer to that type here, so we use `*const anyopaque`. /// See also: `defaultValue`. default_value_ptr: ?*const anyopaque, is_comptime: bool, alignment: comptime_int, /// Loads the field's default value from `default_value_ptr`. /// Returns `null` if the field has no default value. pub inline fn defaultValue(comptime sf: StructField) ?sf.type { const dp: *const sf.type = @ptrCast(@alignCast(sf.default_value_ptr orelse return null)); return dp.*; } }