[−][src]Trait zerogc::GcContext
The context of garbage collection, which can be frozen at a safepoint.
This is essentially used to maintain a shadow-stack to a set of roots, which are guarenteed not to be collected until a safepoint.
This context doesn't necessarily support allocation (see [GcAllocContext] for that).
Associated Types
Loading content...Required methods
unsafe fn basic_safepoint<T: Trace>(&mut self, value: &mut &mut T)
Inform the garbage collection system we are at a safepoint and are ready for a potential garbage collection.
Safety
This method is unsafe and should never be invoked by user code.
See the safepoint! macro for a safe wrapper.
unsafe fn recurse_context<T, F, R>(&self, value: &mut &mut T, func: F) -> R where
T: Trace,
F: for<'gc> FnOnce(&'gc mut Self, &'gc mut T) -> R,
T: Trace,
F: for<'gc> FnOnce(&'gc mut Self, &'gc mut T) -> R,
Invoke the closure with a temporary GcContext.
The specified value is guarenteed to live throughout the created context for the closure. However, because it could possibly be relocated by a collection, it's bound to the lifetime of the sub-collector.
Safety
This macro doesn't imply garbage collection, so it doesn't mutate the collector directly. However the specified closure could trigger a collection in the sub-context. This would in undefined behavior if the collection invalidates a pointer tied to this context.
For this reason, this function should never be invoked by user code.
See the safepoint_recurse! macro for a safe wrapper