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