std.meta
The entries of std.meta in the Zig reference. This page has 26 cards.
pub fn AbsorbSentinel(comptime Pointer: type) type
Given a pointer type, removes the sentinel if present, returning an equivalent pointer type with no sentinel.
- Kind
- type function
- Module
std.meta
pub fn activeTag(u: anytype) Tag(@TypeOf(u))
Returns the active tag of a tagged union.
- Kind
- function
- Module
std.meta
pub fn alignment(comptime T: type) comptime_int
Returns the alignment of type T. Note that if T is a pointer type the result is different than the one returned by @alignOf(T).
- Kind
- function
- Module
std.meta
pub fn ArgsTuple(comptime Function: type) type
For a given function type, returns a tuple type which fields will correspond to the argument types.
- Kind
- type function
- Module
std.meta
pub fn BackingInt(comptime T: type) type
For enums, packed unions and packed structs, returns their backing integer type.
- Kind
- type function
- Module
std.meta
pub fn BareUnion(comptime T: type) type
- Kind
- type function
- Module
std.meta
pub fn Child(comptime T: type) type
Given a parameterized type (array, vector, pointer, optional), returns the "child type".
- Kind
- type function
- Module
std.meta
pub fn containerLayout(comptime T: type) Type.ContainerLayout
- Kind
- function
- Module
std.meta
pub fn declarations(comptime T: type) []const [:0]const u8
Returns the list of declaration names of namespace types.
- Kind
- function
- Module
std.meta
pub fn DeclEnum(comptime T: type) type
- Kind
- type function
- Module
std.meta
pub fn Elem(comptime T: type) type
Given a "memory span" type (array, slice, vector, or pointer to such), returns the "element type".
- Kind
- type function
- Module
std.meta
pub fn eql(a: anytype, b: @TypeOf(a)) bool
Compares two of any type for equality.
- Kind
- function
- Module
std.meta
pub fn FieldEnum(comptime T: type) type
Returns an enum with a variant named after each field of `T`.
- Kind
- type function
- Module
std.meta
pub 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.
- Kind
- function
- Module
std.meta
pub fn Float(comptime bit_count: u8) type
- Kind
- type function
- Module
std.meta
pub fn hasFn(comptime T: type, comptime name: []const u8) bool
Returns true if a type has a namespace and the namespace contains `name`; `false` otherwise.
- Kind
- function
- Module
std.meta
pub fn hasMethod(comptime T: type, comptime name: []const u8) bool
Returns true if a type has a `name` method; `false` otherwise.
- Kind
- function
- Module
std.meta
pub fn hasUniqueRepresentation(comptime T: type) bool
True if every value of the type `T` has a unique bit pattern representing it.
- Kind
- function
- Module
std.meta
pub fn isError(error_union: anytype) bool
Returns whether `error_union` contains an error.
- Kind
- function
- Module
std.meta
pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type
Given a "memory span" type, returns the same type except with the given sentinel value.
- Kind
- type function
- Module
std.meta
pub fn sentinel(comptime T: type) ?Elem(T)
Given a type which can have a sentinel e.g. `[:0]u8`, returns the sentinel value, or `null` if there is not one.
- Kind
- function
- Module
std.meta
pub fn Slice(comptime Pointer: type) type
Given a pointer type, type-erases the array length if present, returning an equivalent pointer type that is always a slice.
- Kind
- type function
- Module
std.meta
pub fn stringToEnum(comptime T: type, tag_name: []const u8) ?T
Returns the variant of an enum type corresponding to the provided tag name, or `null` if no such variant exists.
- Kind
- function
- Module
std.meta
pub fn Tag(comptime T: type) type
- Kind
- type function
- Module
std.meta
pub fn tags(comptime T: type) *const [fieldNames(T).len]T
Given an enum or error set type, returns a pointer to an array containing all tags for that enum or error set.
- Kind
- function
- Module
std.meta
pub fn TrailerFlags(comptime Fields: type) type
This is useful for saving memory when allocating an object that has many optional components.
- Kind
- type function
- Module
std.meta