Make on_print/on_debug Option.

This commit is contained in:
Stephen Chung
2021-06-29 17:42:03 +08:00
parent 8f4a582f88
commit 27c126d2f0
3 changed files with 36 additions and 29 deletions

View File

@@ -2219,7 +2219,7 @@ impl Engine {
/// ```
#[inline(always)]
pub fn on_print(&mut self, callback: impl Fn(&str) + SendSync + 'static) -> &mut Self {
self.print = Box::new(callback);
self.print = Some(Box::new(callback));
self
}
/// Override default action of `debug` (print to stdout using [`println!`])
@@ -2258,7 +2258,7 @@ impl Engine {
&mut self,
callback: impl Fn(&str, Option<&str>, Position) + SendSync + 'static,
) -> &mut Self {
self.debug = Box::new(callback);
self.debug = Some(Box::new(callback));
self
}
}