mop_common_defs/
solver.rs

1use alloc::boxed::Box;
2use core::{future::Future, pin::Pin};
3
4#[cfg(not(feature = "with_futures"))]
5pub type SolverFuture<'a> = Pin<Box<dyn Future<Output = ()> + 'a>>;
6
7#[cfg(feature = "with_futures")]
8pub type SolverFuture<'a> = Pin<Box<dyn Future<Output = ()> + Send + Sync + 'a>>;
9
10pub trait Solver<P> {
11  /// Do solving work after stoping criteria verification.
12  fn after_iter<'a>(&'a mut self, p: &'a mut P) -> SolverFuture<'a>;
13
14  /// Do solving work before stoping criteria verification.
15  fn before_iter<'a>(&'a mut self, p: &'a mut P) -> SolverFuture<'a>;
16
17  fn finished(&mut self, _: &mut P) {}
18
19  fn init(&mut self, _: &mut P) {}
20}