From 060a61fc9d4065c3e89e091e92733582a1b83d45 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Tue, 24 Mar 2020 09:49:08 +0800 Subject: [PATCH] Use INT in examples instead of i64. --- examples/arrays_and_structs.rs | 4 ++-- examples/custom_types_and_methods.rs | 4 ++-- examples/hello.rs | 4 ++-- examples/no_std.rs | 6 +++--- examples/reuse_scope.rs | 4 ++-- examples/simple_fn.rs | 6 +++--- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/arrays_and_structs.rs b/examples/arrays_and_structs.rs index cfdd7dc1..8ea7fcf0 100644 --- a/examples/arrays_and_structs.rs +++ b/examples/arrays_and_structs.rs @@ -1,8 +1,8 @@ -use rhai::{Engine, RegisterFn}; +use rhai::{Engine, RegisterFn, INT}; #[derive(Clone, Debug)] struct TestStruct { - x: i64, + x: INT, } impl TestStruct { diff --git a/examples/custom_types_and_methods.rs b/examples/custom_types_and_methods.rs index 3ac644f5..bd20159e 100644 --- a/examples/custom_types_and_methods.rs +++ b/examples/custom_types_and_methods.rs @@ -1,8 +1,8 @@ -use rhai::{Engine, EvalAltResult, RegisterFn}; +use rhai::{Engine, EvalAltResult, RegisterFn, INT}; #[derive(Clone)] struct TestStruct { - x: i64, + x: INT, } impl TestStruct { diff --git a/examples/hello.rs b/examples/hello.rs index 590074e7..8527d466 100644 --- a/examples/hello.rs +++ b/examples/hello.rs @@ -1,9 +1,9 @@ -use rhai::{Engine, EvalAltResult}; +use rhai::{Engine, EvalAltResult, INT}; fn main() -> Result<(), EvalAltResult> { let mut engine = Engine::new(); - let result = engine.eval::("40 + 2")?; + let result = engine.eval::("40 + 2")?; println!("Answer: {}", result); // prints 42 diff --git a/examples/no_std.rs b/examples/no_std.rs index d293dc91..9f51f586 100644 --- a/examples/no_std.rs +++ b/examples/no_std.rs @@ -1,13 +1,13 @@ #![cfg_attr(feature = "no_std", no_std)] -use rhai::{Engine, EvalAltResult}; +use rhai::{Engine, EvalAltResult, INT}; fn main() -> Result<(), EvalAltResult> { let mut engine = Engine::new(); - let result = engine.eval::("40 + 2")?; + let result = engine.eval::("40 + 2")?; - assert_eq!(result, 42); + println!("Answer: {}", 42); Ok(()) } diff --git a/examples/reuse_scope.rs b/examples/reuse_scope.rs index a6509ffe..549ccea1 100644 --- a/examples/reuse_scope.rs +++ b/examples/reuse_scope.rs @@ -1,4 +1,4 @@ -use rhai::{Engine, EvalAltResult, Scope}; +use rhai::{Engine, EvalAltResult, Scope, INT}; fn main() -> Result<(), EvalAltResult> { let mut engine = Engine::new(); @@ -6,7 +6,7 @@ fn main() -> Result<(), EvalAltResult> { engine.eval_with_scope::<()>(&mut scope, "let x = 4 + 5")?; - let result = engine.eval_with_scope::(&mut scope, "x")?; + let result = engine.eval_with_scope::(&mut scope, "x")?; println!("result: {}", result); diff --git a/examples/simple_fn.rs b/examples/simple_fn.rs index 994eb7ec..796b8114 100644 --- a/examples/simple_fn.rs +++ b/examples/simple_fn.rs @@ -1,15 +1,15 @@ -use rhai::{Engine, EvalAltResult, RegisterFn}; +use rhai::{Engine, EvalAltResult, RegisterFn, INT}; fn main() -> Result<(), EvalAltResult> { let mut engine = Engine::new(); - fn add(x: i64, y: i64) -> i64 { + fn add(x: INT, y: INT) -> INT { x + y } engine.register_fn("add", add); - let result = engine.eval::("add(40, 2)")?; + let result = engine.eval::("add(40, 2)")?; println!("Answer: {}", result); // prints 42