use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ConcurrentAVLError {
AllocationExhausted,
InvalidOperation(String),
}
impl fmt::Display for ConcurrentAVLError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::AllocationExhausted => write!(f, "Memory arena capacity exhausted"),
Self::InvalidOperation(msg) => write!(f, "Invalid operation: {msg}"),
}
}
}
impl std::error::Error for ConcurrentAVLError {}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn verify_error_display() {
assert_eq!(
ConcurrentAVLError::AllocationExhausted.to_string(),
"Memory arena capacity exhausted"
);
}
}