Trait ScopeExt

Source
pub trait ScopeExt<'lua, 'scope> {
    // Required methods
    fn create_async_function<Arg, Ret, RetFut, F>(
        &self,
        ctx: Context<'lua>,
        func: F,
    ) -> Result<Function<'lua>>
       where Arg: 'scope + for<'all> FromLuaMulti<'all>,
             Ret: 'scope + for<'all> ToLuaMulti<'all>,
             RetFut: 'scope + Future<Output = Result<Ret>>,
             F: 'scope + for<'all> Fn(Context<'all>, Arg) -> RetFut;
    fn create_async_function_mut<Arg, Ret, RetFut, F>(
        &self,
        ctx: Context<'lua>,
        func: F,
    ) -> Result<Function<'lua>>
       where Arg: 'scope + for<'all> FromLuaMulti<'all>,
             Ret: 'scope + for<'all> ToLuaMulti<'all>,
             RetFut: 'scope + Future<Output = Result<Ret>>,
             F: 'scope + for<'all> FnMut(Context<'all>, Arg) -> RetFut;
}
Expand description

Extension trait for rlua::Scope

Required Methods§

Source

fn create_async_function<Arg, Ret, RetFut, F>( &self, ctx: Context<'lua>, func: F, ) -> Result<Function<'lua>>
where Arg: 'scope + for<'all> FromLuaMulti<'all>, Ret: 'scope + for<'all> ToLuaMulti<'all>, RetFut: 'scope + Future<Output = Result<Ret>>, F: 'scope + for<'all> Fn(Context<'all>, Arg) -> RetFut,

Wraps a Rust function or closure, creating a callable Lua function handle to it. See also rlua::Scope::create_function and ContextExt::create_async_function.

The where clause stipulates a few additional constraints compared to rlua::Scope::create_function. This is required for compiling the implementation, and should not be an issue. If it is, please report a bug to rlua-async with instructions on how to reproduce and your use case.

Source

fn create_async_function_mut<Arg, Ret, RetFut, F>( &self, ctx: Context<'lua>, func: F, ) -> Result<Function<'lua>>
where Arg: 'scope + for<'all> FromLuaMulti<'all>, Ret: 'scope + for<'all> ToLuaMulti<'all>, RetFut: 'scope + Future<Output = Result<Ret>>, F: 'scope + for<'all> FnMut(Context<'all>, Arg) -> RetFut,

Wraps a mutable Rust function or closure, creating a callable Lua function handle to it. See [rlua_async::ScopeExt::create_async_function] for more details.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'lua, 'scope> ScopeExt<'lua, 'scope> for Scope<'lua, 'scope>

Source§

fn create_async_function<Arg, Ret, RetFut, F>( &self, ctx: Context<'lua>, func: F, ) -> Result<Function<'lua>>
where Arg: 'scope + for<'all> FromLuaMulti<'all>, Ret: 'scope + for<'all> ToLuaMulti<'all>, RetFut: 'scope + Future<Output = Result<Ret>>, F: 'scope + for<'all> Fn(Context<'all>, Arg) -> RetFut,

Source§

fn create_async_function_mut<Arg, Ret, RetFut, F>( &self, ctx: Context<'lua>, func: F, ) -> Result<Function<'lua>>
where Arg: 'scope + for<'all> FromLuaMulti<'all>, Ret: 'scope + for<'all> ToLuaMulti<'all>, RetFut: 'scope + Future<Output = Result<Ret>>, F: 'scope + for<'all> FnMut(Context<'all>, Arg) -> RetFut,

Implementors§