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).
Closes #8.
Remarks
SolverCache::provider is now pub(crate). Is that all right?
The current design requires implementors of DependencyProvider to use interior mutability to track cancellation. I think that's reasonable, because otherwise we would need to take &mut self in all of DependencyProvider methods, but I'm mentioning it here in case anyone has a different opinion.
Introduces a
should_cancel_with_value
method inDependencyProvider
, that returns anOption<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
returnsSome(...)
, propagation is interrupted and the solver returnsErr(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).Closes #8.
Remarks
SolverCache::provider
is nowpub(crate)
. Is that all right?DependencyProvider
to use interior mutability to track cancellation. I think that's reasonable, because otherwise we would need to take&mut self
in all ofDependencyProvider
methods, but I'm mentioning it here in case anyone has a different opinion.