Rewrite Rhai function dispatching

This commit is contained in:
torkleyy
2017-12-20 12:16:14 +01:00
parent ecf143b649
commit f09545921f
11 changed files with 610 additions and 1351 deletions

View File

@@ -3,7 +3,7 @@ use rhai::{Engine, FnRegister};
#[derive(Clone, Debug)]
struct TestStruct {
x: i64
x: i64,
}
impl TestStruct {
@@ -24,5 +24,8 @@ fn main() {
engine.register_fn("update", TestStruct::update);
engine.register_fn("new_ts", TestStruct::new);
println!("{:?}", engine.eval::<TestStruct>("let x = [new_ts()]; x[0].update(); x[0]"));
println!(
"{:?}",
engine.eval::<TestStruct>("let x = [new_ts()]; x[0].update(); x[0]")
);
}