arena_b/
error.rs

1use std::fmt;
2
3/// Crate-level error type for arena-b
4#[derive(Debug)]
5pub enum ArenaError {
6    /// Allocation or initialization failed with message
7    AllocationFailed(String),
8    /// Virtual memory related error
9    VirtualMemoryError(String),
10    /// Layout computation failed
11    InvalidLayout(String),
12    /// Generic error wrapper
13    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 {}