From b60dad13fb6b2db5fff4f31d099a389e5aea5a97 Mon Sep 17 00:00:00 2001 From: Samuel Thomas Date: Tue, 9 Jul 2024 10:30:41 -0500 Subject: [PATCH] bump rhai version (#2196) There was a small change to the user facing types in Rhai which caused fud2 to fail compilation for rhai v1.19. This branch fixes that. --- Cargo.lock | 4 ++-- fud2/fud-core/Cargo.toml | 2 +- fud2/fud-core/src/script/plugin.rs | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 17ad1c25a4..01c3e652d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2357,9 +2357,9 @@ dependencies = [ [[package]] name = "rhai" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a7d88770120601ba1e548bb6bc2a05019e54ff01b51479e38e64ec3b59d4759" +checksum = "61797318be89b1a268a018a92a7657096d83f3ecb31418b9e9c16dcbb043b702" dependencies = [ "ahash 0.8.10", "bitflags 2.4.2", diff --git a/fud2/fud-core/Cargo.toml b/fud2/fud-core/Cargo.toml index 9c482a1e4c..b14627dcb7 100644 --- a/fud2/fud-core/Cargo.toml +++ b/fud2/fud-core/Cargo.toml @@ -19,7 +19,7 @@ camino = "1.1.6" anyhow.workspace = true log.workspace = true env_logger.workspace = true -rhai = { version = "1.18.0", features = ["internals"] } +rhai = { version = "1.19.0", features = ["internals"] } once_cell = "1.19.0" ariadne = "0.4.1" itertools.workspace = true diff --git a/fud2/fud-core/src/script/plugin.rs b/fud2/fud-core/src/script/plugin.rs index 4c2df65b72..95a97f5a37 100644 --- a/fud2/fud-core/src/script/plugin.rs +++ b/fud2/fud-core/src/script/plugin.rs @@ -1,5 +1,5 @@ use crate::{ - exec::{OpRef, SetupRef, StateRef}, + exec::{SetupRef, StateRef}, DriverBuilder, }; use std::{ @@ -185,13 +185,14 @@ impl ScriptRunner { fn reg_rule(&mut self, sctx: ScriptContext) { let bld = Rc::clone(&self.builder); - self.engine.register_fn::<_, 4, true, OpRef, true, _>( + self.engine.register_fn( "rule", move |ctx: rhai::NativeCallContext, setups: rhai::Array, input: StateRef, output: StateRef, - rule_name: &str| { + rule_name: &str| + -> RhaiResult<_> { let setups = sctx.setups_array(&ctx, setups)?; let op = bld.borrow_mut().rule(&setups, input, output, rule_name); @@ -208,14 +209,15 @@ impl ScriptRunner { fn reg_op(&mut self, sctx: ScriptContext) { let bld = Rc::clone(&self.builder); - self.engine.register_fn::<_, 5, true, OpRef, true, _>( + self.engine.register_fn( "op", move |ctx: rhai::NativeCallContext, name: &str, setups: rhai::Array, input: StateRef, output: StateRef, - build: rhai::FnPtr| { + build: rhai::FnPtr| + -> RhaiResult<_> { let setups = sctx.setups_array(&ctx, setups)?; let rctx = RhaiSetupCtx { path: sctx.path.clone(),