1use osom_lib_reprc::macros::reprc;
3
4use osom_lib_try_clone::TryClone;
5
6#[reprc]
8#[repr(u8)]
9#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
10#[must_use]
11pub enum BTreeError {
12 AllocationError = 0,
14
15 TreeSizeOutOfRange = 1,
18}
19
20impl TryClone for BTreeError {
21 type Error = core::convert::Infallible;
22
23 fn try_clone(&self) -> Result<Self, Self::Error> {
24 Ok(*self)
25 }
26}
27
28impl core::fmt::Display for BTreeError {
29 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
30 match self {
31 BTreeError::AllocationError => write!(f, "BTreeError::AllocationError"),
32 BTreeError::TreeSizeOutOfRange => write!(f, "BTreeError::TreeSizeOutOfRange"),
33 }
34 }
35}
36
37osom_lib_macros::unreachable_from_infallible!(BTreeError);
38
39#[reprc]
41#[repr(u8)]
42#[must_use]
43#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
44pub enum BTreeTryCloneError {
45 KeyCloningError = 1,
47
48 ValueCloningError = 2,
50
51 OtherError = 3,
53}
54
55impl core::fmt::Display for BTreeTryCloneError {
56 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
57 match self {
58 BTreeTryCloneError::OtherError => write!(f, "BTreeTryCloneError::OtherError"),
59 BTreeTryCloneError::KeyCloningError => write!(f, "BTreeTryCloneError::KeyCloningError"),
60 BTreeTryCloneError::ValueCloningError => write!(f, "BTreeTryCloneError::ValueCloningError"),
61 }
62 }
63}
64
65osom_lib_macros::unreachable_from_infallible!(BTreeTryCloneError);