[][src]Macro zerogc::safepoint

macro_rules! safepoint {
    ($collector:ident, $value:expr) => { ... };
}

Indicate it's safe to begin a garbage collection, while keeping the specified root alive.

All other garbage collected pointers that aren't reachable from the root are invalidated. They have a lifetime that references the [GarbageCollectorRef] and the borrow checker considers the safepoint a 'mutation'.

The root is exempted from the "mutation" and rebound to the new lifetime.

Example

let root = safepoint!(collector, root);

Safety

This macro is completely safe, although it expands to unsafe code internally.