From 6f7be8c3352748992189a1157058c706f88ae295 Mon Sep 17 00:00:00 2001 From: replcat Date: Sat, 26 Oct 2024 13:46:16 +1100 Subject: [PATCH 1/2] deps: update `mlua` to `0.10` --- Cargo.toml | 4 ++-- examples/mlua.rs | 2 +- src/lib.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2669d003..496564e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,12 +58,12 @@ libuv = { workspace = true, optional = true } luajit = { workspace = true } macros = { workspace = true, features = ["plugin"] } miniserde = { version = "0.1", optional = true } -mlua = { version = "0.9", features = ["luajit"], optional = true } +mlua = { version = "0.10", features = ["luajit"], optional = true } thiserror = { workspace = true } types = { workspace = true, features = ["serde"] } [dev-dependencies] -mlua = { version = "0.9", features = ["luajit", "module"] } +mlua = { version = "0.10", features = ["luajit", "module"] } serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.0", features = ["full"] } diff --git a/examples/mlua.rs b/examples/mlua.rs index caf389b3..43457241 100644 --- a/examples/mlua.rs +++ b/examples/mlua.rs @@ -5,7 +5,7 @@ use nvim_oxi::{mlua::lua, print, Result}; fn mlua() -> Result<()> { print!("Hello from nvim-oxi.."); let lua = lua(); - let print = lua.globals().get::<_, LuaFunction>("print")?; + let print: LuaFunction = lua.globals().get("print")?; print.call("..and goodbye from mlua!")?; Ok(()) } diff --git a/src/lib.rs b/src/lib.rs index 6bfa36e1..ed4b7577 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -73,10 +73,10 @@ pub mod mlua { /// Ok(()) /// } /// ``` - pub fn lua() -> &'static mlua::Lua { + pub fn lua() -> mlua::Lua { unsafe { luajit::with_state(|lua_state| { - mlua::Lua::init_from_ptr(lua_state as *mut _).into_static() + mlua::Lua::init_from_ptr(lua_state as *mut _) }) } } From 0e3be1803629ccf787f81110c4a46813c34b5b68 Mon Sep 17 00:00:00 2001 From: Riccardo Mazzarini Date: Fri, 1 Nov 2024 09:33:58 +0800 Subject: [PATCH 2/2] chore: fix `mlua::lua()`'s docs --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ed4b7577..dd2cfacf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,9 +52,9 @@ pub mod mlua { pub use mlua::*; - /// Returns a static reference to a - /// [`mlua::Lua`](https://docs.rs/mlua/latest/mlua/struct.Lua.html) object - /// which can be used to interact with Lua plugins. + /// Returns a + /// [`mlua::Lua`](https://docs.rs/mlua/latest/mlua/struct.Lua.html) + /// instance which can be used to interact with Lua plugins. /// /// # Examples ///