1use core::cmp::Ordering;
2
3#[derive(Debug, Copy, Clone, PartialEq, Eq)]
4pub struct U8Ordering(pub u8);
5
6impl U8Ordering {
7 pub const LESS: Self = Self(0);
8 pub const GREATER: Self = Self(1);
9 pub const EQUAL: Self = Self(2);
10
11 pub const fn to_ordering(self) -> Ordering {
13 match self {
14 Self::LESS => Ordering::Less,
15 Self::GREATER => Ordering::Greater,
16 _ => Ordering::Equal,
17 }
18 }
19
20 pub const fn from_ordering(n: Ordering) -> Self {
22 Self((n as u8) + 1)
23 }
24}
25
26#[doc(hidden)]
27#[macro_export]
28macro_rules! __priv_ret_if_ne {
29 ($left:expr, $right:expr) => {{
30 let l = $left;
31 let r = $right;
32 if l != r {
33 return $crate::__::U8Ordering((l > r) as u8);
34 }
35 }};
36}
37
38#[doc(hidden)]
39#[macro_export]
40macro_rules! __priv_first_expr {
41 ($expr:expr) => {
42 $expr
43 };
44 ($expr:expr, $($more:expr),*) => {
45 $expr
46 };
47}