Functions
fn alignment(comptime T: type) comptime_int
Returns the alignment of type T. Note that if T is a pointer or function type t…
Returns the alignment of type T. Note that if T is a pointer or function type the result is different than the one returned by @alignOf(T). If T is a pointer type the alignment of the type it points to is returned. If T is a function type the alignment a target-dependent value is returned.
fn declList(comptime Namespace: type, comptime Decl: type) []const *const Decl
Returns a slice of pointers to public declarations of a namespace.
fn declarationInfo(comptime T: type, comptime decl_name: []const u8) Type.Declaration
No documentation provided.
fn declarations(comptime T: type) []const Type.Declaration
Instead of this function, prefer to use e.g.
@typeInfo(foo).Struct.decls
dire…Instead of this function, prefer to use e.g.
@typeInfo(foo).Struct.decls
directly when you know what kind of type it is.fn eql(a: anytype, b: @TypeOf(a)) bool
Compares two of any type for equality. Containers are compared on a field-by-fie…
Compares two of any type for equality. Containers are compared on a field-by-field basis, where possible. Pointers are not followed.
fn fieldIndex(comptime T: type, comptime name: []const u8) ?comptime_int
Given a type and a name, return the field index according to source order. Retu…
Given a type and a name, return the field index according to source order. Returns
null
if the field is not found.fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeInfo(T)) { .Struct => Type.StructField, .Union => Type.UnionField, .ErrorSet => Type.Error, .Enum => Type.EnumField, else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"), }
No documentation provided.
fn fields(comptime T: type) switch (@typeInfo(T)) { .Struct => []const Type.StructField, .Union => []const Type.UnionField, .ErrorSet => []const Type.Error, .Enum => []const Type.EnumField, else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"), }
No documentation provided.
fn globalOption(comptime name: []const u8, comptime T: type) ?T
TODO: https://github.com/ziglang/zig/issues/425
fn intToEnum(comptime EnumTag: type, tag_int: anytype) IntToEnumError!EnumTag
No documentation provided.
fn sentinel(comptime T: type) ?Elem(T)
Given a type which can have a sentinel e.g.
[:0]u8
, returns the sentinel value…Given a type which can have a sentinel e.g.
[:0]u8
, returns the sentinel value, ornull
if there is not one. Types which cannot possibly have a sentinel will be a compile error.fn stringToEnum(comptime T: type, str: []const u8) ?T
Returns the variant of an enum type,
T
, which is namedstr
, ornull
if no …Returns the variant of an enum type,
T
, which is namedstr
, ornull
if no such variant exists.