Skip to main content

internal.types.rtti

Standard library Module View source
function force_cast
@inline
force_cast[D: type](obj)
class TypeInfo
class TypeInfo
Fields 20
id int
n_mro int
mro Ptr[int]
offsets Ptr[int]
sorted_mro Ptr[int]
n_slots int
slots Ptr[Tuple[(str, int, int)]]
n_methods int
methods Ptr[_MethodSlot]
rtti bool
raw_name str
nice_name str
base_name str
n_params int
params Ptr[int]
size int
reference bool
inline_value bool
exception_offset int
system_exit_offset int
Methods 6
value_hash
value_hash(self: Self, data: Ptr[byte]) -> int

Hash an erased payload using this descriptor's registered adapter.

value_equal
value_equal(self: Self, left: Ptr[byte], right: Ptr[byte]) -> bool

Compare two erased payloads of this descriptor's type.

value_dict
value_dict(self: Self, data: Ptr[byte])

Copy an erased dictionary through its typed items iterator.

cache
cache(id: int) -> TypeInfo
cache[T: type]() -> TypeInfo
is_parent
is_parent[T: type](self: Self) -> bool
wrap
wrap[T: type](arg: Ptr[u8]) -> str
Special methods 6
__raw__
__raw__(self: Self) -> Ptr[u8]
__iter__
__iter__(self: Self)
__str__
__str__(self: Self)
__repr__
__repr__(self: Self)
__eq__
__eq__(self: Self, other: TypeInfo)
__ne__
__ne__(self: Self, other: TypeInfo)
function get_typeinfo
@pure @llvm
get_typeinfo(obj) -> TypeInfo
%info = load ptr, ptr %obj
ret ptr %info
class Super
@extend
class Super[T]
Constructors 1
__new__
__new__[B: type, D: type](obj: D) -> Super[B]
Special methods 1
__getattr__
__getattr__[attr: Literal[str]](self: Self)