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§
Required Methods§
sourcefn push_to_lua(self, lua: L) -> Result<PushGuard<L>, (Self::Err, L)>
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
.