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).
Implementations§
Source§impl HeapGuard
impl HeapGuard
Sourcepub fn push(heap: &Heap) -> Self
pub fn push(heap: &Heap) -> Self
Push heap onto the active stack. Returns a guard; dropping it pops.
§Safety
The pointer must remain valid for the lifetime of the guard. Callers
typically pass &state.global.heap, which lives as long as the
GlobalState (an Rc<RefCell<_>>); the guard must drop before the
state is dropped.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HeapGuard
impl RefUnwindSafe for HeapGuard
impl Send for HeapGuard
impl Sync for HeapGuard
impl Unpin for HeapGuard
impl UnsafeUnpin for HeapGuard
impl UnwindSafe 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