Utility procedures and types to perform runtime type introspection/reflection (`RTTI`). WARNING! THIS IS ADVANCED BEHAVIOUR FOR ODIN! THIS SHOULD NOT BE USED BY BEGINNERS TO ODIN! This package is only to be used by individuals who know exactly how the RTTI works as well as EXACTLY how `any` works. Especially since `any` can be unintuitive in its use to many, it can be dangerous to use. It is highly recommend that you **do not** use `any` unless you know exactly what you are doing. RTTI is an extremely powerful tool which should only be used when absolutely necessary (such runtime-type-safe formatted printing). ## The Type System of Odin It is important to understand how the type systems works in Odin before using any RTTI. A good example of this is Odin's `distinct` type system. In Odin, `distinct` types are represented by `Type_Info_Named`. A named struct is a `Type_Info_Named` which then points to a `Type_Info_Struct`. This means you must use something like `type_info_base` to restrict the `Type_Info_Named` aspect and get the base-type directly. Doing a type-assertion on the variant will not work as (incorrectly) expected without doing this. ## Advanced Information of How `any` Works An overview of how `any` works: An `any` type can reference any data type. It is functionally equivalent to `struct {data: rawptr, id: typeid}` with extra semantics on how assignment and type assertion works. This is commonly used to construct runtime-type-safe printing, such as in `core:fmt`. The use of `any` outside of this is heavily discourage and should be only used by people who FULLY understand its semantics. The `any` value is only valid as long as the underlying data is still valid. Passing a literal to an `any` will allocate the literal in the current stack frame. Example: x: int = 123 a: any = x // equivalent to a: any a.data = &x a.id = typeid_of(type_of(x)) // With literals v: any = 123 // equivalent to v: any _tmp: int = 123 v.data = &_tmp v.id = typeid_of(type_of(_tmp)) `any` is a topologically-dual to a `union` in terms of its usage. Both support assignments of differing types (`any` being open to any type, `union` being closed to a specific set of types), type assertions (`x.(T)`), and `switch in`. The main internal difference is how the memory is stored. `any` being open is a pointer+typeid, a `union` is a blob+tag. A `union` does not need to store a `typeid` because it is a closed ABI-consistent set of variant types.

Collection Info

View Source
Collection
core
Path
reflect
Entries
151

Source Files

Constants

1

DEFAULT_EQUAL_MAX_RECURSION_LEVEL #

Source
DEFAULT_EQUAL_MAX_RECURSION_LEVEL :: 32

Types

36

Struct_Field_Count_Method #

Source
Struct_Field_Count_Method :: Struct_Field_Count_Method

Struct_Field_Count_Method is the count method used by `struct_field_count` in order to find the number of fields

Struct_Tag #

Source
Struct_Tag :: distinct Struct_Tag

`Struct_Tag` represents the type of the `string` of a struct field Through convention, tags are the concatenation of optionally space-separated key:"value" pairs. Each key is a non-empty string which contains no control characters other than space, quotes, and colon.

Procedures

112

align_of_typeid #

Source
@(require_results)
align_of_typeid :: proc(T: typeid) -> int {…}

returns the alignment of the type that the passed typeid represents

any_base #

Source
@(require_results)
any_base :: proc(v: any) -> any {…}

any_base returns an `any` where the `typeid` has been replaced with the `base-type` equivalent

any_core #

Source
@(require_results)
any_core :: proc(v: any) -> any {…}

any_core returns an `any` where the `typeid` has been replaced with the `core-type` equivalent

any_data #

Source
@(require_results)
any_data :: proc(v: any) -> (data: rawptr, id: typeid) {…}

Splits the data stored in `any` into its two components: `data` and `id`

are_types_identical #

Source
@(require_results)
are_types_identical :: proc(a, b: ^Type_Info) -> bool {…}

Returns true when the `^Type_Info`s are semantically equivalent types Note: The pointers being identical should be enough to check but this is done to make sure in certain cases where it is non-trivial and each value wants to be checked directly.

as_bool #

Source
@(require_results)
as_bool :: proc(a: any) -> (value: bool, valid: bool) {…}

as_bool attempts to convert an `any` to a `bool`.

as_bytes #

Source
@(require_results)
as_bytes :: proc(v: any) -> []u8 {…}

Reinterprets the data stored at `v` as a slice of bytes

as_f64 #

Source
@(require_results)
as_f64 :: proc(a: any) -> (value: f64, valid: bool) {…}

