minor refactor
This commit is contained in:
@@ -24,12 +24,6 @@ fn main() {
|
||||
engine.register_fn("update", TestStruct::update);
|
||||
engine.register_fn("new_ts", TestStruct::new);
|
||||
|
||||
println!(
|
||||
"{:?}",
|
||||
engine.eval::<TestStruct>("let x = new_ts(); x.update(); x")
|
||||
);
|
||||
println!(
|
||||
"{:?}",
|
||||
engine.eval::<TestStruct>("let x = [new_ts()]; x[0].update(); x[0]")
|
||||
);
|
||||
println!("{:?}", engine.eval::<TestStruct>("let x = new_ts(); x.update(); x"));
|
||||
println!("{:?}", engine.eval::<TestStruct>("let x = [new_ts()]; x[0].update(); x[0]"));
|
||||
}
|
||||
|
@@ -5,12 +5,7 @@ fn main() {
|
||||
let mut engine = Engine::new();
|
||||
let mut scope: Scope = Vec::new();
|
||||
|
||||
if !engine
|
||||
.eval_with_scope::<()>(&mut scope, "let x = 4 + 5")
|
||||
.is_ok()
|
||||
{
|
||||
assert!(false);
|
||||
}
|
||||
assert!(engine.eval_with_scope::<()>(&mut scope, "let x = 4 + 5").is_ok());
|
||||
|
||||
if let Ok(result) = engine.eval_with_scope::<i64>(&mut scope, "x") {
|
||||
println!("result: {}", result);
|
||||
|
Reference in New Issue
Block a user