Make API chainable.

This commit is contained in:
Stephen Chung
2020-07-12 11:46:53 +08:00
parent 2a8d63fd5f
commit 8449f8c55e
22 changed files with 223 additions and 143 deletions

View File

@@ -21,10 +21,10 @@ fn test_method_call() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new();
engine.register_type::<TestStruct>();
engine.register_fn("update", TestStruct::update);
engine.register_fn("new_ts", TestStruct::new);
engine
.register_type::<TestStruct>()
.register_fn("update", TestStruct::update)
.register_fn("new_ts", TestStruct::new);
assert_eq!(
engine.eval::<TestStruct>("let x = new_ts(); x.update(1000); x")?,