Enable termination token.

This commit is contained in:
Stephen Chung
2020-11-02 11:04:45 +08:00
parent b07a2aa79c
commit 6f3ce96d9d
9 changed files with 82 additions and 122 deletions

View File

@@ -1732,12 +1732,12 @@ impl Engine {
///
/// engine.on_progress(move |&ops| {
/// if ops > 10000 {
/// false
/// Some("Over 10,000 operations!".into())
/// } else if ops % 800 == 0 {
/// *logger.write().unwrap() = ops;
/// true
/// None
/// } else {
/// true
/// None
/// }
/// });
///
@@ -1752,7 +1752,7 @@ impl Engine {
#[inline(always)]
pub fn on_progress(
&mut self,
callback: impl Fn(&u64) -> bool + SendSync + 'static,
callback: impl Fn(&u64) -> Option<Dynamic> + SendSync + 'static,
) -> &mut Self {
self.progress = Some(Box::new(callback));
self