1
0
Fork 0

Fix(lua): Upgrade to mlua 9.1, which introduced braking changes

This commit is contained in:
Benedikt Peetz 2023-09-09 19:44:00 +02:00
parent eb63cb6247
commit 42b8793dd0
Signed by: bpeetz
GPG Key ID: A5E94010C3A642AD
3 changed files with 40 additions and 11 deletions

45
Cargo.lock generated
View File

@ -316,11 +316,12 @@ dependencies = [
[[package]]
name = "bstr"
version = "0.2.17"
version = "1.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a"
dependencies = [
"memchr",
"serde",
]
[[package]]
@ -1615,21 +1616,30 @@ dependencies = [
[[package]]
name = "mlua"
version = "0.8.10"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bb37b0ba91f017aa7ca2b98ef99496827770cd635b4a932a6047c5b4bbe678e"
checksum = "6c3a7a7ff4481ec91b951a733390211a8ace1caba57266ccb5f4d4966704e560"
dependencies = [
"bstr",
"cc",
"erased-serde",
"futures-core",
"futures-task",
"futures-util",
"mlua-sys",
"num-traits",
"once_cell",
"pkg-config",
"rustc-hash",
"serde",
"serde-value",
]
[[package]]
name = "mlua-sys"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ec8b54eddb76093069cce9eeffb4c7b3a1a0fe66962d7bd44c4867928149ca3"
dependencies = [
"cc",
"cfg-if",
"pkg-config",
]
[[package]]
@ -1734,6 +1744,15 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "ordered-float"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87"
dependencies = [
"num-traits",
]
[[package]]
name = "parking_lot"
version = "0.11.2"
@ -2268,6 +2287,16 @@ dependencies = [
"serde_derive",
]
[[package]]
name = "serde-value"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c"
dependencies = [
"ordered-float",
"serde",
]
[[package]]
name = "serde_bytes"
version = "0.11.12"

View File

@ -19,7 +19,7 @@ tokio = { version = "1.32", features = ["macros", "rt-multi-thread"] }
# lua stuff
language_macros = { path = "./language_macros" }
mlua = { version = "0.8.10", features = ["lua54", "async", "send", "serialize"] }
mlua = { version = "0.9.1", features = ["lua54", "async", "send", "serialize"] }
once_cell = "1.18.0"
# tui feature specific parts

View File

@ -196,7 +196,7 @@ fn get_function_body(field: &Field, has_input: bool, output_type: &Option<Type>)
let does_function_expect_output = if output_type.is_some() {
quote! {
// We didn't receive output but expected output. Raise an error to notify the lua code
// about it
// about it.
return Err(mlua::Error::ExternalError(std::sync::Arc::new(
err
)));
@ -210,7 +210,7 @@ fn get_function_body(field: &Field, has_input: bool, output_type: &Option<Type>)
quote! {
let (callback_tx, callback_rx) = tokio::sync::oneshot::channel::<CommandTransferValue>();
let tx: core::cell::Ref<tokio::sync::mpsc::Sender<Event>> =
let tx: mlua::AppDataRef<tokio::sync::mpsc::Sender<Event>> =
lua.app_data_ref().expect("This should exist, it was set before");
(*tx)