1use std::fmt;
2
3#[derive(Debug)]
5pub enum ArenaError {
6 AllocationFailed(String),
8 VirtualMemoryError(String),
10 InvalidLayout(String),
12 Other(String),
14}
15
16impl fmt::Display for ArenaError {
17 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18 match self {
19 ArenaError::AllocationFailed(s) => write!(f, "Allocation failed: {}", s),
20 ArenaError::VirtualMemoryError(s) => write!(f, "Virtual memory error: {}", s),
21 ArenaError::InvalidLayout(s) => write!(f, "Invalid layout: {}", s),
22 ArenaError::Other(s) => write!(f, "{}", s),
23 }
24 }
25}
26
27impl std::error::Error for ArenaError {}