Fix builds.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
//! Implementation of the Event Handler With State Pattern - JS Style
|
||||
use rhai::{Dynamic, Engine, Map, Scope, AST};
|
||||
use rhai::{Dynamic, Engine, Scope, AST};
|
||||
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
use rhai::Map;
|
||||
|
||||
use std::io::{stdin, stdout, Write};
|
||||
|
||||
@@ -18,18 +21,25 @@ fn print_scope(scope: &Scope) {
|
||||
.iter_raw()
|
||||
.enumerate()
|
||||
.for_each(|(i, (name, constant, value))| {
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
let value_is_shared = if value.is_shared() { " (shared)" } else { "" };
|
||||
#[cfg(feature = "no_closure")]
|
||||
let value_is_shared = "";
|
||||
|
||||
println!(
|
||||
"[{}] {}{}{} = {:?}",
|
||||
i + 1,
|
||||
if constant { "const " } else { "" },
|
||||
name,
|
||||
if value.is_shared() { " (shared)" } else { "" },
|
||||
value_is_shared,
|
||||
*value.read_lock::<Dynamic>().unwrap(),
|
||||
)
|
||||
});
|
||||
println!();
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
pub fn main() {
|
||||
println!("Events Handler Example - JS Style");
|
||||
println!("==================================");
|
||||
@@ -151,3 +161,8 @@ pub fn main() {
|
||||
|
||||
println!("Bye!");
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "no_function", feature = "no_object"))]
|
||||
pub fn main() {
|
||||
panic!("This example does not run under 'no_function' or 'no_object'.")
|
||||
}
|
||||
|
@@ -17,18 +17,24 @@ fn print_scope(scope: &Scope) {
|
||||
.iter_raw()
|
||||
.enumerate()
|
||||
.for_each(|(i, (name, constant, value))| {
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
let value_is_shared = if value.is_shared() { " (shared)" } else { "" };
|
||||
#[cfg(feature = "no_closure")]
|
||||
let value_is_shared = "";
|
||||
|
||||
println!(
|
||||
"[{}] {}{}{} = {:?}",
|
||||
i + 1,
|
||||
if constant { "const " } else { "" },
|
||||
name,
|
||||
if value.is_shared() { " (shared)" } else { "" },
|
||||
value_is_shared,
|
||||
*value.read_lock::<Dynamic>().unwrap(),
|
||||
)
|
||||
});
|
||||
println!();
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
pub fn main() {
|
||||
println!("Events Handler Example - Main Style");
|
||||
println!("===================================");
|
||||
@@ -127,3 +133,8 @@ pub fn main() {
|
||||
|
||||
println!("Bye!");
|
||||
}
|
||||
|
||||
#[cfg(feature = "no_function")]
|
||||
pub fn main() {
|
||||
panic!("This example does not run under 'no_function'.")
|
||||
}
|
||||
|
@@ -1,5 +1,8 @@
|
||||
//! Implementation of the Event Handler With State Pattern - Map Style
|
||||
use rhai::{Dynamic, Engine, Map, Scope, AST};
|
||||
use rhai::{Dynamic, Engine, Scope, AST};
|
||||
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
use rhai::Map;
|
||||
|
||||
use std::io::{stdin, stdout, Write};
|
||||
|
||||
@@ -17,18 +20,25 @@ fn print_scope(scope: &Scope) {
|
||||
.iter_raw()
|
||||
.enumerate()
|
||||
.for_each(|(i, (name, constant, value))| {
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
let value_is_shared = if value.is_shared() { " (shared)" } else { "" };
|
||||
#[cfg(feature = "no_closure")]
|
||||
let value_is_shared = "";
|
||||
|
||||
println!(
|
||||
"[{}] {}{}{} = {:?}",
|
||||
i + 1,
|
||||
if constant { "const " } else { "" },
|
||||
name,
|
||||
if value.is_shared() { " (shared)" } else { "" },
|
||||
value_is_shared,
|
||||
*value.read_lock::<Dynamic>().unwrap(),
|
||||
)
|
||||
});
|
||||
println!();
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
pub fn main() {
|
||||
println!("Events Handler Example - Map Style");
|
||||
println!("==================================");
|
||||
@@ -136,3 +146,8 @@ pub fn main() {
|
||||
|
||||
println!("Bye!");
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "no_function", feature = "no_object"))]
|
||||
pub fn main() {
|
||||
panic!("This example does not run under 'no_function' or 'no_object'.")
|
||||
}
|
||||
|
Reference in New Issue
Block a user