[−][src]Trait zerogc::GcSimpleAlloc
A simple interface to allocating from a GcContext.
Some garbage collectors implement more complex interfaces, so implementing this is optional
Required methods
pub fn alloc(&'gc self, value: T) -> Gc<'gc, T, Self::Id>
[src]
Allocate the specified object in this garbage collector, binding it to the lifetime of this collector.
The object will never be collected until the next safepoint, which is considered a mutation by the borrow checker and will be statically checked. Therefore, we can statically guarantee the pointers will survive until the next safepoint.
See safepoint!
docs on how to properly invoke a safepoint
and transfer values across it.
This gives a immutable reference to the resulting object.
Once allocated, the object can only be correctly modified with a GcCell