pub struct HeapGuard { /* private fields */ }Expand description
A scoped guard for the currently-active heap. Pushed at entry to
state.run() / state.protected_call() / state.load(); popped on
drop. Supports nesting (multiple LuaStates on one thread).
Holds a strong Rc<Heap> on the TLS stack (issue #252): the guard is
sound with no outlives contract — a guard that outlives its Lua keeps
the heap alive until the guard pops, rather than dangling. Guards are
function-scoped everywhere in-tree, so the lifetime extension is
transient by construction.
!Send/!Sync (via the Rc it carries): the stack it pops lives in
this thread’s TLS, so moving a guard to another thread would pop the
wrong stack. The guard keeps its own copy of the heap handle so Drop
can assert it pops the frame it pushed.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for HeapGuard
impl !Send for HeapGuard
impl !Sync for HeapGuard
impl !UnwindSafe for HeapGuard
impl Freeze for HeapGuard
impl Unpin for HeapGuard
impl UnsafeUnpin for HeapGuard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more