Trait tlua::Push

source ·
pub trait Push<L: AsLua> {
    type Err;

    // Required method
    fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Self::Err, L)>;

    // Provided method
    fn push_no_err(&self, lua: L) -> PushGuard<L>
       where <Self as Push<L>>::Err: Into<Void> { ... }
}
Expand description

Types implementing this trait can be pushed onto the Lua stack by reference.

Required Associated Types§

source

type Err

Error that can happen when pushing a value.

Required Methods§

source

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Self::Err, L)>

Pushes the value on the top of the stack.

Must return a guard representing the elements that have been pushed.

You can implement this for any type you want by redirecting to call to another implementation (for example 5.push_to_lua) or by calling userdata::push_userdata.

Provided Methods§

source

fn push_no_err(&self, lua: L) -> PushGuard<L>
where <Self as Push<L>>::Err: Into<Void>,

Same as push_to_lua but can only succeed and is only available if Err implements Into<Void>.

Implementations on Foreign Types§

source§

impl<L> Push<L> for bool
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for f32
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for f64
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for i8
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for i16
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for i32
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for i64
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for isize
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for str
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for u8
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for u16
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for u32
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for u64
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for ()
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for usize
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for CString
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for String
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L> Push<L> for CStr
where L: AsLua,

§

type Err = Void

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Void, L)>

source§

impl<L, K> Push<L> for HashSet<K>
where L: AsLua, K: PushOne<LuaState> + Eq + Hash + Debug,

§

type Err = <K as Push<*mut lua_State>>::Err

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (K::Err, L)>

source§

impl<L, K, V> Push<L> for HashMap<K, V>
where L: AsLua, K: PushOne<LuaState> + Eq + Hash + Debug, V: PushOne<LuaState> + Debug,

§

type Err = TuplePushError<<K as Push<*mut lua_State>>::Err, <V as Push<*mut lua_State>>::Err>

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Self::Err, L)>

source§

impl<L, T> Push<L> for Option<T>
where T: Push<L>, L: AsLua,

§

type Err = <T as Push<L>>::Err

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Self::Err, L)>

source§

impl<L, T> Push<L> for [T]
where L: AsLua, T: Push<LuaState>,

[T]

§

type Err = PushIterError<<T as Push<*mut lua_State>>::Err>

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Self::Err, L)>

source§

impl<L, T> Push<L> for Vec<T>
where L: AsLua, T: Push<LuaState>,

Vec

§

type Err = PushIterError<<T as Push<*mut lua_State>>::Err>

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Self::Err, L)>

source§

impl<L, T, const N: usize> Push<L> for [T; N]
where L: AsLua, T: Push<LuaState>,

[T; N]

§

type Err = PushIterError<<T as Push<*mut lua_State>>::Err>

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Self::Err, L)>

source§

impl<LU, A, B, C, D, E, F, G, H, I, J, K, L, M> Push<LU> for (A, B, C, D, E, F, G, H, I, J, K, L, M)

source§

impl<LU, B, C, D, E, F, G, H, I, J, K, L, M> Push<LU> for (B, C, D, E, F, G, H, I, J, K, L, M)

source§

impl<LU, C, D, E, F, G, H, I, J, K, L, M> Push<LU> for (C, D, E, F, G, H, I, J, K, L, M)

source§

impl<LU, D, E, F, G, H, I, J, K, L, M> Push<LU> for (D, E, F, G, H, I, J, K, L, M)

source§

impl<LU, E, F, G, H, I, J, K, L, M> Push<LU> for (E, F, G, H, I, J, K, L, M)

source§

impl<LU, F, G, H, I, J, K, L, M> Push<LU> for (F, G, H, I, J, K, L, M)

source§

impl<LU, G, H, I, J, K, L, M> Push<LU> for (G, H, I, J, K, L, M)
where LU: AsLua, G: Push<LuaState>, H: Push<LuaState>, I: Push<LuaState>, J: Push<LuaState>, K: Push<LuaState>, L: Push<LuaState>, M: Push<LuaState>,

source§

impl<LU, H, I, J, K, L, M> Push<LU> for (H, I, J, K, L, M)
where LU: AsLua, H: Push<LuaState>, I: Push<LuaState>, J: Push<LuaState>, K: Push<LuaState>, L: Push<LuaState>, M: Push<LuaState>,

