Skip to main content

with_current_heap

Function with_current_heap 

Source
pub fn with_current_heap<R>(
    f: impl for<'a> FnOnce(Option<&'a Rc<Heap>>) -> R,
) -> R
Expand description

Runs f with a reference to the currently-active heap, or None if no HeapGuard is in scope.

The heap reference is deliberately scoped to the closure. This avoids the previous current_heap() -> Option<&'static Heap> lifetime lie while still supporting legacy GcRef::new call sites that do not receive &mut LuaState.