Refactor and add state to debugger.

This commit is contained in:
Stephen Chung
2022-01-28 18:59:18 +08:00
parent 20baae71d4
commit 66af69aaff
30 changed files with 693 additions and 624 deletions

View File

@@ -260,12 +260,13 @@ impl Engine {
self.debug = Some(Box::new(callback));
self
}
/// _(debugging)_ Register a callback for debugging.
/// _(debugging)_ Register callbacks for debugging.
/// Exported under the `debugging` feature only.
#[cfg(feature = "debugging")]
#[inline(always)]
pub fn on_debugger(
&mut self,
init: impl Fn() -> Dynamic + SendSync + 'static,
callback: impl Fn(
&mut EvalContext,
crate::ast::ASTNode,
@@ -275,7 +276,7 @@ impl Engine {
+ SendSync
+ 'static,
) -> &mut Self {
self.debugger = Some(Box::new(callback));
self.debugger = Some((Box::new(init), Box::new(callback)));
self
}
}