use super::size::SizeClassError;
#[derive(Debug, PartialEq, Clone)]
pub enum BlockError {
BadSize(usize),
OutOfMemory,
NoSpaceForAllocation,
AddressOverflow,
}
#[derive(Debug, PartialEq, Clone)]
pub enum AllocError {
OutOfMemory,
SizeTooBig,
InternalError(BlockError),
}
impl From<SizeClassError> for AllocError {
fn from(value: SizeClassError) -> Self {
match value {
SizeClassError::TooBig => AllocError::SizeTooBig,
}
}
}
impl From<BlockError> for AllocError {
fn from(value: BlockError) -> Self {
AllocError::InternalError(value)
}
}
#[derive(Debug, PartialEq, Clone)]
pub enum ImmixError {
DuplicatedKey,
InternalError(AllocError),
}
impl From<AllocError> for ImmixError {
fn from(value: AllocError) -> Self {
ImmixError::InternalError(value)
}
}