as_f64 attempts to convert an `any` to a `f64`.

as_i64 #

Source
@(require_results)
as_i64 :: proc(a: any) -> (value: i64, valid: bool) {…}

as_i64 attempts to convert an `any` to a `i64`.

as_int #

Source
@(require_results)
as_int :: proc(a: any) -> (value: int, valid: bool) {…}

as_int attempts to convert an `any` to a `int`.

as_pointer #

Source
@(require_results)
as_pointer :: proc(a: any) -> (value: rawptr, valid: bool) {…}

as_pointer attempts to convert an `any` to a `rawptr`. This only works for `^T`, `[^]T`, `cstring`, `cstring16` based types

as_raw_data #

Source
@(require_results)
as_raw_data :: proc(a: any) -> (value: rawptr, valid: bool) {…}

Returns the equivalent of doing `raw_data(v)` where `v` is a non-any value

as_string #

Source
@(require_results)
as_string :: proc(a: any) -> (value: string, valid: bool) {…}

as_string attempts to convert an `any` to a `string`.

as_string16 #

Source
@(require_results)
as_string16 :: proc(a: any) -> (value: string16, valid: bool) {…}

as_string16 attempts to convert an `any` to a `string16`.

as_u64 #

Source
@(require_results)
as_u64 :: proc(a: any) -> (value: u64, valid: bool) {…}

as_u64 attempts to convert an `any` to a `u64`.

as_uint #

Source
@(require_results)
as_uint :: proc(a: any) -> (value: uint, valid: bool) {…}

as_uint attempts to convert an `any` to a `uint`.

backing_type_kind #

Source
@(require_results)
backing_type_kind :: proc(T: typeid) -> Type_Kind {…}

Returns the `Type_Kind` of the core-type of a typeid. See

bit_field_names #

Source
@(require_results)
bit_field_names :: proc(T: typeid) -> []string {…}

bit_field_names returns a `[]string` of the field names of a `bit_field` type `T`

bit_field_offsets #

Source
@(require_results)
bit_field_offsets :: proc(T: typeid) -> []uintptr {…}

bit_field_types returns a `[]uintptr` of the field offsets in bits of a `bit_field` type `T`

bit_field_sizes #

Source
@(require_results)
bit_field_sizes :: proc(T: typeid) -> []uintptr {…}

bit_field_types returns a `[]uintptr` of the field bit-width-sizes of a `bit_field` type `T`

bit_field_tags #

Source
@(require_results)
bit_field_tags :: proc(T: typeid) -> []Struct_Tag {…}

bit_field_types returns a `[]Struct_Tag` of the field tags of a `bit_field` type `T`

bit_field_types #

Source
@(require_results)
bit_field_types :: proc(T: typeid) -> []^Type_Info {…}

bit_field_types returns a `[]^Type_Info` of the field representation types of a `bit_field` type `T`, not the backing integer-bit-width types

bit_fields_zipped #

