Skip to main content

Module mutator

Module mutator 

Source
Expand description

Per-thread runtime context: identity, allocation, and the handle stack that roots values held by native code across calls back into the interpreter.

Structs§

Handle
An index into the handle stack, valid inside the Mutator::scope that created it.
HandleScope
A region in which native code can root values across calls back into the interpreter (which may collect). Handles borrow the scope, so the borrow checker keeps them from escaping it; dropping the scope releases them.
Local
A rooted value, valid for the lifetime of its HandleScope.
Mutator

Enums§

Trap
A recoverable interruption of execution.

Functions§

check_alloc
Checks a request for count items of size bytes before allocating it, so that sizes the machine cannot provide raise a MemoryError panic (with the program’s stack trace) instead of aborting the process in the allocator. Returns the size in bytes.
note_external
Memory held outside GC pages (vector buffers) counts toward the collection budget.
panic
refused
The MemoryError for a request the allocator refused (what says which). Hands the collector’s headroom back to the OS first, so that reporting the error does not fail too.
try_collect
Collects items into a vector, raising a MemoryError panic as try_push does.
try_push
Pushes x onto a vector a native is building, raising a MemoryError panic if the vector cannot grow. There is no collection and retry: the vector may hold values that nothing else roots.
try_string
An empty string with room for exactly bytes bytes, or a MemoryError panic.
try_vec
An empty vector with room for exactly n items, or a MemoryError panic if that much memory cannot be had (see check_alloc).

Type Aliases§

RtResult