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 CArcError {
12 AllocationError = 0,
14}
15
16osom_lib_macros::unreachable_from_infallible!(CArcError);
17
18impl Display for CArcError {
19 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
20 match self {
21 CArcError::AllocationError => write!(f, "CArcError::AllocationError"),
22 }
23 }
24}
25
26#[reprc]
28#[repr(u8)]
29#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
30#[must_use]
31pub enum CArcArrayError {
32 AllocationError = 0,
34
35 ArraySizeOutOfRange = 1,
37}
38
39osom_lib_macros::unreachable_from_infallible!(CArcArrayError);
40
41impl Display for CArcArrayError {
42 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
43 match self {
44 CArcArrayError::AllocationError => write!(f, "CArcArrayError::AllocationError"),
45 CArcArrayError::ArraySizeOutOfRange => write!(f, "CArcArrayError::ArraySizeOutOfRange"),
46 }
47 }
48}
49
50#[reprc]
52#[repr(transparent)]
53#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
54#[must_use]
55pub struct MaxReferencesExceededError;
56
57osom_lib_macros::unreachable_from_infallible!(MaxReferencesExceededError);
58
59impl Display for MaxReferencesExceededError {
60 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
61 write!(f, "MaxReferencesExceededError")
62 }
63}
64
65#[reprc]
67#[repr(u8)]
68#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
69#[must_use]
70pub enum WeakUpgradeError {
71 MaxReferencesExceeded = 0,
73
74 NoStrongReferencesAlive = 1,
76}