Source
@(require_results)
bit_fields_zipped :: proc(T: typeid) -> (fields: #soa[]Bit_Field) {…}

Returns the fields of a `bit_field` type `T` as an `#soa` slice. This is useful to iterate over. Example: for field, i in reflect.bit_fields_zipped(Foo_Bit_Field) { ... }

bit_set_is_big_endian #

Source
@(require_results)
bit_set_is_big_endian :: proc(value: any, loc := #caller_location) -> bool {…}

UNSAFE: Checks to see if the data stored is a `bit_set` and is big endian. Panics if a `bit_set` was not passed.

capacity #

Source
@(require_results)
capacity :: proc(val: any) -> int {…}

Returns the capacity of the type that represents the `any` value, or returns 0 if not possible cap(^T) -> cap(T) cap([N]T) -> N cap(#simd[N]T) -> N cap([dynamic]T) cap(map[K]V)

deref #

Source
@(require_results)
deref :: proc(val: any) -> any {…}

Dereferences `any` if it represents a pointer-based value (`^T -> T`)

enum_field_names #

Source
@(require_results)
enum_field_names :: proc(Enum_Type: typeid) -> []string {…}

enum_field_names returns `[]string` of the names of the fields of type `Enum_Type`

enum_field_values #

Source
@(require_results)
enum_field_values :: proc(Enum_Type: typeid) -> []Type_Info_Enum_Value {…}

enum_field_values returns `[]Type_Info_Enum_Value` of the values of the fields of type `Enum_Type`

enum_fields_zipped #

Source
@(require_results)
enum_fields_zipped :: proc(Enum_Type: typeid) -> (fields: #soa[]Enum_Field) {…}

Returns a #soa slice of the enum field information of type `Enum_Type` This is useful to iterate over. Example: for field, i in reflect.enum_fields_zipped(Foo) { ... }

enum_from_name #

Source
@(require_results)
enum_from_name :: proc($Enum_Type: typeid, name: string) -> (value: typeid, ok: bool) {…}

Given an enum type and a value name, get the enum value.

enum_from_name_any #

Source
@(require_results)
enum_from_name_any :: proc(Enum_Type: typeid, name: string) -> (value: Type_Info_Enum_Value, ok: bool) {…}

enum_from_name_any returns the value of an enum field's name if found, returns `0, false` otherwise.

enum_name_from_value #

Source
@(require_results)
enum_name_from_value :: proc(value: $Enum_Type) -> (name: string, ok: bool) {…}

enum_name_from_value returns the name of enum field if a valid name using parametric polymorphism, otherwise returns `"", false`

enum_name_from_value_any #

Source
@(require_results)
enum_name_from_value_any :: proc(value: any) -> (name: string, ok: bool) {…}

enum_name_from_value_any returns the name of enum field if a valid name using reflection, otherwise returns `"", false`

enum_string #

Source
@(require_results)
enum_string :: proc(a: any) -> string {…}

Returns the string representation of an enum value. It will panic if the value passed is not an enum.

enum_value_has_name #

Source
@(require_results)
enum_value_has_name :: proc(value: $T) -> bool {…}

Returns whether the value given has a defined name in the enum type.

eq #

Source
@(require_results)
eq :: proc(a, b: any, including_indirect_array_recursion: bool = false, recursion_level: int = 0) -> bool {…}

Checks to see if two `any` values are semantically equivalent

equal #

Source
@(require_results)
equal :: proc(a, b: any, including_indirect_array_recursion: bool = false, recursion_level: int = 0) -> bool {…}

Checks to see if two `any` values are semantically equivalent

get_union_as_ptr_variants #

Source
@(require_results)
get_union_as_ptr_variants :: proc(val: ^$T) -> (res: $$deferred_return) {…}

Converts a pointer to a union, to a union containing the pointers to the variant types, and stores a pointer of the variant value in the new union Example: val: union{i32, f32, string} val = "123" ptr: union{^i32, ^f32, ^string} = get_union_as_ptr_variants(&val) sp := ptr.(^string) assert(sp^ == "123")

get_union_variant #

Source
@(require_results)
get_union_variant :: proc(a: any) -> any {…}

Returns the underlying variant value of a union. Panics if a union was not passed.

get_union_variant_raw_tag #

Source
@(require_results)
get_union_variant_raw_tag :: proc(a: any) -> i64 {…}

UNSAFE: Returns the underlying tag value of a union. Panics if a union was not passed.

has_no_indirections #

Source
has_no_indirections :: proc(ti: ^Type_Info) -> bool {…}

The `^Type_Info` type refers to absolutely no internal pointers, meaning it can be trivially copied

index #

Source
@(require_results)
index :: proc(val: any, i: int, loc := #caller_location) -> any {…}

Dynamically indexes `any` as an indexable-type if possible. Returns `nil` if not possible

is_any #

Source
@(require_results)
is_any :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is an `any`, false otherwise.

is_array #

Source
@(require_results)
is_array :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is a fixed-array type ([N]T), false otherwise.

is_bit_set #

Source
@(require_results)
is_bit_set :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is a bit_set type, false otherwise.

is_boolean #

Source
@(require_results)
is_boolean :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is a boolean of any kind, false otherwise.

is_byte #

Source
@(require_results)
is_byte :: proc(info: ^Type_Info) -> bool {…}

Returns true when it is a 1-byte wide integer type, false otherwise.

is_complex #

Source
@(require_results)
is_complex :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is a complex-type of any kind, false otherwise.

is_cstring #

Source
@(require_results)
is_cstring :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is a cstring of any kind (cstring, cstring16), false otherwise.

is_cstring16 #

Source
@(require_results)
is_cstring16 :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is a cstring of any kind (cstring16), false otherwise.

is_dynamic_array #

Source
@(require_results)
is_dynamic_array :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is a dynamic-array type ([dynamic]T), false otherwise.

is_dynamic_map #

Source
@(require_results)
is_dynamic_map :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is a map type (map[K]V), false otherwise.

is_endian_big #

Source
@(require_results)
is_endian_big :: proc(info: ^Type_Info) -> bool {…}

Returns true when the core-type is represented with a platform-native endian type or the same endianness as the system. This will also return false when the type is not an integer, pointer, or bit_set. If the type is the same as the platform-native endian type (e.g. `u32be` on a big-endian system), this will return true.

is_endian_little #

Source
@(require_results)
is_endian_little :: proc(info: ^Type_Info) -> bool {…}

Returns true when the core-type is represented with a platform-native endian type or the same endianness as the system. This will also return false when the type is not an integer, pointer, or bit_set. If the type is the same as the platform-native endian type (e.g. `u32le` on a little-endian system), this will return true.

is_endian_platform #

Source
@(require_results)
is_endian_platform :: proc(info: ^Type_Info) -> bool {…}

Returns true when the core-type is represented with a platform-native endian type, and returns false otherwise. This will also return false when the type is not an integer, pointer, or bit_set. If the type is the same as the platform-native endian type (e.g. `u32le` on a little-endian system), this will return false.

is_enum #

Source
@(require_results)
is_enum :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is an enum type, false otherwise.

is_enumerated_array #

Source
@(require_results)
is_enumerated_array :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is an enumerated-array type ([Enum]T), false otherwise.

is_fixed_capacity_dynamic_array #

Source
@(require_results)
is_fixed_capacity_dynamic_array :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is a fixed-capacity dynamic-array type ([dynamic; N]T), false otherwise.

is_float #

Source
@(require_results)
is_float :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is a float of any kind, false otherwise.

is_integer #

Source
@(require_results)
is_integer :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is an integer of any kind, false otherwise.

is_multi_pointer #

Source
@(require_results)
is_multi_pointer :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is a pointer-type of any kind ([^]T), false otherwise.

is_nil #

Source
@(require_results)
is_nil :: proc(v: any) -> bool {…}

Returns true if the `any` value is either `nil` or the data stored at the address is all zeroed

is_parameters #

Source
@(require_results)
is_parameters :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type represents a set of parameters for a procedure (inputs or outputs), false otherwise.

is_pointer #

Source
@(require_results)
is_pointer :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is a pointer-type of any kind (^T or rawptr), false otherwise.

is_pointer_internally #

Source
@(require_results)
is_pointer_internally :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is a pointer-like type, false otherwise.

is_procedure #

Source
@(require_results)
is_procedure :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is a procedure type, false otherwise.

is_quaternion #

Source
@(require_results)
is_quaternion :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is a quaternions any kind, false otherwise.

is_raw_union #

Source
@(require_results)
is_raw_union :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is a struct type with `#raw_union` applied, when `#raw_union` is not applied, the value will be false. All other types will be false otherwise.

is_rune #

Source
@(require_results)
is_rune :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is a rune, false otherwise.

is_signed #

Source
@(require_results)
is_signed :: proc(info: ^Type_Info) -> bool {…}

Returns true if the base-type is a signed integer or just a float, false otherwise.

is_simd_vector #

Source
@(require_results)
is_simd_vector :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is a #simd-array type (#simd[N]T), false otherwise.

is_slice #

Source
@(require_results)
is_slice :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is a slice type ([]T), false otherwise.

is_soa_pointer #

Source
@(require_results)
is_soa_pointer :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is a pointer-type of any kind (#soa^T), false otherwise.

is_string #

Source
@(require_results)
is_string :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is a string of any kind (string, cstring, string16, cstring16), false otherwise.

is_string16 #

Source
@(require_results)
is_string16 :: proc(info: ^Type_Info) -> bool {…}

Returns true the base-type is a string of any kind (string16, cstring16), false otherwise.

is_struct #

Source
@(require_results)
is_struct :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is a struct type, `#raw_union` will be false. All other types will be false otherwise.

is_union #

Source
@(require_results)
is_union :: proc(info: ^Type_Info) -> bool {…}

Returns true when the type is a union type (not `#raw_union`), false otherwise.

is_unsigned #

Source
@(require_results)
is_unsigned :: proc(info: ^Type_Info) -> bool {…}

Returns true if the base-type is an usigned integer, false otherwise.

iterate_array #

Source
@(require_results)
iterate_array :: proc(val: any, it: ^int) -> (elem: any, index: int, ok: bool) {…}

An iterator to dynamically iterate across something that is array-like (or pointer-to-array-like) Example: it: int // used as a tracking value for elem, idx in iterate_array(any_array_val, &it) { ... }

iterate_map #

Source
@(require_results)
iterate_map :: proc(val: any, it: ^int) -> (key, value: any, ok: bool) {…}

An iterator to dynamically iterate across map (or pointer-to-map) Example: it: int // used as a tracking value for key, val in iterate_map(any_map_val, &it) { ... }

length #

Source
@(require_results)
length :: proc(val: any) -> int {…}

Returns the length of the type that represents the `any` value, or returns 0 if not possible len(^T) -> len(T) len([N]T) -> N len(#simd[N]T) -> N len([]T) len([dynamic]T) len(map[K]V) len(string) or len(cstring) len(string16) or len(cstring16)

ne #

Source
@(require_results)
ne :: proc(a, b: any, including_indirect_array_recursion: bool = false, recursion_level: int = 0) -> bool {…}

Checks to see if two `any` values are not semantically equivalent

not_equal #

Source
@(require_results)
not_equal :: proc(a, b: any, including_indirect_array_recursion: bool = false, recursion_level: int = 0) -> bool {…}

Checks to see if two `any` values are not semantically equivalent

set_union_value #

Source
set_union_value :: proc(dst: any, value: any) -> bool {…}

UNSAFE: Manually set the variant value of a union using an `any`. Panics if a union was not passed.

set_union_variant_raw_tag #

Source
set_union_variant_raw_tag :: proc(a: any, tag: i64) {…}

UNSAFE: Manually set the tag value of a union using an integer. Panics if a union was not passed.

set_union_variant_type_info #

Source
set_union_variant_type_info :: proc(a: any, tag_ti: ^Type_Info) {…}

UNSAFE: Manually set the tag value of a union using a `^Type_Info`. Panics if a union was not passed.

set_union_variant_typeid #

Source
set_union_variant_typeid :: proc(a: any, id: typeid) {…}

UNSAFE: Manually set the tag value of a union using a `typeid`. Panics if a union was not passed.

size_of_typeid #

Source
@(require_results)
size_of_typeid :: proc(T: typeid) -> int {…}

returns the size of the type that the passed typeid represents

struct_field_at #

Source
@(require_results)
struct_field_at :: proc(T: typeid, i: int) -> (field: Struct_Field) {…}

Returns a `Struct_Field` containing the information for a struct field of a typeid `T` at index `i`

struct_field_by_name #

Source
@(require_results)
struct_field_by_name :: proc(T: typeid, name: string) -> (field: Struct_Field) {…}

Returns a `Struct_Field` containing the information for a struct field by `name` of a typeid `T`

struct_field_count #

Source
@(require_results)
struct_field_count :: proc(T: typeid, method: Struct_Field_Count_Method = Struct_Field_Count_Method.Top_Level) -> (count: int) {…}

Counts the number of fields in a struct This procedure returns the number of fields in a struct, counting in one of three ways: - .Top_Level: Only counts the top-level fields - .Using: Same count as .Top_Level, and adds the field count of any `using s: Struct` it encounters (in addition to itself) - .Recursive: The count of all top-level fields, plus the count of any child struct's fields, recursively Inputs: - T: The struct type - method: The counting method Returns: - The `count`, enumerated using the `method`, which will be `0` if the type is not a struct Example: symbols_loaded, ok := dynlib.initialize_symbols(&game_api, "game.dll") symbols_expected := reflect.struct_field_count(Game_Api) - API_PRIVATE_COUNT if symbols_loaded != symbols_expected { fmt.eprintf("Expected %v symbols, got %v", symbols_expected, symbols_loaded) return }

struct_field_names #

Source
@(require_results)
struct_field_names :: proc(T: typeid) -> []string {…}

Returns a `[]string` of the names of the struct fields of type `T`

struct_field_offsets #

Source
@(require_results)
struct_field_offsets :: proc(T: typeid) -> []uintptr {…}

Returns a `[]uintptr` of the offsets in bytes of the struct fields of type `T`

struct_field_tags #

Source
@(require_results)
struct_field_tags :: proc(T: typeid) -> []Struct_Tag {…}

Returns a `[]Struct_Tag` of the tags of the struct fields of type `T`

struct_field_types #

Source
@(require_results)
struct_field_types :: proc(T: typeid) -> []^Type_Info {…}

Returns a `[]^Type_Info` of the types of the struct fields of type `T`

struct_field_value #

Source
@(require_results)
struct_field_value :: proc(a: any, field: Struct_Field) -> any {…}

Returns an `any` of a struct field specified by a `Struct_Field` Example: field := struct_field_value_by_name(the_struct, "field_name") value_by_field := struct_field_value(the_struct, field)

struct_field_value_by_name #

Source
@(require_results)
struct_field_value_by_name :: proc(a: any, field: string, allow_using: bool = false) -> any {…}

Returns an `any` of a struct field specified by name Example: v := struct_field_value_by_name(the_struct, "field_name") nested_value_through_using := struct_field_value_by_name(the_struct, "field_name", allow_using=true)

struct_fields_zipped #

Source
@(require_results)
struct_fields_zipped :: proc(T: typeid) -> (fields: #soa[]Struct_Field) {…}

Returns the fields of a struct type `T` as an `#soa` slice. This is useful to iterate over. Example: for field, i in reflect.struct_fields_zipped(Foo) { ... }

struct_tag_get #

Source
@(require_results)
struct_tag_get :: proc(tag: Struct_Tag, key: string) -> (value: string) {…}

struct_tag_get returns the value associated with a key in the tag string. If the key is present in the tag, the value (which might be empty) is returned. Otherwise an empty string is returned. This is just a wrapper around `struct_tag_lookup` with the `ok` value being ignored. The convention for struct tags is usually of the form: `key:"value" another:"set" and:"whatever"`

struct_tag_lookup #

Source
@(require_results)
struct_tag_lookup :: proc(tag: Struct_Tag, key: string) -> (value: string, ok: bool) {…}

struct_tag_lookup returns the value associated with a key in the tag string. If the key is present in the tag, the value (which might be empty) is return. Otherwise an empty string is returned. The `ok` value returns whether the value was explicit set in the tag string. The convention for struct tags is usually of the form: `key:"value" another:"set" and:"whatever"`

type_info_union_is_pure_maybe #

Source
@(require_results)
type_info_union_is_pure_maybe :: proc(info: Type_Info_Union) -> bool {…}

Returns whether the `Type_Info_Union` store no tag (called a "pure maybe").

type_kind #

Source
@(require_results)
type_kind :: proc(T: typeid) -> Type_Kind {…}

type_kind returns a enum `Type_Kind` to state what kind of type a typeid is

typeid_elem #

Source
@(require_results)
typeid_elem :: proc(id: typeid) -> typeid {…}

typeid_elem returns a `typeid` of the element-type of a type if possible, otherwise it returns itself complex32 -> f16 complex64 -> f32 complex128 -> f64 quaternion64 -> f16 quaternion128 -> f32 quaternion256 -> f64 ^T -> T [^]T -> T #soa^T -> T [N]T -> T []T -> T [dynamic]T -> T #simd[N]T -> T

underlying_type_kind #

Source
@(require_results)
underlying_type_kind :: proc(T: typeid) -> Type_Kind {…}

Returns the `Type_Kind` of the base-type of a typeid.

union_variant_type_info #

Source
@(require_results)
union_variant_type_info :: proc(a: any) -> ^Type_Info {…}

Returns `^Type_Info` of a any-encoded union type. Panics if a union was not passed.

union_variant_typeid #

Source
@(require_results)
union_variant_typeid :: proc(a: any) -> typeid {…}

UNSAFE: Returns `typeid` of a any-encoded union type. Panics if a union was not passed.

write_type_builder #

Source
write_type_builder :: proc(buf: ^Builder, ti: ^Type_Info) -> int {…}

Writes a `^Type_Info` in standard (non-canonical) form to a `strings.Builder`

write_type_writer #

Source
write_type_writer :: proc(w: Stream, ti: ^Type_Info, n_written: ^int = nil) -> (n: int, err: Error) {…}

Writes a `^Type_Info` in standard (non-canonical) form to an `io.Writer`

write_typeid_builder #

Source
write_typeid_builder :: proc(buf: ^Builder, id: typeid, n_written: ^int = nil) -> (n: int, err: Error) {…}

Writes a typeid in standard (non-canonical) form to a `strings.Builder`

write_typeid_writer #

Source
write_typeid_writer :: proc(writer: Stream, id: typeid, n_written: ^int = nil) -> (n: int, err: Error) {…}

Writes a typeid in standard (non-canonical) form to an `io.Writer`

Procedure Groups

2