Trait hlua::Push

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

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

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

Types that can be given to a Lua context, for example with lua.set() or as a return value of a function.

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<E>(self, lua: L) -> PushGuard<L>
where Self: Sized + Push<L, Err = E>, E: Into<Void>,

Same as push_to_lua but can only succeed and is only available if Err is Void.

Implementations on Foreign Types§

source§

impl<'a, 'lua, L, T, E> Push<L> for &'a [T]
where L: AsMutLua<'lua>, T: Clone + for<'b> Push<&'b mut L, Err = E>,

§

type Err = E

source§

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

source§

impl<'a, T, E, P> Push<&'a mut InsideCallback> for Result<T, E>
where T: Push<&'a mut InsideCallback, Err = P> + for<'b> Push<&'b mut &'a mut InsideCallback, Err = P>, E: Display,

§

type Err = P

source§

fn push_to_lua( self, lua: &'a mut InsideCallback ) -> Result<PushGuard<&'a mut InsideCallback>, (P, &'a mut InsideCallback)>

source§

impl<'lua, 's, L> Push<L> for &'s str
where L: AsMutLua<'lua>,

§

type Err = Void

source§

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

source§

impl<'lua, L> Push<L> for bool
where L: AsMutLua<'lua>,

§

type Err = Void

source§

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

source§

impl<'lua, L> Push<L> for f32
where L: AsMutLua<'lua>,

§

type Err = Void

source§

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

source§

impl<'lua, L> Push<L> for f64
where L: AsMutLua<'lua>,

§

type Err = Void

source§

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

source§

impl<'lua, L> Push<L> for i8
where L: AsMutLua<'lua>,

§

type Err = Void

source§

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

source§

impl<'lua, L> Push<L> for i16
where L: AsMutLua<'lua>,

§

type Err = Void

source§

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

source§

impl<'lua, L> Push<L> for i32
where L: AsMutLua<'lua>,

§

type Err = Void

source§

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

source§

impl<'lua, L> Push<L> for u8
where L: AsMutLua<'lua>,

§

type Err = Void

source§

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

source§

impl<'lua, L> Push<L> for u16
where L: AsMutLua<'lua>,

§

type Err = Void

source§

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

source§

impl<'lua, L> Push<L> for u32
where L: AsMutLua<'lua>,

§

type Err = Void

source§

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

source§

impl<'lua, L> Push<L> for ()
where L: AsMutLua<'lua>,

§

type Err = Void

source§

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

source§

impl<'lua, L> Push<L> for String
where L: AsMutLua<'lua>,

§

type Err = Void

source§

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

source§

impl<'lua, L, K, E> Push<L> for HashSet<K>
where L: AsMutLua<'lua>, K: for<'a, 'b> PushOne<&'a mut &'b mut L, Err = E> + Eq + Hash,

§

type Err = E

source§

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

source§

impl<'lua, L, K, V, E> Push<L> for HashMap<K, V>
where L: AsMutLua<'lua>, K: for<'a, 'b> PushOne<&'a mut &'b mut L, Err = E> + Eq + Hash, V: for<'a, 'b> PushOne<&'a mut &'b mut L, Err = E>,

§

type Err = E

source§

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

source§

impl<'lua, L, T, E> Push<L> for Option<T>
where T: Push<L, Err = E>, L: AsMutLua<'lua>,

§

type Err = E

source§

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

source§

impl<'lua, L, T, E> Push<L> for Vec<T>
where L: AsMutLua<'lua>, T: for<'a> Push<&'a mut L, Err = E>,

§

type Err = E

source§

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

source§

impl<'lua, LU, FE, OE, 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)
where LU: AsMutLua<'lua>, A: for<'a> Push<&'a mut LU, Err = FE>, (B, C, D, E, F, G, H, I, J, K, L, M): for<'a> Push<&'a mut LU, Err = OE>,

§

type Err = TuplePushError<FE, OE>

source§

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

source§

impl<'lua, LU, FE, OE, 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)
where LU: AsMutLua<'lua>, B: for<'a> Push<&'a mut LU, Err = FE>, (C, D, E, F, G, H, I, J, K, L, M): for<'a> Push<&'a mut LU, Err = OE>,

§

type Err = TuplePushError<FE, OE>

source§

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

source§

impl<'lua, LU, FE, OE, 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)
where LU: AsMutLua<'lua>, C: for<'a> Push<&'a mut LU, Err = FE>, (D, E, F, G, H, I, J, K, L, M): for<'a> Push<&'a mut LU, Err = OE>,

§

type Err = TuplePushError<FE, OE>

source§

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

source§

impl<'lua, LU, FE, OE, D, E, F, G, H, I, J, K, L, M> Push<LU> for (D, E, F, G, H, I, J, K, L, M)
where LU: AsMutLua<'lua>, D: for<'a> Push<&'a mut LU, Err = FE>, (E, F, G, H, I, J, K, L, M): for<'a> Push<&'a mut LU, Err = OE>,

§

type Err = TuplePushError<FE, OE>

source§

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

source§

impl<'lua, LU, FE, OE, E, F, G, H, I, J, K, L, M> Push<LU> for (E, F, G, H, I, J, K, L, M)
where LU: AsMutLua<'lua>, E: for<'a> Push<&'a mut LU, Err = FE>, (F, G, H, I, J, K, L, M): for<'a> Push<&'a mut LU, Err = OE>,

§

type Err = TuplePushError<FE, OE>

source§

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

source§

impl<'lua, LU, FE, OE, F, G, H, I, J, K, L, M> Push<LU> for (F, G, H, I, J, K, L, M)
where LU: AsMutLua<'lua>, F: for<'a> Push<&'a mut LU, Err = FE>, (G, H, I, J, K, L, M): for<'a> Push<&'a mut LU, Err = OE>,

§

type Err = TuplePushError<FE, OE>

source§

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

source§

impl<'lua, LU, FE, OE, G, H, I, J, K, L, M> Push<LU> for (G, H, I, J, K, L, M)
where LU: AsMutLua<'lua>, G: for<'a> Push<&'a mut LU, Err = FE>, (H, I, J, K, L, M): for<'a> Push<&'a mut LU, Err = OE>,

§

type Err = TuplePushError<FE, OE>

source§

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

source§

impl<'lua, LU, FE, OE, H, I, J, K, L, M> Push<LU> for (H, I, J, K, L, M)
where LU: AsMutLua<'lua>, H: for<'a> Push<&'a mut LU, Err = FE>, (I, J, K, L, M): for<'a> Push<&'a mut LU, Err = OE>,

§

type Err = TuplePushError<FE, OE>

source§

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

source§

impl<'lua, LU, FE, OE, I, J, K, L, M> Push<LU> for (I, J, K, L, M)
where LU: AsMutLua<'lua>, I: for<'a> Push<&'a mut LU, Err = FE>, (J, K, L, M): for<'a> Push<&'a mut LU, Err = OE>,

§

type Err = TuplePushError<FE, OE>

source§

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

source§

impl<'lua, LU, FE, OE, J, K, L, M> Push<LU> for (J, K, L, M)
where LU: AsMutLua<'lua>, J: for<'a> Push<&'a mut LU, Err = FE>, (K, L, M): for<'a> Push<&'a mut LU, Err = OE>,

§

type Err = TuplePushError<FE, OE>

source§

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

source§

impl<'lua, LU, FE, OE, K, L, M> Push<LU> for (K, L, M)
where LU: AsMutLua<'lua>, K: for<'a> Push<&'a mut LU, Err = FE>, (L, M): for<'a> Push<&'a mut LU, Err = OE>,

§

type Err = TuplePushError<FE, OE>

source§

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

source§

impl<'lua, LU, FE, OE, L, M> Push<LU> for (L, M)
where LU: AsMutLua<'lua>, L: for<'a> Push<&'a mut LU, Err = FE>, (M,): for<'a> Push<&'a mut LU, Err = OE>,

§

type Err = TuplePushError<FE, OE>

source§

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

source§

impl<'lua, LU, M> Push<LU> for (M,)
where LU: AsMutLua<'lua>, M: Push<LU>,

§

type Err = <M as Push<LU>>::Err

source§

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

Implementors§

source§

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

source§

impl<'lua, L> Push<L> for AnyHashableLuaValue
where L: AsMutLua<'lua>,

§

type Err = Void

source§

impl<'lua, L> Push<L> for AnyLuaValue
where L: AsMutLua<'lua>,

§

type Err = Void

source§

impl<'lua, L> Push<L> for AnyLuaString
where L: AsMutLua<'lua>,

§

type Err = Void

source§

impl<'lua, L, R> Push<L> for LuaCodeFromReader<R>
where L: AsMutLua<'lua>, R: Read,

source§

impl<'lua, L, Z, R> Push<L> for Function<Z, (), R>
where L: AsMutLua<'lua>, Z: 'lua + FnMut() -> R, R: for<'a> Push<&'a mut InsideCallback> + 'static,

§

type Err = Void

source§

impl<'lua, L, Z, R, A: 'static> Push<L> for Function<Z, (A,), R>
where L: AsMutLua<'lua>, Z: 'lua + FnMut(A) -> R, (A,): for<'p> LuaRead<&'p mut InsideCallback>, R: for<'a> Push<&'a mut InsideCallback> + 'static,

§

type Err = Void

source§

impl<'lua, L, Z, R, A: 'static, B: 'static> Push<L> for Function<Z, (A, B), R>
where L: AsMutLua<'lua>, Z: 'lua + FnMut(A, B) -> R, (A, B): for<'p> LuaRead<&'p mut InsideCallback>, R: for<'a> Push<&'a mut InsideCallback> + 'static,

§

type Err = Void

source§

impl<'lua, L, Z, R, A: 'static, B: 'static, C: 'static> Push<L> for Function<Z, (A, B, C), R>
where L: AsMutLua<'lua>, Z: 'lua + FnMut(A, B, C) -> R, (A, B, C): for<'p> LuaRead<&'p mut InsideCallback>, R: for<'a> Push<&'a mut InsideCallback> + 'static,

§

type Err = Void

source§

impl<'lua, L, Z, R, A: 'static, B: 'static, C: 'static, D: 'static> Push<L> for Function<Z, (A, B, C, D), R>
where L: AsMutLua<'lua>, Z: 'lua + FnMut(A, B, C, D) -> R, (A, B, C, D): for<'p> LuaRead<&'p mut InsideCallback>, R: for<'a> Push<&'a mut InsideCallback> + 'static,

§

type Err = Void

source§

impl<'lua, L, Z, R, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static> Push<L> for Function<Z, (A, B, C, D, E), R>
where L: AsMutLua<'lua>, Z: 'lua + FnMut(A, B, C, D, E) -> R, (A, B, C, D, E): for<'p> LuaRead<&'p mut InsideCallback>, R: for<'a> Push<&'a mut InsideCallback> + 'static,

§

type Err = Void

source§

impl<'lua, L, Z, R, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static> Push<L> for Function<Z, (A, B, C, D, E, F), R>
where L: AsMutLua<'lua>, Z: 'lua + FnMut(A, B, C, D, E, F) -> R, (A, B, C, D, E, F): for<'p> LuaRead<&'p mut InsideCallback>, R: for<'a> Push<&'a mut InsideCallback> + 'static,

§

type Err = Void

source§

impl<'lua, L, Z, R, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static, G: 'static> Push<L> for Function<Z, (A, B, C, D, E, F, G), R>
where L: AsMutLua<'lua>, Z: 'lua + FnMut(A, B, C, D, E, F, G) -> R, (A, B, C, D, E, F, G): for<'p> LuaRead<&'p mut InsideCallback>, R: for<'a> Push<&'a mut InsideCallback> + 'static,

§

type Err = Void

source§

impl<'lua, L, Z, R, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static, G: 'static, H: 'static> Push<L> for Function<Z, (A, B, C, D, E, F, G, H), R>
where L: AsMutLua<'lua>, Z: 'lua + FnMut(A, B, C, D, E, F, G, H) -> R, (A, B, C, D, E, F, G, H): for<'p> LuaRead<&'p mut InsideCallback>, R: for<'a> Push<&'a mut InsideCallback> + 'static,

§

type Err = Void

source§

impl<'lua, L, Z, R, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static, G: 'static, H: 'static, I: 'static> Push<L> for Function<Z, (A, B, C, D, E, F, G, H, I), R>
where L: AsMutLua<'lua>, Z: 'lua + FnMut(A, B, C, D, E, F, G, H, I) -> R, (A, B, C, D, E, F, G, H, I): for<'p> LuaRead<&'p mut InsideCallback>, R: for<'a> Push<&'a mut InsideCallback> + 'static,

§

type Err = Void

source§

impl<'lua, L, Z, R, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static, G: 'static, H: 'static, I: 'static, J: 'static> Push<L> for Function<Z, (A, B, C, D, E, F, G, H, I, J), R>
where L: AsMutLua<'lua>, Z: 'lua + FnMut(A, B, C, D, E, F, G, H, I, J) -> R, (A, B, C, D, E, F, G, H, I, J): for<'p> LuaRead<&'p mut InsideCallback>, R: for<'a> Push<&'a mut InsideCallback> + 'static,

§

type Err = Void