Skip to content

Commit

Permalink
bump rhai version (#2196)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sgpthomas committed Jul 9, 2024
1 parent 259c2c8 commit b60dad1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion fud2/fud-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions fud2/fud-core/src/script/plugin.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
exec::{OpRef, SetupRef, StateRef},
exec::{SetupRef, StateRef},
DriverBuilder,
};
use std::{
Expand Down Expand Up @@ -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);
Expand All @@ -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(),
Expand Down

0 comments on commit b60dad1

Please sign in to comment.