[−][src]Trait zerogc::GcRef
A garbage collected pointer to a value.
This is the equivalent of a garbage collected smart-pointer.
It's so smart, you can even coerce it to a reference bound to the lifetime of the GarbageCollectorRef
.
However, all those references are invalidated by the borrow checker as soon as
your reference to the collector reaches a safepoint.
The objects can only survive garbage collection if they live in this smart-pointer.
The smart pointer is simply a guarantee to the garbage collector that this points to a garbage collected object with the correct header, and not some arbitrary bits that you've decided to heap allocate.
Associated Types
Loading content...Required methods
Loading content...Provided methods
unsafe fn as_raw_ptr(&self) -> *mut T
Cast this reference to a raw pointer
Safety
It's undefined behavior to mutate the value. The pointer is only valid as long as the reference is.