Make all public API's return Box<EvalAltResult> to reduce footprint.

This commit is contained in:
Stephen Chung
2020-04-21 23:25:12 +08:00
parent 0a75479637
commit 69733688bf
63 changed files with 337 additions and 303 deletions

View File

@@ -16,7 +16,7 @@ impl TestStruct {
}
#[cfg(not(feature = "no_object"))]
fn main() -> Result<(), EvalAltResult> {
fn main() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new();
engine.register_type::<TestStruct>();

View File

@@ -1,7 +1,7 @@
use rhai::{packages::*, Engine, EvalAltResult, INT};
use std::rc::Rc;
fn main() -> Result<(), EvalAltResult> {
fn main() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new_raw();
engine.load_package(ArithmeticPackage::new().get());

View File

@@ -2,7 +2,7 @@
use rhai::{Engine, EvalAltResult, INT};
fn main() -> Result<(), EvalAltResult> {
fn main() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
let result = engine.eval::<INT>("40 + 2")?;

View File

@@ -157,7 +157,7 @@ fn main() {
Ok(_) => (),
Err(err) => {
println!();
print_error(&input, err);
print_error(&input, *err);
println!();
}
}

View File

@@ -1,6 +1,6 @@
use rhai::{Engine, EvalAltResult, Scope, INT};
fn main() -> Result<(), EvalAltResult> {
fn main() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
let mut scope = Scope::new();

View File

@@ -72,7 +72,7 @@ fn main() {
eprintln!("{:=<1$}", "", filename.len());
eprintln!("");
eprint_error(&contents, err);
eprint_error(&contents, *err);
}
}
}

View File

@@ -1,6 +1,6 @@
use rhai::{Engine, EvalAltResult, RegisterFn, INT};
fn main() -> Result<(), EvalAltResult> {
fn main() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new();
fn add(x: INT, y: INT) -> INT {