Closed
Description
This code, when added as test to lua_tables.rs
, fails to compile:
#[test]
fn accepting_luatable_as_fn_arg_works() {
let mut lua = Lua::new();
let foo = {
move |config: LuaTable<_>| for (k, v) in
config.iter::<String, String>().filter_map(|e| e)
{
println!("{} => {}", k, v);
}
};
lua.set("foo", ::function1(foo));
}
with this error:
Compiling hlua v0.3.1 (file:///home/mkpankov/workspace/projects/hlua/hlua)
error[E0277]: the trait bound `for<'p> lua_tables::LuaTable<_>: LuaRead<&'p mut functions_write::InsideCallback>` is not satisfied
--> src/lua_tables.rs:668:13
|
668 | lua.set("foo", ::function1(foo));
| ^^^ the trait `for<'p> LuaRead<&'p mut functions_write::InsideCallback>` is not implemented for `lua_tables::LuaTable<_>`
|
= help: the following implementations were found:
<lua_tables::LuaTable<L> as LuaRead<L>>
= note: required because of the requirements on the impl of `for<'p> LuaRead<&'p mut functions_write::InsideCallback>` for `(lua_tables::LuaTable<_>,)`
= note: required because of the requirements on the impl of `for<'a> PushOne<&'a mut Lua<'_>>` for `functions_write::Function<[closure@src/lua_tables.rs:662:13: 666:14], (lua_tables::LuaTable<_>,), ()>`
Is it possible at all?
Metadata
Metadata
Assignees
Labels
No labels