use crate::Spell;
use std::fmt;
pub use strum::ParseError;
pub use num_enum::TryFromPrimitiveError;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct TryFromSpellError {
pub defindex: u32,
pub value: Spell,
}
impl fmt::Display for TryFromSpellError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "No value matching `{}` for attribute `{}`", self.value, self.defindex)
}
}
impl std::error::Error for TryFromSpellError {}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum InsertError {
Full,
Duplicate,
}
impl fmt::Display for InsertError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
InsertError::Full => write!(f, "Attribute set is full"),
InsertError::Duplicate => write!(f, "Attribute already exists in set"),
}
}
}
impl std::error::Error for InsertError {}