Allow call_fn with only one parameter; consume can retain functions, eval cannot.

This commit is contained in:
Stephen Chung
2020-03-12 14:54:14 +08:00
parent e24d3a7ade
commit 560da5fdc6
11 changed files with 176 additions and 156 deletions

View File

@@ -4,9 +4,9 @@ fn main() -> Result<(), EvalAltResult> {
let mut engine = Engine::new();
let mut scope = Scope::new();
engine.eval_with_scope::<()>(&mut scope, false, "let x = 4 + 5")?;
engine.eval_with_scope::<()>(&mut scope, "let x = 4 + 5")?;
let result = engine.eval_with_scope::<i64>(&mut scope, false, "x")?;
let result = engine.eval_with_scope::<i64>(&mut scope, "x")?;
println!("result: {}", result);

View File

@@ -67,7 +67,7 @@ fn main() {
_ => (),
}
if let Err(err) = engine.consume(&contents) {
if let Err(err) = engine.consume(&contents, false) {
eprintln!("{}", padding("=", filename.len()));
eprintln!("{}", filename);
eprintln!("{}", padding("=", filename.len()));