use std::{fmt, ops::Range};
use crate::VarNo;
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub struct OutOfMemory;
impl fmt::Display for OutOfMemory {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("decision diagram operation ran out of memory")
}
}
impl std::error::Error for OutOfMemory {}
impl From<OutOfMemory> for std::io::Error {
fn from(_: OutOfMemory) -> Self {
std::io::ErrorKind::OutOfMemory.into()
}
}
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct DuplicateVarName {
pub name: String,
pub present_var: VarNo,
pub added_vars: Range<VarNo>,
}
impl fmt::Display for DuplicateVarName {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"the variable name '{}' is already in use for variable number {}",
self.name, self.present_var
)
}
}