Make Engine faster to create.

This commit is contained in:
Stephen Chung
2023-02-25 19:57:19 +08:00
parent c2a8c342bb
commit 51581cdef5
13 changed files with 184 additions and 115 deletions

View File

@@ -286,7 +286,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!`])
@@ -336,7 +336,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
}
/// _(debugging)_ Register a callback for debugging.