pub struct PushGuard<L> where
L: AsLua, { /* 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
sourceimpl<L: AsLua> PushGuard<L>
impl<L: AsLua> PushGuard<L>
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.
Safety
There must be at least size elements on the lua stack and it must be
safe to drop them at the same time with this PushGuard.
pub fn assert_one_and_forget(self) -> i32
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.
Safety
The values on the stack will not be popped automatically, so the caller must ensure nothing is leaked.
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
sourceimpl<L> AsLua for PushGuard<L> where
L: AsLua,
impl<L> AsLua for PushGuard<L> where
L: AsLua,
fn as_lua(&self) -> *mut lua_State
sourcefn try_push<T>(
self,
v: T
) -> Result<PushGuard<Self>, (<T as PushInto<Self>>::Err, Self)> where
Self: Sized,
T: PushInto<Self>,
fn try_push<T>(
self,
v: T
) -> Result<PushGuard<Self>, (<T as PushInto<Self>>::Err, Self)> where
Self: Sized,
T: PushInto<Self>,
Try to push v onto the lua stack. Read more
sourcefn push<T>(self, v: T) -> PushGuard<Self> where
Self: Sized,
T: PushInto<Self>,
<T as PushInto<Self>>::Err: Into<Void>,
fn push<T>(self, v: T) -> PushGuard<Self> where
Self: Sized,
T: PushInto<Self>,
<T as PushInto<Self>>::Err: Into<Void>,
Push v onto the lua stack. Read more
sourcefn try_push_one<T>(
self,
v: T
) -> Result<PushGuard<Self>, (<T as PushInto<Self>>::Err, Self)> where
Self: Sized,
T: PushOneInto<Self>,
fn try_push_one<T>(
self,
v: T
) -> Result<PushGuard<Self>, (<T as PushInto<Self>>::Err, Self)> where
Self: Sized,
T: PushOneInto<Self>,
Try to push v onto the lua stack. Read more
sourcefn push_one<T>(self, v: T) -> PushGuard<Self> where
Self: Sized,
T: PushOneInto<Self>,
<T as PushInto<Self>>::Err: Into<Void>,
fn push_one<T>(self, v: T) -> PushGuard<Self> where
Self: Sized,
T: PushOneInto<Self>,
<T as PushInto<Self>>::Err: Into<Void>,
Push v onto the lua stack. Read more
sourcefn push_iter<I>(self, iterator: I) -> Result<PushGuard<Self>, Self> where
Self: Sized,
I: Iterator,
<I as Iterator>::Item: PushInto<LuaState>,
<<I as Iterator>::Item as PushInto<LuaState>>::Err: Into<Void>,
fn push_iter<I>(self, iterator: I) -> Result<PushGuard<Self>, Self> where
Self: Sized,
I: Iterator,
<I as Iterator>::Item: PushInto<LuaState>,
<<I as Iterator>::Item as PushInto<LuaState>>::Err: Into<Void>,
Push iterator onto the lua stack as a lua table. Read more
sourcefn try_push_iter<I>(
self,
iterator: I
) -> Result<PushGuard<Self>, (PushIterErrorOf<I>, Self)> where
Self: Sized,
I: Iterator,
<I as Iterator>::Item: PushInto<LuaState>,
fn try_push_iter<I>(
self,
iterator: I
) -> Result<PushGuard<Self>, (PushIterErrorOf<I>, Self)> where
Self: Sized,
I: Iterator,
<I as Iterator>::Item: PushInto<LuaState>,
Push iterator onto the lua stack as a lua table. Read more
fn read<T>(self) -> Result<T, Self> where
Self: Sized,
T: LuaRead<Self>,
fn read_at<T>(self, index: i32) -> Result<T, Self> where
Self: Sized,
T: LuaRead<Self>,
fn read_at_nz<T>(self, index: NonZeroI32) -> Result<T, Self> where
Self: Sized,
T: LuaRead<Self>,
Auto Trait Implementations
impl<L> RefUnwindSafe for PushGuard<L> where
L: RefUnwindSafe,
impl<L> Send for PushGuard<L> where
L: Send,
impl<L> Sync for PushGuard<L> where
L: Sync,
impl<L> Unpin for PushGuard<L> where
L: Unpin,
impl<L> UnwindSafe for PushGuard<L> where
L: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more