Struct hlua::PushGuard

source ·
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>,

source

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.

source

pub fn size(&self) -> i32

Returns the number of elements managed by this PushGuard.

source

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.

source

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>,

source§

impl<'lua, L> AsMutLua<'lua> for PushGuard<L>
where L: AsMutLua<'lua>,

source§

fn as_mut_lua(&mut self) -> LuaContext

Returns the raw Lua context.
source§

impl<L: Debug> Debug for PushGuard<L>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<L> Drop for PushGuard<L>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.