Revert debugging changes

This commit is contained in:
torkleyy 2017-12-20 16:39:03 +01:00
parent a0fb5036f6
commit aec1fdcb78
2 changed files with 2 additions and 16 deletions

View File

@ -1,5 +1,5 @@
extern crate rhai; extern crate rhai;
use rhai::{Any, Engine, EvalAltResult, RegisterFn}; use rhai::{Engine, RegisterFn};
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
struct TestStruct { struct TestStruct {
@ -16,22 +16,13 @@ impl TestStruct {
} }
} }
fn print_ty_name(test: Vec<&mut Box<Any>>) -> Result<Box<Any>, EvalAltResult> {
println!("Ty name: {:?}", (*test[0]).as_ref().type_name());
Ok(Box::new(()))
}
fn main() { fn main() {
let mut engine = Engine::new(); let mut engine = Engine::new();
engine.register_type::<TestStruct>(); engine.register_type::<TestStruct>();
print_ty_name(vec![&mut (Box::new(TestStruct::new()) as Box<Any>)]).unwrap();
engine.register_fn("update", TestStruct::update); engine.register_fn("update", TestStruct::update);
engine.register_fn("new_ts", TestStruct::new); engine.register_fn("new_ts", TestStruct::new);
engine.register_fn_raw("ty_name".to_owned(), None, Box::new(print_ty_name));
println!( println!(
"{:?}", "{:?}",

View File

@ -151,7 +151,6 @@ impl Engine {
/// your type must implement Clone. /// your type must implement Clone.
pub fn register_type<T: Any>(&mut self) { pub fn register_type<T: Any>(&mut self) {
// currently a no-op, exists for future extensibility // currently a no-op, exists for future extensibility
println!("Registering {:?}", TypeId::of::<T>());
} }
/// Register a get function for a member of a registered type /// Register a get function for a member of a registered type
@ -947,11 +946,7 @@ impl Engine {
fns: HashMap::new(), fns: HashMap::new(),
}; };
// TODO Engine::register_default_lib(&mut engine);
// TODO
// TODO
// TODO
//Engine::register_default_lib(&mut engine);
engine engine
} }