§

type Err = TuplePushError<<H as Push<*mut lua_State>>::Err, <(I, J, K, L, M) as Push<*mut lua_State>>::Err>

source§

fn push_to_lua(&self, lua: LU) -> Result<PushGuard<LU>, (Self::Err, LU)>

source§

impl<LU, I, J, K, L, M> Push<LU> for (I, J, K, L, M)
where LU: AsLua, I: Push<LuaState>, J: Push<LuaState>, K: Push<LuaState>, L: Push<LuaState>, M: Push<LuaState>,

§

type Err = TuplePushError<<I as Push<*mut lua_State>>::Err, <(J, K, L, M) as Push<*mut lua_State>>::Err>

source§

fn push_to_lua(&self, lua: LU) -> Result<PushGuard<LU>, (Self::Err, LU)>

source§

impl<LU, J, K, L, M> Push<LU> for (J, K, L, M)
where LU: AsLua, J: Push<LuaState>, K: Push<LuaState>, L: Push<LuaState>, M: Push<LuaState>,

§

type Err = TuplePushError<<J as Push<*mut lua_State>>::Err, <(K, L, M) as Push<*mut lua_State>>::Err>

source§

fn push_to_lua(&self, lua: LU) -> Result<PushGuard<LU>, (Self::Err, LU)>

source§

impl<LU, K, L, M> Push<LU> for (K, L, M)
where LU: AsLua, K: Push<LuaState>, L: Push<LuaState>, M: Push<LuaState>,

§

type Err = TuplePushError<<K as Push<*mut lua_State>>::Err, <(L, M) as Push<*mut lua_State>>::Err>

source§

fn push_to_lua(&self, lua: LU) -> Result<PushGuard<LU>, (Self::Err, LU)>

source§

impl<LU, L, M> Push<LU> for (L, M)
where LU: AsLua, L: Push<LuaState>, M: Push<LuaState>,

§

type Err = TuplePushError<<L as Push<*mut lua_State>>::Err, <(M,) as Push<*mut lua_State>>::Err>

source§

fn push_to_lua(&self, lua: LU) -> Result<PushGuard<LU>, (Self::Err, LU)>

source§

impl<LU, M> Push<LU> for (M,)
where LU: AsLua, M: Push<LU>,

§

type Err = TuplePushError<<M as Push<LU>>::Err, Void>

source§

fn push_to_lua(&self, lua: LU) -> Result<PushGuard<LU>, (Self::Err, LU)>

source§

impl<T, L> Push<L> for &T
where L: AsLua, T: ?Sized + Push<L>,

§

type Err = <T as Push<L>>::Err

source§

fn push_to_lua(&self, lua: L) -> Result<PushGuard<L>, (Self::Err, L)>

Implementors§

source§

impl<'c, L> Push<L> for LuaCode<'c>
where L: AsLua,

source§

impl<L> Push<L> for AnyLuaString
where L: AsLua,

§

type Err = Void

source§

impl<L> Push<L> for False
where L: AsLua,

§

type Err = Void

source§

impl<L> Push<L> for Nil
where L: AsLua,

§

type Err = Void

source§

impl<L> Push<L> for Null
where L: AsLua,

§

type Err = Void

source§

impl<L> Push<L> for True
where L: AsLua,

§

type Err = Void

source§

impl<L, K> Push<L> for Object<K>
where L: AsLua, K: AsLua,

§

type Err = Void

source§

impl<L, O> Push<L> for CDataOnStack<'_, O>
where L: AsLua, O: AsLua,

§

type Err = Void

source§

impl<L, T> Push<L> for Callable<T>
where L: AsLua, T: AsLua,

§

type Err = Void

source§

impl<L, T> Push<L> for Indexable<T>
where L: AsLua, T: AsLua,

§

type Err = Void

source§

impl<L, T> Push<L> for IndexableRW<T>
where L: AsLua, T: AsLua,

§

type Err = Void

source§

impl<L, T> Push<L> for LuaFunction<T>
where L: AsLua, T: AsLua,

§

type Err = Void

source§

impl<L, T> Push<L> for LuaTable<T>
where L: AsLua, T: AsLua,

§

type Err = Void

source§

