1use super::size::SizeClassError;
2
3#[derive(Debug, PartialEq, Clone)]
4pub enum BlockError {
5 BadSize(usize),
7 OutOfMemory,
9 NoSpaceForAllocation,
11 AddressOverflow,
13}
14
15#[derive(Debug, PartialEq, Clone)]
16pub enum AllocError {
17 OutOfMemory,
19 SizeTooBig,
21 InternalError(BlockError),
23}
24
25impl From<SizeClassError> for AllocError {
26 fn from(value: SizeClassError) -> Self {
27 match value {
28 SizeClassError::TooBig => AllocError::SizeTooBig,
29 }
30 }
31}
32
33impl From<BlockError> for AllocError {
34 fn from(value: BlockError) -> Self {
35 AllocError::InternalError(value)
36 }
37}
38
39#[derive(Debug, PartialEq, Clone)]
40pub enum ImmixError {
41 DuplicatedKey,
43 InternalError(AllocError),
45}
46
47impl From<AllocError> for ImmixError {
48 fn from(value: AllocError) -> Self {
49 ImmixError::InternalError(value)
50 }
51}