use core::{fmt::Display, result};
#[derive(Debug)]
pub enum KallocError {
Enomem,
Eorder,
Ealloced,
Echeck,
Enotail,
Enocomp,
}
pub type Result<T> = result::Result<T, KallocError>;
impl Display for KallocError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let error = match self {
Self::Enomem => "Out of memory",
Self::Eorder => "Order invalid",
Self::Ealloced => "Alloced",
Self::Echeck => "Check at free flag(s) set",
Self::Enotail => "PageTail not set",
Self::Enocomp => "Comp head not consistent",
};
write!(f, "{error}")
}
}