lock debug messages behind 'debug_msgs' feature
This commit is contained in:
parent
02dff9525f
commit
8d07d8e00a
@ -12,3 +12,6 @@ include = [
|
|||||||
"scripts/*.rhai",
|
"scripts/*.rhai",
|
||||||
"Cargo.toml"
|
"Cargo.toml"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[features]
|
||||||
|
debug_msgs = []
|
||||||
|
@ -160,7 +160,7 @@ impl Engine {
|
|||||||
ident: String,
|
ident: String,
|
||||||
args: Vec<&mut Any>,
|
args: Vec<&mut Any>,
|
||||||
) -> Result<Box<Any>, EvalAltResult> {
|
) -> Result<Box<Any>, EvalAltResult> {
|
||||||
println!(
|
debug_println!(
|
||||||
"Trying to call function {:?} with args {:?}",
|
"Trying to call function {:?} with args {:?}",
|
||||||
ident,
|
ident,
|
||||||
args.iter().map(|x| (&**x).type_id()).collect::<Vec<_>>()
|
args.iter().map(|x| (&**x).type_id()).collect::<Vec<_>>()
|
||||||
@ -196,7 +196,7 @@ impl Engine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn register_fn_raw(&mut self, ident: String, args: Option<Vec<TypeId>>, f: Box<FnAny>) {
|
pub fn register_fn_raw(&mut self, ident: String, args: Option<Vec<TypeId>>, f: Box<FnAny>) {
|
||||||
println!("Register; {:?} with args {:?}", ident, args,);
|
debug_println!("Register; {:?} with args {:?}", ident, args);
|
||||||
|
|
||||||
let spec = FnSpec { ident, args };
|
let spec = FnSpec { ident, args };
|
||||||
|
|
||||||
|
@ -34,6 +34,13 @@
|
|||||||
#![allow(warnings, unknown_lints, type_complexity, new_without_default_derive,
|
#![allow(warnings, unknown_lints, type_complexity, new_without_default_derive,
|
||||||
needless_pass_by_value, too_many_arguments)]
|
needless_pass_by_value, too_many_arguments)]
|
||||||
|
|
||||||
|
// needs to be here, because order matters for macros
|
||||||
|
macro_rules! debug_println {
|
||||||
|
() => (#[cfg(feature = "debug_msgs")] {print!("\n")});
|
||||||
|
($fmt:expr) => (#[cfg(feature = "debug_msgs")] {print!(concat!($fmt, "\n"))});
|
||||||
|
($fmt:expr, $($arg:tt)*) => (#[cfg(feature = "debug_msgs")] {print!(concat!($fmt, "\n"), $($arg)*)});
|
||||||
|
}
|
||||||
|
|
||||||
mod any;
|
mod any;
|
||||||
mod call;
|
mod call;
|
||||||
mod engine;
|
mod engine;
|
||||||
@ -46,3 +53,4 @@ mod tests;
|
|||||||
pub use any::Any;
|
pub use any::Any;
|
||||||
pub use engine::{Engine, EvalAltResult, Scope};
|
pub use engine::{Engine, EvalAltResult, Scope};
|
||||||
pub use fn_register::RegisterFn;
|
pub use fn_register::RegisterFn;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user