pub unsafe trait GcTrace {
// Required method
fn trace(&self);
// Provided methods
fn size_hint(&self) -> usize { ... }
fn cleanup(&self) { ... }
}Expand description
Trait required for all GC’d data.
Unsafe because if the trace() implementation fails to call Gc::mark_trace()
and GcWeak::mark_trace() on all of the Gc and GcWeak pointers that it can reach,
the GC will free memory that is still in use.
SAFETY: If the receiver also impls Drop, the drop() impl must not deref any Gc or GcWeak pointers
Required Methods§
Provided Methods§
Sourcefn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If the GcTrace owns any allocations, this should return the extra allocated size.
If the allocation can change size, like a Vec