FIX - Errors in no_std.

This commit is contained in:
Stephen Chung 2020-03-24 11:21:09 +08:00
parent 3677bd3651
commit 7b06715299
2 changed files with 7 additions and 3 deletions

View File

@ -7,7 +7,11 @@ fn main() -> Result<(), EvalAltResult> {
let result = engine.eval::<INT>("40 + 2")?;
println!("Answer: {}", 42);
#[cfg(not(feature = "no_std"))]
println!("Answer: {}", result);
#[cfg(feature = "no_std")]
assert_eq!(result, 42);
Ok(())
}

View File

@ -177,7 +177,7 @@ impl<'e> Engine<'e> {
name: &str,
callback: impl Fn(&mut T) -> U + 'static,
) {
let get_fn_name = format!("{}{}", FUNC_GETTER, name);
let get_fn_name = FUNC_GETTER.to_string() + name;
self.register_fn(&get_fn_name, callback);
}
@ -219,7 +219,7 @@ impl<'e> Engine<'e> {
name: &str,
callback: impl Fn(&mut T, U) -> () + 'static,
) {
let set_fn_name = format!("{}{}", FUNC_SETTER, name);
let set_fn_name = FUNC_SETTER.to_string() + name;
self.register_fn(&set_fn_name, callback);
}