aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart-sat-resolver/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/mozart-sat-resolver/src/error.rs')
-rw-r--r--crates/mozart-sat-resolver/src/error.rs50
1 files changed, 0 insertions, 50 deletions
diff --git a/crates/mozart-sat-resolver/src/error.rs b/crates/mozart-sat-resolver/src/error.rs
deleted file mode 100644
index e4b9841..0000000
--- a/crates/mozart-sat-resolver/src/error.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-use std::fmt;
-
-/// A bug in the solver itself (should never happen in normal operation).
-/// Equivalent to Composer's SolverBugException.
-#[derive(Debug, Clone)]
-pub struct SolverBugError {
- pub message: String,
-}
-
-impl fmt::Display for SolverBugError {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- write!(f, "Solver bug: {}", self.message)
- }
-}
-
-impl std::error::Error for SolverBugError {}
-
-/// Errors produced by the SAT solver.
-#[derive(Debug)]
-pub enum SolverError {
- /// Internal solver bug (should never happen).
- Bug(SolverBugError),
- /// The dependency set is unsolvable. Contains problem descriptions.
- Unsolvable(Vec<String>),
-}
-
-impl fmt::Display for SolverError {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- match self {
- SolverError::Bug(e) => write!(f, "{e}"),
- SolverError::Unsolvable(problems) => {
- for (i, problem) in problems.iter().enumerate() {
- if i > 0 {
- writeln!(f)?;
- }
- write!(f, " Problem {}: {problem}", i + 1)?;
- }
- Ok(())
- }
- }
- }
-}
-
-impl std::error::Error for SolverError {}
-
-impl From<SolverBugError> for SolverError {
- fn from(e: SolverBugError) -> Self {
- SolverError::Bug(e)
- }
-}