1use crate::Spell;
4use std::fmt;
5
6pub use strum::ParseError;
7pub use num_enum::TryFromPrimitiveError;
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
11pub struct TryFromSpellError {
12 pub defindex: u32,
14 pub value: Spell,
16}
17
18impl fmt::Display for TryFromSpellError {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 write!(f, "No value matching `{}` for attribute `{}`", self.value, self.defindex)
21 }
22}
23
24impl std::error::Error for TryFromSpellError {}
25
26#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
28pub enum InsertError {
29 Full,
31 Duplicate,
33}
34
35impl fmt::Display for InsertError {
36 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37 match self {
38 InsertError::Full => write!(f, "Attribute set is full"),
39 InsertError::Duplicate => write!(f, "Attribute already exists in set"),
40 }
41 }
42}
43
44impl std::error::Error for InsertError {}