pub trait TableExt<'lua>: Sealed {
// Required methods
fn call<A, R>(&self, args: A) -> Result<R>
where A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua>;
fn call_async<A, R>(&self, args: A) -> LocalBoxFuture<'lua, Result<R>>
where A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua> + 'lua;
fn call_method<A, R>(&self, name: &str, args: A) -> Result<R>
where A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua>;
fn call_function<A, R>(&self, name: &str, args: A) -> Result<R>
where A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua>;
fn call_async_method<A, R>(
&self,
name: &str,
args: A
) -> LocalBoxFuture<'lua, Result<R>>
where A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua> + 'lua;
fn call_async_function<A, R>(
&self,
name: &str,
args: A
) -> LocalBoxFuture<'lua, Result<R>>
where A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua> + 'lua;
}
Expand description
An extension trait for Table
s that provides a variety of convenient functionality.
Required Methods§
sourcefn call<A, R>(&self, args: A) -> Result<R>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua>,
fn call<A, R>(&self, args: A) -> Result<R>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua>,
Calls the table as function assuming it has __call
metamethod.
The metamethod is called with the table as its first argument, followed by the passed arguments.
sourcefn call_async<A, R>(&self, args: A) -> LocalBoxFuture<'lua, Result<R>>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua> + 'lua,
Available on crate feature async
only.
fn call_async<A, R>(&self, args: A) -> LocalBoxFuture<'lua, Result<R>>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua> + 'lua,
async
only.Asynchronously calls the table as function assuming it has __call
metamethod.
The metamethod is called with the table as its first argument, followed by the passed arguments.
sourcefn call_method<A, R>(&self, name: &str, args: A) -> Result<R>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua>,
fn call_method<A, R>(&self, name: &str, args: A) -> Result<R>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua>,
Gets the function associated to key
from the table and executes it,
passing the table itself along with args
as function arguments.
This is a shortcut for
table.get::<_, Function>(key)?.call((table.clone(), arg1, ..., argN))
This might invoke the __index
metamethod.
sourcefn call_function<A, R>(&self, name: &str, args: A) -> Result<R>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua>,
fn call_function<A, R>(&self, name: &str, args: A) -> Result<R>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua>,
Gets the function associated to key
from the table and executes it,
passing args
as function arguments.
This is a shortcut for
table.get::<_, Function>(key)?.call(args)
This might invoke the __index
metamethod.
sourcefn call_async_method<A, R>(
&self,
name: &str,
args: A
) -> LocalBoxFuture<'lua, Result<R>>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua> + 'lua,
Available on crate feature async
only.
fn call_async_method<A, R>(
&self,
name: &str,
args: A
) -> LocalBoxFuture<'lua, Result<R>>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua> + 'lua,
async
only.Gets the function associated to key
from the table and asynchronously executes it,
passing the table itself along with args
as function arguments and returning Future.
Requires feature = "async"
This might invoke the __index
metamethod.
sourcefn call_async_function<A, R>(
&self,
name: &str,
args: A
) -> LocalBoxFuture<'lua, Result<R>>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua> + 'lua,
Available on crate feature async
only.
fn call_async_function<A, R>(
&self,
name: &str,
args: A
) -> LocalBoxFuture<'lua, Result<R>>where
A: IntoLuaMulti<'lua>,
R: FromLuaMulti<'lua> + 'lua,
async
only.Gets the function associated to key
from the table and asynchronously executes it,
passing args
as function arguments and returning Future.
Requires feature = "async"
This might invoke the __index
metamethod.