-
Hi guys I'm having trouble getting the send safe setup working. I have the following code. async fn run_base(
input: Vec<u8>
) -> mlua::prelude::LuaResult<()>{
let lua = Lua::new_with(StdLib::TABLE | StdLib::STRING | StdLib::MATH, LuaOptions::new())?;
let map_table = lua.create_table()?;
map_table.set(1, "one")?;
map_table.set("two", 2)?;
lua.globals().set("map_table", map_table)?;
lua.load(input).exec_async().await?;
Ok(())
}
fn run_lua(
input: Vec<u8>
) -> Pin<Box<impl Future<Output = mlua::prelude::LuaResult<()>> + Send>>{
Box::pin(async move{
run_base(input)
})
} and this is what I have in cargo
And I'm getting the following errors
The only other possible option I've seen was to use threads and that can get expensive. If someone can help me out I would appreciate it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Maybe if you tell what you want to achieve I can suggest an alternative solution. Eg. in tokio you can spawn non-Send futures usuing |
Beta Was this translation helpful? Give feedback.
An example of using channels