Skip to content

Commit

Permalink
refactor(rusile): Use new anyhow feature to wrap original function
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Oct 10, 2024
1 parent 8dcccca commit 086c5f5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ lto = true

[workspace.dependencies.mlua]
version = "0.10.0-rc.1"
features = [ "anyhow" ]

[dependencies.anyhow]
version = "1.0"
Expand Down
7 changes: 1 addition & 6 deletions rusile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ use sile::rusile_demo;
#[mlua::lua_module]
fn rusile(lua: &Lua) -> LuaResult<LuaTable> {
let exports = lua.create_table().unwrap();
let demo: LuaFunction = lua.create_function(demo).unwrap();
let demo = LuaFunction::wrap_raw(rusile_demo);
exports.set("demo", demo)?;
Ok(exports)
}

fn demo(lua: &Lua, (): ()) -> LuaResult<LuaString> {
let res = rusile_demo().unwrap();
lua.create_string(res)
}

0 comments on commit 086c5f5

Please sign in to comment.