1use std::error::Error;
4use std::fmt::{Debug, Display, Formatter, Write};
5
6pub enum MapErrorKind {
7 AllocationError,
8 AccessError
9}
10
11pub struct CIndexMapError {
16 message: &'static str,
18
19 kind: MapErrorKind
21}
22
23impl CIndexMapError {
24 pub(in crate) fn new(
28 kind: MapErrorKind,
29 message: &'static str
30 ) -> CIndexMapError {
31 CIndexMapError {
32 kind,
33 message
34 }
35 }
36}
37
38impl Debug for CIndexMapError {
39 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
40 f.write_str(self.message)
41 }
42}
43
44impl Display for CIndexMapError {
45 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
46 f.write_str(self.message)
47 }
48}
49
50impl Error for CIndexMapError {}