impl<L, Z, R> Push<L> for Function<Z, (), R>
where L: AsLua, Z: FnMut() -> R, Self: Copy + 'static, (): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L, Z, R, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static, G: 'static, H: 'static, I: 'static, J: 'static, K: 'static, M: 'static, N: 'static> Push<L> for Function<Z, (A, B, C, D, E, F, G, H, I, J, K, M, N), R>
where L: AsLua, Z: FnMut(A, B, C, D, E, F, G, H, I, J, K, M, N) -> R, Self: Copy + 'static, (A, B, C, D, E, F, G, H, I, J, K, M, N): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L, Z, R, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static, G: 'static, H: 'static, I: 'static, J: 'static, K: 'static, M: 'static, N: 'static> Push<L> for Function<Z, (B, C, D, E, F, G, H, I, J, K, M, N), R>
where L: AsLua, Z: FnMut(B, C, D, E, F, G, H, I, J, K, M, N) -> R, Self: Copy + 'static, (B, C, D, E, F, G, H, I, J, K, M, N): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L, Z, R, C: 'static, D: 'static, E: 'static, F: 'static, G: 'static, H: 'static, I: 'static, J: 'static, K: 'static, M: 'static, N: 'static> Push<L> for Function<Z, (C, D, E, F, G, H, I, J, K, M, N), R>
where L: AsLua, Z: FnMut(C, D, E, F, G, H, I, J, K, M, N) -> R, Self: Copy + 'static, (C, D, E, F, G, H, I, J, K, M, N): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L, Z, R, D: 'static, E: 'static, F: 'static, G: 'static, H: 'static, I: 'static, J: 'static, K: 'static, M: 'static, N: 'static> Push<L> for Function<Z, (D, E, F, G, H, I, J, K, M, N), R>
where L: AsLua, Z: FnMut(D, E, F, G, H, I, J, K, M, N) -> R, Self: Copy + 'static, (D, E, F, G, H, I, J, K, M, N): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L, Z, R, E: 'static, F: 'static, G: 'static, H: 'static, I: 'static, J: 'static, K: 'static, M: 'static, N: 'static> Push<L> for Function<Z, (E, F, G, H, I, J, K, M, N), R>
where L: AsLua, Z: FnMut(E, F, G, H, I, J, K, M, N) -> R, Self: Copy + 'static, (E, F, G, H, I, J, K, M, N): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L, Z, R, F: 'static, G: 'static, H: 'static, I: 'static, J: 'static, K: 'static, M: 'static, N: 'static> Push<L> for Function<Z, (F, G, H, I, J, K, M, N), R>
where L: AsLua, Z: FnMut(F, G, H, I, J, K, M, N) -> R, Self: Copy + 'static, (F, G, H, I, J, K, M, N): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L, Z, R, G: 'static, H: 'static, I: 'static, J: 'static, K: 'static, M: 'static, N: 'static> Push<L> for Function<Z, (G, H, I, J, K, M, N), R>
where L: AsLua, Z: FnMut(G, H, I, J, K, M, N) -> R, Self: Copy + 'static, (G, H, I, J, K, M, N): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L, Z, R, H: 'static, I: 'static, J: 'static, K: 'static, M: 'static, N: 'static> Push<L> for Function<Z, (H, I, J, K, M, N), R>
where L: AsLua, Z: FnMut(H, I, J, K, M, N) -> R, Self: Copy + 'static, (H, I, J, K, M, N): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L, Z, R, I: 'static, J: 'static, K: 'static, M: 'static, N: 'static> Push<L> for Function<Z, (I, J, K, M, N), R>
where L: AsLua, Z: FnMut(I, J, K, M, N) -> R, Self: Copy + 'static, (I, J, K, M, N): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L, Z, R, J: 'static, K: 'static, M: 'static, N: 'static> Push<L> for Function<Z, (J, K, M, N), R>
where L: AsLua, Z: FnMut(J, K, M, N) -> R, Self: Copy + 'static, (J, K, M, N): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L, Z, R, K: 'static, M: 'static, N: 'static> Push<L> for Function<Z, (K, M, N), R>
where L: AsLua, Z: FnMut(K, M, N) -> R, Self: Copy + 'static, (K, M, N): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L, Z, R, M: 'static, N: 'static> Push<L> for Function<Z, (M, N), R>
where L: AsLua, Z: FnMut(M, N) -> R, Self: Copy + 'static, (M, N): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L, Z, R, N: 'static> Push<L> for Function<Z, (N,), R>
where L: AsLua, Z: FnMut(N) -> R, Self: Copy + 'static, (N,): for<'p> LuaRead<&'p InsideCallback>, R: PushInto<InsideCallback> + 'static,

