Make all public API's return Box<EvalAltResult> to reduce footprint.
This commit is contained in:
@@ -95,10 +95,10 @@ def_package!(BasicMathPackage:"Basic mathematic functions.", lib, {
|
||||
"to_int",
|
||||
|x: f32| {
|
||||
if x > (MAX_INT as f32) {
|
||||
return Err(EvalAltResult::ErrorArithmetic(
|
||||
return Err(Box::new(EvalAltResult::ErrorArithmetic(
|
||||
format!("Integer overflow: to_int({})", x),
|
||||
Position::none(),
|
||||
));
|
||||
)));
|
||||
}
|
||||
|
||||
Ok(x.trunc() as INT)
|
||||
@@ -110,10 +110,10 @@ def_package!(BasicMathPackage:"Basic mathematic functions.", lib, {
|
||||
"to_int",
|
||||
|x: FLOAT| {
|
||||
if x > (MAX_INT as FLOAT) {
|
||||
return Err(EvalAltResult::ErrorArithmetic(
|
||||
return Err(Box::new(EvalAltResult::ErrorArithmetic(
|
||||
format!("Integer overflow: to_int({})", x),
|
||||
Position::none(),
|
||||
));
|
||||
)));
|
||||
}
|
||||
|
||||
Ok(x.trunc() as INT)
|
||||
|
Reference in New Issue
Block a user