-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow cancelling the solving process (#20)
Introduces a `should_cancel_with_value` method in `DependencyProvider`, that returns an `Option<Box<dyn Any>>`. This method is called at the beginning of each unit propagation round and before potentially blocking operations (like [Self::get_dependencies] and [Self::get_candidates]). If `should_cancel_with_value` returns `Some(...)`, propagation is interrupted and the solver returns `Err(UnsolvableOrCancelled::Cancelled(...))`, bubbling up the value to the library user (this way you can handle any additional details surrounding the cancellation outside of the solver).
- Loading branch information
1 parent
f253121
commit 7c1fa14
Showing
6 changed files
with
277 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.