pub struct PushGuard<L> { /* private fields */ }
Expand description
RAII guard for a value pushed on the stack.
You shouldn’t have to manipulate this type directly unless you are fiddling with the library’s internals.
Implementations§
source§impl<'lua, L> PushGuard<L>where
L: AsMutLua<'lua>,
impl<'lua, L> PushGuard<L>where
L: AsMutLua<'lua>,
sourcepub unsafe fn new(lua: L, size: i32) -> Self
pub unsafe fn new(lua: L, size: i32) -> Self
Creates a new PushGuard
from this Lua context representing size
items on the stack.
When this PushGuard
is destroyed, size
items will be popped.
This is unsafe because the Lua stack can be corrupted if this is misused.
sourcepub unsafe fn forget(self) -> i32
pub unsafe fn forget(self) -> i32
Prevents the value from being popped when the PushGuard
is destroyed, and returns the
number of elements on the Lua stack.
This is unsafe because the Lua stack can be corrupted if this is misused.
sourcepub fn into_inner(self) -> L
pub fn into_inner(self) -> L
Destroys the guard, popping the value. Returns the inner part, which returns access when using by-value capture.
Trait Implementations§
source§impl<'lua, L> AsLua<'lua> for PushGuard<L>where
L: AsMutLua<'lua>,
impl<'lua, L> AsLua<'lua> for PushGuard<L>where
L: AsMutLua<'lua>,
fn as_lua(&self) -> LuaContext
source§impl<'lua, L> AsMutLua<'lua> for PushGuard<L>where
L: AsMutLua<'lua>,
impl<'lua, L> AsMutLua<'lua> for PushGuard<L>where
L: AsMutLua<'lua>,
source§fn as_mut_lua(&mut self) -> LuaContext
fn as_mut_lua(&mut self) -> LuaContext
Returns the raw Lua context.
Auto Trait Implementations§
impl<L> Freeze for PushGuard<L>where
L: Freeze,
impl<L> RefUnwindSafe for PushGuard<L>where
L: RefUnwindSafe,
impl<L> Send for PushGuard<L>where
L: Send,
impl<L> !Sync for PushGuard<L>
impl<L> Unpin for PushGuard<L>where
L: Unpin,
impl<L> UnwindSafe for PushGuard<L>where
L: UnwindSafe,
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