package core:reflect
Overview
Package reflect provides 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.
Index
Types (35)
- Bit_Field
- Enum_Field
- Struct_Field
- Struct_Field_Count_Method
- Struct_Tag
- Type_Info
- Type_Info_Any
- Type_Info_Array
- Type_Info_Bit_Field
- Type_Info_Bit_Set
- Type_Info_Boolean
- Type_Info_Complex
- Type_Info_Dynamic_Array
- Type_Info_Enum
- Type_Info_Enum_Value
- Type_Info_Enumerated_Array
- Type_Info_Float
- Type_Info_Integer
- Type_Info_Map
- Type_Info_Matrix
- Type_Info_Multi_Pointer
- Type_Info_Named
- Type_Info_Parameters
- Type_Info_Pointer
- Type_Info_Procedure
- Type_Info_Quaternion
- Type_Info_Rune
- Type_Info_Simd_Vector
- Type_Info_Slice
- Type_Info_Soa_Pointer
- Type_Info_String
- Type_Info_Struct
- Type_Info_Type_Id
- Type_Info_Union
- Type_Kind
Constants (1)
Variables (0)
This section is empty.
Procedures (109)
- align_of_typeid
- any_base
- any_core
- any_data
- are_types_identical
- as_bool
- as_bytes
- as_f64
- as_i64
- as_int
- as_pointer
- as_raw_data
- as_string
- as_string16
- as_u64
- as_uint
- backing_type_kind
- bit_field_names
- bit_field_offsets
- bit_field_sizes
- bit_field_tags
- bit_field_types
- bit_fields_zipped
- bit_set_is_big_endian
- capacity
- deref
- enum_field_names
- enum_field_values
- enum_fields_zipped
- enum_from_name
- enum_from_name_any
- enum_name_from_value
- enum_name_from_value_any
- enum_string
- enum_value_has_name
- eq
- equal
- get_union_as_ptr_variants
- get_union_variant
- get_union_variant_raw_tag
- index
- is_any
- is_array
- is_bit_set
- is_boolean
- is_byte
- is_complex
- is_cstring
- is_cstring16
- is_dynamic_array
- is_dynamic_map
- is_endian_big
- is_endian_little
- is_endian_platform
- is_enum
- is_enumerated_array
- is_float
- is_integer
- is_multi_pointer
- is_nil
- is_parameters
- is_pointer
- is_pointer_internally
- is_procedure
- is_quaternion
- is_raw_union
- is_rune
- is_signed
- is_simd_vector
- is_slice
- is_soa_pointer
- is_string
- is_string16
- is_struct
- is_union
- is_unsigned
- iterate_array
- iterate_map
- length
- ne
- not_equal
- relative_pointer_to_absolute_raw
- set_union_value
- set_union_variant_raw_tag
- set_union_variant_type_info
- set_union_variant_typeid
- size_of_typeid
- struct_field_at
- struct_field_by_name
- struct_field_count
- struct_field_names
- struct_field_offsets
- struct_field_tags
- struct_field_types
- struct_field_value
- struct_field_value_by_name
- struct_fields_zipped
- struct_tag_get
- struct_tag_lookup
- type_info_union_is_pure_maybe
- type_kind
- typeid_elem
- underlying_type_kind
- union_variant_type_info
- union_variant_typeid
- write_type_builder
- write_type_writer
- write_typeid_builder
- write_typeid_writer
Procedure Groups (2)
Types
Bit_Field ¶
Bit_Field :: struct { name: string, type: ^runtime.Type_Info, size: uintptr, // Size in bits offset: uintptr, // Offset in bits tag: Struct_Tag, }
Enum_Field ¶
Enum_Field :: struct { name: string, value: runtime.Type_Info_Enum_Value, }
Represents an Enum_Field
storing the name
and value
Struct_Field ¶
Struct_Field :: struct { name: string, type: ^runtime.Type_Info, tag: Struct_Tag, offset: uintptr, // in bytes is_using: bool, }
Struct_Field
represents a information of a field of a struct
Related Procedures With Parameters
Related Procedures With Returns
Struct_Field_Count_Method ¶
Struct_Field_Count_Method :: enum int { Top_Level, Using, Recursive, }
Struct_Field_Count_Method is the count method used by struct_field_count
in order to find the number of fields
Related Procedures With Parameters
Struct_Tag ¶
Struct_Tag :: distinct string
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.
Related Procedures With Parameters
Type_Info ¶
Type_Info :: runtime.Type_Info
Type_Info_Any ¶
Type_Info_Any :: runtime.Type_Info_Any
Type_Info_Array ¶
Type_Info_Array :: runtime.Type_Info_Array
Type_Info_Bit_Field ¶
Type_Info_Bit_Field :: runtime.Type_Info_Bit_Field
Type_Info_Bit_Set ¶
Type_Info_Bit_Set :: runtime.Type_Info_Bit_Set
Type_Info_Boolean ¶
Type_Info_Boolean :: runtime.Type_Info_Boolean
Type_Info_Complex ¶
Type_Info_Complex :: runtime.Type_Info_Complex
Type_Info_Dynamic_Array ¶
Type_Info_Dynamic_Array :: runtime.Type_Info_Dynamic_Array
Type_Info_Enum ¶
Type_Info_Enum :: runtime.Type_Info_Enum
Type_Info_Enum_Value ¶
Type_Info_Enum_Value :: runtime.Type_Info_Enum_Value
Type_Info_Enumerated_Array ¶
Type_Info_Enumerated_Array :: runtime.Type_Info_Enumerated_Array
Type_Info_Float ¶
Type_Info_Float :: runtime.Type_Info_Float
Type_Info_Integer ¶
Type_Info_Integer :: runtime.Type_Info_Integer
Type_Info_Map ¶
Type_Info_Map :: runtime.Type_Info_Map
Type_Info_Matrix ¶
Type_Info_Matrix :: runtime.Type_Info_Matrix
Type_Info_Multi_Pointer ¶
Type_Info_Multi_Pointer :: runtime.Type_Info_Multi_Pointer
Type_Info_Named ¶
Type_Info_Named :: runtime.Type_Info_Named
Type_Info_Parameters ¶
Type_Info_Parameters :: runtime.Type_Info_Parameters
Type_Info_Pointer ¶
Type_Info_Pointer :: runtime.Type_Info_Pointer
Type_Info_Procedure ¶
Type_Info_Procedure :: runtime.Type_Info_Procedure
Type_Info_Quaternion ¶
Type_Info_Quaternion :: runtime.Type_Info_Quaternion
Type_Info_Rune ¶
Type_Info_Rune :: runtime.Type_Info_Rune
Type_Info_Simd_Vector ¶
Type_Info_Simd_Vector :: runtime.Type_Info_Simd_Vector
Type_Info_Slice ¶
Type_Info_Slice :: runtime.Type_Info_Slice
Type_Info_Soa_Pointer ¶
Type_Info_Soa_Pointer :: runtime.Type_Info_Soa_Pointer
Type_Info_String ¶
Type_Info_String :: runtime.Type_Info_String
Type_Info_Struct ¶
Type_Info_Struct :: runtime.Type_Info_Struct
Type_Info_Type_Id ¶
Type_Info_Type_Id :: runtime.Type_Info_Type_Id
Type_Info_Union ¶
Type_Info_Union :: runtime.Type_Info_Union
Type_Kind ¶
Type_Kind :: enum int { Invalid, Named, Integer, Rune, Float, Complex, Quaternion, String, Boolean, Any, Type_Id, Pointer, Multi_Pointer, Procedure, Array, Enumerated_Array, Dynamic_Array, Slice, Parameters, Struct, Union, Enum, Map, Bit_Set, Simd_Vector, Matrix, Soa_Pointer, Bit_Field, }
Related Procedures With Returns
Constants
DEFAULT_EQUAL_MAX_RECURSION_LEVEL ¶
DEFAULT_EQUAL_MAX_RECURSION_LEVEL: int : 32
Variables
This section is empty.
Procedures
align_of_typeid ¶
returns the alignment of the type that the passed typeid represents
any_base ¶
any_base returns an any
where the typeid
has been replaced with the base-type
equivalent
any_core ¶
any_core returns an any
where the typeid
has been replaced with the core-type
equivalent
any_data ¶
Splits the data stored in any
into its two components: data
and id
are_types_identical ¶
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 ¶
as_bool attempts to convert an any
to a bool
.
as_bytes ¶
Reinterprets the data stored at v
as a slice of bytes
as_f64 ¶
as_f64 attempts to convert an any
to a f64
.
as_i64 ¶
as_i64 attempts to convert an any
to a i64
.
as_int ¶
as_int attempts to convert an any
to a int
.
as_pointer ¶
as_pointer attempts to convert an any
to a rawptr
.
This only works for ^T
, [^]T
, cstring
, cstring16
based types
as_raw_data ¶
Returns the equivalent of doing raw_data(v)
where v
is a non-any value
as_string ¶
as_string attempts to convert an any
to a string
.
as_string16 ¶
as_string16 attempts to convert an any
to a string16
.
as_u64 ¶
as_u64 attempts to convert an any
to a u64
.
as_uint ¶
as_uint attempts to convert an any
to a uint
.
backing_type_kind ¶
Returns the Type_Kind
of the core-type of a typeid. See
bit_field_names ¶
bit_field_names returns a []string
of the field names of a bit_field
type T
bit_field_offsets ¶
bit_field_types returns a []uintptr
of the field offsets in bits of a bit_field
type T
bit_field_sizes ¶
bit_field_types returns a []uintptr
of the field bit-width-sizes of a bit_field
type T
bit_field_tags ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Dereferences any
if it represents a pointer-based value (^T -> T
)
enum_field_names ¶
enum_field_names returns []string
of the names of the fields of type Enum_Type
enum_field_values ¶
enum_field_values :: proc(Enum_Type: typeid) -> []runtime.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 ¶
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 ¶
Given an enum type and a value name, get the enum value.
enum_from_name_any ¶
enum_from_name_any :: proc(Enum_Type: typeid, name: string) -> (value: runtime.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 ¶
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 ¶
enum_name_from_value_any returns the name of enum field if a valid name using reflection, otherwise returns "", false
enum_string ¶
Returns the string representation of an enum value. It will panic if the value passed is not an enum.
enum_value_has_name ¶
enum_value_has_name :: proc(value: $T) -> bool {…}
Returns whether the value given has a defined name in the enum type.
equal ¶
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 ¶
get_union_as_ptr_variants :: proc(val: ^$T) -> (res: $T) {…}
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 ¶
Returns the underlying variant value of a union. Panics if a union was not passed.
get_union_variant_raw_tag ¶
UNSAFE: Returns the underlying tag value of a union. Panics if a union was not passed.
index ¶
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 ¶
Returns true the base-type is an any
, false otherwise.
is_array ¶
Returns true when the type is a fixed-array type ([N]T), false otherwise.
is_bit_set ¶
Returns true when the type is a bit_set type, false otherwise.
is_boolean ¶
Returns true the base-type is a boolean of any kind, false otherwise.
is_byte ¶
Returns true when it is a 1-byte wide integer type, false otherwise.
is_complex ¶
Returns true the base-type is a complex-type of any kind, false otherwise.
is_cstring ¶
Returns true the base-type is a cstring of any kind (cstring, cstring16), false otherwise.
is_cstring16 ¶
Returns true the base-type is a cstring of any kind (cstring16), false otherwise.
is_dynamic_array ¶
Returns true when the type is a dynamic-array type ([dynamic]T), false otherwise.
is_dynamic_map ¶
Returns true when the type is a map type (map[K]V), false otherwise.
is_endian_big ¶
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 ¶
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 ¶
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 ¶
Returns true when the type is an enum type, false otherwise.
is_enumerated_array ¶
Returns true when the type is an enumerated-array type ([Enum]T), false otherwise.
is_float ¶
Returns true the base-type is a float of any kind, false otherwise.
is_integer ¶
Returns true the base-type is an integer of any kind, false otherwise.
is_multi_pointer ¶
Returns true the base-type is a pointer-type of any kind ([^]T), false otherwise.
is_nil ¶
Returns true if the any
value is either nil
or the data stored at the address is all zeroed
is_parameters ¶
Returns true when the type represents a set of parameters for a procedure (inputs or outputs), false otherwise.
is_pointer ¶
Returns true the base-type is a pointer-type of any kind (^T or rawptr), false otherwise.
is_pointer_internally ¶
Returns true when the type is a pointer-like type, false otherwise.
is_procedure ¶
Returns true when the type is a procedure type, false otherwise.
is_quaternion ¶
Returns true the base-type is a quaternions any kind, false otherwise.
is_raw_union ¶
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 ¶
Returns true the base-type is a rune, false otherwise.
is_signed ¶
Returns true if the base-type is a signed integer or just a float, false otherwise.
is_simd_vector ¶
Returns true when the type is a #simd-array type (#simd[N]T), false otherwise.
is_slice ¶
Returns true when the type is a slice type ([]T), false otherwise.
is_soa_pointer ¶
Returns true the base-type is a pointer-type of any kind (#soa^T), false otherwise.
is_string ¶
Returns true the base-type is a string of any kind (string, cstring, string16, cstring16), false otherwise.
is_string16 ¶
Returns true the base-type is a string of any kind (string16, cstring16), false otherwise.
is_struct ¶
Returns true when the type is a struct type, #raw_union
will be false. All other types will be false otherwise.
is_union ¶
Returns true when the type is a union type (not #raw_union
), false otherwise.
is_unsigned ¶
Returns true if the base-type is an usigned integer, false otherwise.
iterate_array ¶
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 ¶
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 ¶
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)
not_equal ¶
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 ¶
UNSAFE: Manually set the variant value of a union using an any
. Panics if a union was not passed.
set_union_variant_raw_tag ¶
UNSAFE: Manually set the tag value of a union using an integer. Panics if a union was not passed.
set_union_variant_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 ¶
UNSAFE: Manually set the tag value of a union using a typeid
. Panics if a union was not passed.
size_of_typeid ¶
returns the size of the type that the passed typeid represents
struct_field_at ¶
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 ¶
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 ¶
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 ¶
Returns a []string
of the names of the struct fields of type T
struct_field_offsets ¶
Returns a []uintptr
of the offsets in bytes of the struct fields of type T
struct_field_tags ¶
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 ¶
Returns a []^Type_Info
of the types of the struct fields of type T
struct_field_value ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
type_info_union_is_pure_maybe :: proc(info: runtime.Type_Info_Union) -> bool {…}
Returns whether the Type_Info_Union
store no tag (called a "pure maybe").
type_kind ¶
type_kind returns a enum Type_Kind
to state what kind of type a typeid is
typeid_elem ¶
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 ¶
Returns the Type_Kind
of the base-type of a typeid.
union_variant_type_info ¶
Returns ^Type_Info
of a any-encoded union type. Panics if a union was not passed.
union_variant_typeid ¶
UNSAFE: Returns typeid
of a any-encoded union type. Panics if a union was not passed.
write_type_builder ¶
Writes a ^Type_Info
in standard (non-canonical) form to a strings.Builder
write_type_writer ¶
write_type_writer :: proc(w: io.Stream, ti: ^runtime.Type_Info, n_written: ^int = nil) -> (n: int, err: io.Error) {…}
Writes a ^Type_Info
in standard (non-canonical) form to an io.Writer
write_typeid_builder ¶
write_typeid_builder :: proc(buf: ^strings.Builder, id: typeid, n_written: ^int = nil) -> (n: int, err: io.Error) {…}
Writes a typeid in standard (non-canonical) form to a strings.Builder
write_typeid_writer ¶
write_typeid_writer :: proc(writer: io.Stream, id: typeid, n_written: ^int = nil) -> (n: int, err: io.Error) {…}
Writes a typeid in standard (non-canonical) form to an io.Writer
Procedure Groups
write_type ¶
write_type :: proc{ write_type_builder, write_type_writer, }
Writes a ^Type_Info
in standard (non-canonical) form
write_typeid ¶
write_typeid :: proc{ write_typeid_builder, write_typeid_writer, }
Writes a typeid in standard (non-canonical) form
Source Files
Generation Information
Generated with odin version dev-2025-10 (vendor "odin") Windows_amd64 @ 2025-10-07 21:12:01.865753100 +0000 UTC