Skip to main content

Module object

Module object 

Source
Expand description

Heap object layouts and their GC hooks.

Every object starts with a Header. Instances keep their fields inline as atomic words, so a racing reader can never see a torn value. Lists do the same with their elements and swap whole buffers on growth, so their reads never lock. Dicts and other containers keep Rust-side buffers; the ownership rules (and per-object locks for shared objects) guarantee those are never mutated while another thread reads them.

Structs§

AtomicObj
BigIntObj
CellObj
ChannelInner
ChannelObj
ChannelState
ClosureObj
DictObj
InstanceObj
ListObj
A list: header, length, a pointer to a backing array, and room for a few elements inline.
MutexObj
NativeObj
StrObj
A string: immutable UTF-8 bytes with a cached hash and character count.
StringBuilderObj
ThreadInner
ThreadObj
TupleObj

Enums§

ThreadOutcome
Outcome of a finished thread: its value or its panic message.

Traits§

NativeData

Functions§

as_atomic⚠
Safety
as_bigint⚠
Safety
as_cell⚠
Safety
as_channel⚠
Safety
as_closure⚠
Safety
as_dict⚠
Safety
as_instance⚠
Safety
as_list⚠
Safety
as_mutex⚠
Safety
as_native⚠
Safety
as_sb⚠
Safety
as_str_obj⚠
Safety
as_thread⚠
Safety
as_tuple⚠
Safety
atomic_of
The Atomic behind v, or a TypeError panic if v is not one.
channel_of
The Channel behind v, or a TypeError panic if v is not one.
dict_of
The Dict or Set behind v, or a TypeError panic if v is not one.
instance_of
The instance behind v if it is of class class_id exactly (builtin and prelude classes, which have no subclasses), or a TypeError panic naming want.
instance_with_field
The instance behind v if it is an instance with a field i (of any class), else None. Reading the field is then memory-safe; whether it is the expected class’s field is up to the caller.
kind_of
The object kind of a value (Immediate for non-pointers).
list_of
The List behind v, or a TypeError panic if v is not one.
mark_value
mutex_of
The Mutex behind v, or a TypeError panic if v is not one.
sb_of
The StringBuilder behind v, or a TypeError panic if v is not one.
str_obj_of
The String behind v, or a TypeError panic if v is not one.
str_of
Returns the string slice if v is a string.
thread_of
The Thread behind v, or a TypeError panic if v is not one.
tuple_of
The Tuple behind v, or a TypeError panic if v is not one.
type_error
A TypeError panic: expected {want}, got {the class of v}.

Type Aliases§

Wake
Wakes a parked fiber (see the standard library’s fiber scheduler).