Skip to main content

FunctionExt

Trait FunctionExt 

Source
pub trait FunctionExt<'lua> {
    // Required method
    fn call_async<'fut, Arg, Ret>(
        &self,
        ctx: Context<'lua>,
        args: Arg,
    ) -> Pin<Box<dyn Future<Output = Result<Ret>> + 'fut>>
       where Arg: 'fut + ToLuaMulti<'lua>,
             Ret: 'fut + FromLuaMulti<'lua>,
             'lua: 'fut;
}
Expand description

Extension trait for rlua::Function

Required Methods§

Source

fn call_async<'fut, Arg, Ret>( &self, ctx: Context<'lua>, args: Arg, ) -> Pin<Box<dyn Future<Output = Result<Ret>> + 'fut>>
where Arg: 'fut + ToLuaMulti<'lua>, Ret: 'fut + FromLuaMulti<'lua>, 'lua: 'fut,

Calls the function in an async-compliant way.

By using this on the Rust side, you can recover as a Future the potentiall Poll::Pending that might have been sent by eg. a downstream ContextExt::create_async_function

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'lua> FunctionExt<'lua> for Function<'lua>

Source§

fn call_async<'fut, Arg, Ret>( &self, ctx: Context<'lua>, args: Arg, ) -> Pin<Box<dyn Future<Output = Result<Ret>> + 'fut>>
where Arg: 'fut + ToLuaMulti<'lua>, Ret: 'fut + FromLuaMulti<'lua>, 'lua: 'fut,

Implementors§