§

type Err = Void

source§

impl<L: AsLua> Push<L> for AnyHashableLuaValue

§

type Err = Void

source§

impl<L: AsLua> Push<L> for AnyLuaValue

§

type Err = Void

source§

impl<L: AsLua> Push<L> for CFunction

§

type Err = Void

source§

impl<LU, A, B, C, D, E, F, G, H, I, J, K, L, M> Push<LU> for AsTable<(A, B, C, D, E, F, G, H, I, J, K, L, M)>

source§

impl<LU, B, C, D, E, F, G, H, I, J, K, L, M> Push<LU> for AsTable<(B, C, D, E, F, G, H, I, J, K, L, M)>

source§

impl<LU, C, D, E, F, G, H, I, J, K, L, M> Push<LU> for AsTable<(C, D, E, F, G, H, I, J, K, L, M)>

source§

impl<LU, D, E, F, G, H, I, J, K, L, M> Push<LU> for AsTable<(D, E, F, G, H, I, J, K, L, M)>

source§

impl<LU, E, F, G, H, I, J, K, L, M> Push<LU> for AsTable<(E, F, G, H, I, J, K, L, M)>

source§

impl<LU, F, G, H, I, J, K, L, M> Push<LU> for AsTable<(F, G, H, I, J, K, L, M)>

source§

impl<LU, G, H, I, J, K, L, M> Push<LU> for AsTable<(G, H, I, J, K, L, M)>
where LU: AsLua, G: Push<LuaState>, H: Push<LuaState>, I: Push<LuaState>, J: Push<LuaState>, K: Push<LuaState>, L: Push<LuaState>, M: Push<LuaState>,

source§

impl<LU, H, I, J, K, L, M> Push<LU> for AsTable<(H, I, J, K, L, M)>
where LU: AsLua, H: Push<LuaState>, I: Push<LuaState>, J: Push<LuaState>, K: Push<LuaState>, L: Push<LuaState>, M: Push<LuaState>,

§

type Err = AsTablePushError<TuplePushError<<H as Push<*mut lua_State>>::Err, <(I, J, K, L, M) as Push<*mut lua_State>>::Err>>

source§

impl<LU, I, J, K, L, M> Push<LU> for AsTable<(I, J, K, L, M)>
where LU: AsLua, I: Push<LuaState>, J: Push<LuaState>, K: Push<LuaState>, L: Push<LuaState>, M: Push<LuaState>,

§

type Err = AsTablePushError<TuplePushError<<I as Push<*mut lua_State>>::Err, <(J, K, L, M) as Push<*mut lua_State>>::Err>>

source§

impl<LU, J, K, L, M> Push<LU> for AsTable<(J, K, L, M)>
where LU: AsLua, J: Push<LuaState>, K: Push<LuaState>, L: Push<LuaState>, M: Push<LuaState>,

§

type Err = AsTablePushError<TuplePushError<<J as Push<*mut lua_State>>::Err, <(K, L, M) as Push<*mut lua_State>>::Err>>

source§

impl<LU, K, L, M> Push<LU> for AsTable<(K, L, M)>
where LU: AsLua, K: Push<LuaState>, L: Push<LuaState>, M: Push<LuaState>,

§

type Err = AsTablePushError<TuplePushError<<K as Push<*mut lua_State>>::Err, <(L, M) as Push<*mut lua_State>>::Err>>

source§

impl<LU, L, M> Push<LU> for AsTable<(L, M)>
where LU: AsLua, L: Push<LuaState>, M: Push<LuaState>,

§

type Err = AsTablePushError<TuplePushError<<L as Push<*mut lua_State>>::Err, <(M,) as Push<*mut lua_State>>::Err>>

source§

impl<LU, M> Push<LU> for AsTable<(M,)>
where LU: AsLua, M: Push<LuaState>,

§

type Err = AsTablePushError<TuplePushError<<M as Push<*mut lua_State>>::Err, Void>>