use core::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Error {
UnknownTimePoint,
InvalidContingentLink,
Overflow,
BudgetExhausted,
MemoryBudgetExceeded,
OutOfMemory,
Internal,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let msg = match self {
Self::UnknownTimePoint => "time point does not belong to this network",
Self::InvalidContingentLink => "contingent link bounds must satisfy 0 < lo <= hi",
Self::Overflow => "tick arithmetic overflowed",
Self::BudgetExhausted => "step budget exhausted",
Self::MemoryBudgetExceeded => "memory budget exceeded",
Self::OutOfMemory => "allocation failed",
Self::Internal => "internal invariant violated",
};
f.write_str(msg)
}
}
impl core::error::Error for Error {}