attachable_slab_allocator/
defs.rs1#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3pub enum SlabError {
4 OutOfMemory,
7 AlignmentMismatch,
10 InvalidPointer,
12 FatalError,
14}
15
16impl core::fmt::Display for SlabError {
17 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
18 match self {
19 Self::OutOfMemory => write!(f, "Memory allocation failed: Out of memory"),
20 Self::AlignmentMismatch => {
21 write!(f, "Memory alignment is incorrect for this operation")
22 }
23 Self::InvalidPointer => write!(f, "Attempted to use an invalid or null pointer"),
24 Self::FatalError => write!(f, "A fatal system error occurred"),
25 }
26 }
27}
28
29impl core::error::Error for SlabError {
30 fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
31 None
32 }
33}
34
35pub type Result<T> = core::result::Result<T, SlabError>;