pub trait ContextExt<'lua> {
    fn create_async_function<Arg, Ret, RetFut, F>(
        self,
        func: F
    ) -> Result<Function<'lua>>
    where
        Arg: FromLuaMulti<'lua>,
        Ret: ToLuaMulti<'lua>,
        RetFut: 'static + Send + Future<Output = Result<Ret>>,
        F: 'static + Send + Fn(Context<'lua>, Arg) -> RetFut
;
fn create_async_function_mut<Arg, Ret, RetFut, F>(
        self,
        func: F
    ) -> Result<Function<'lua>>
    where
        Arg: FromLuaMulti<'lua>,
        Ret: ToLuaMulti<'lua>,
        RetFut: 'static + Send + Future<Output = Result<Ret>>,
        F: 'static + Send + FnMut(Context<'lua>, Arg) -> RetFut
; }
Expand description

Extension trait for rlua::Context

Required methods

Create an asynchronous function.

This works exactly like Context::create_function, except that the function returns a Future instead of just the result. Note that when this function is being called from Lua, it will generate a coroutine, that will prevent any use of coroutines in the said Lua code and is designed to be called from an async-compliant caller such as FunctionExt::call_async

Implementations on Foreign Types

Implementors