use std::error::Error;
use std::fmt::{Debug, Display, Formatter, Write};
pub enum MapErrorKind {
AllocationError,
AccessError
}
pub struct CIndexMapError {
message: &'static str,
kind: MapErrorKind
}
impl CIndexMapError {
pub(in crate) fn new(
kind: MapErrorKind,
message: &'static str
) -> CIndexMapError {
CIndexMapError {
kind,
message
}
}
}
impl Debug for CIndexMapError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.write_str(self.message)
}
}
impl Display for CIndexMapError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.write_str(self.message)
}
}
impl Error for CIndexMapError {}