Struct mlua::Variadic [−][src]
pub struct Variadic<T>(_);
Expand description
Wraps a variable number of T
s.
Can be used to work with variadic functions more easily. Using this type as the last argument of
a Rust callback will accept any number of arguments from Lua and convert them to the type T
using FromLua
. Variadic<T>
can also be returned from a callback, returning a variable
number of values to Lua.
The MultiValue
type is equivalent to Variadic<Value>
.
Examples
let add = lua.create_function(|_, vals: Variadic<f64>| -> Result<f64> { Ok(vals.iter().sum()) })?; lua.globals().set("add", add)?; assert_eq!(lua.load("add(3, 2, 5)").eval::<f32>()?, 10.0);
Implementations
Trait Implementations
Creates a value from an iterator. Read more
Performs the conversion. Read more
Performs the conversion.
Auto Trait Implementations
impl<T> RefUnwindSafe for Variadic<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Variadic<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more