Change no_std sample to bare-bones.

This commit is contained in:
Stephen Chung 2020-07-22 11:43:58 +08:00
parent 16e8ef454f
commit 839738b97e
2 changed files with 6 additions and 4 deletions

View File

@ -8,7 +8,7 @@ homepage = "https://github.com/jonathandturner/rhai/tree/master/no_std/no_std_te
repository = "https://github.com/jonathandturner/rhai" repository = "https://github.com/jonathandturner/rhai"
[dependencies] [dependencies]
rhai = { path = "../../", features = [ "no_std" ], default_features = false } rhai = { path = "../../", features = [ "no_std", "unchecked", "only_i32", "no_module" ], default_features = false }
wee_alloc = { version = "0.4.5", default_features = false } wee_alloc = { version = "0.4.5", default_features = false }
[profile.dev] [profile.dev]

View File

@ -1,4 +1,4 @@
//! This is a `no-std` application for the that evaluates //! This is a bare-bones `no-std` application that evaluates
//! a simple expression and uses the result as the return value. //! a simple expression and uses the result as the return value.
#![no_std] #![no_std]
@ -14,10 +14,12 @@ use rhai::{Engine, INT};
#[start] #[start]
fn main(_argc: isize, _argv: *const *const u8) -> isize { fn main(_argc: isize, _argv: *const *const u8) -> isize {
let engine = Engine::new(); // Notice that this is a _raw_ engine.
// To do anything useful, load a few packages from `rhai::packages`.
let engine = Engine::new_raw();
// Evaluate a simple expression: 40 + 2 // Evaluate a simple expression: 40 + 2
engine.eval::<INT>("40 + 2").unwrap() as isize engine.eval_expression::<INT>("40 + 2").unwrap() as isize
} }
#[alloc_error_handler] #[alloc_error_handler]