1use core::fmt::Display;
3
4use osom_lib_reprc::macros::reprc;
5
6#[reprc]
8#[repr(u8)]
9#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
10#[must_use]
11pub enum CBoxError {
12 AllocationError = 0,
14}
15
16osom_lib_macros::unreachable_from_infallible!(CBoxError);
17
18impl Display for CBoxError {
19 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
20 match self {
21 CBoxError::AllocationError => write!(f, "CBoxError::AllocationError"),
22 }
23 }
24}
25
26#[reprc]
28#[repr(u8)]
29#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
30#[must_use]
31pub enum CBoxTryCloneError {
32 BoxError(CBoxError) = 0,
34
35 AllocatorCloningError = 1,
37
38 ItemCloningError = 2,
40}
41
42osom_lib_macros::unreachable_from_infallible!(CBoxTryCloneError);
43
44impl Display for CBoxTryCloneError {
45 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
46 match self {
47 CBoxTryCloneError::BoxError(e) => write!(f, "CBoxTryCloneError::BoxError({e})"),
48 CBoxTryCloneError::ItemCloningError => write!(f, "CBoxTryCloneError::ItemCloningError"),
49 CBoxTryCloneError::AllocatorCloningError => todo!(),
50 }
51 }
52}
53
54impl From<CBoxError> for CBoxTryCloneError {
55 fn from(e: CBoxError) -> Self {
56 Self::BoxError(e)
57 }
58}