pub trait GcRuntime: Send + Sync {
type Array: Array;
// Required methods
fn alloc(&self, ty: &Type) -> GcPtr;
fn alloc_array(&self, ty: &Type, n: usize) -> Self::Array;
fn ptr_type(&self, obj: GcPtr) -> Type;
fn array(&self, handle: GcPtr) -> Option<Self::Array>;
fn root(&self, obj: GcPtr);
fn unroot(&self, obj: GcPtr);
fn stats(&self) -> Stats;
}Expand description
An object that can be used to allocate and collect memory.
Required Associated Types§
Required Methods§
Sourcefn alloc_array(&self, ty: &Type, n: usize) -> Self::Array
fn alloc_array(&self, ty: &Type, n: usize) -> Self::Array
Allocates an array of the given type. ty must be an array type.
Sourcefn array(&self, handle: GcPtr) -> Option<Self::Array>
fn array(&self, handle: GcPtr) -> Option<Self::Array>
Returns array information of the specified handle
Sourcefn root(&self, obj: GcPtr)
fn root(&self, obj: GcPtr)
Roots the specified obj, which keeps it and objects it references alive. Objects marked
as root, must call unroot before they can be collected. An object can be rooted multiple
times, but you must make sure to call unroot an equal number of times before the object
can be collected.