Skip to main content

nautilus_binance/spot/sbe/generated/
list_order_status.rs

1#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
2#[repr(u8)]
3pub enum ListOrderStatus {
4    Canceling = 0x0_u8,
5    Executing = 0x1_u8,
6    AllDone = 0x2_u8,
7    Reject = 0x3_u8,
8    NonRepresentable = 0xfe_u8,
9    #[default]
10    NullVal = 0xff_u8,
11}
12impl From<u8> for ListOrderStatus {
13    #[inline]
14    fn from(v: u8) -> Self {
15        match v {
16            0x0_u8 => Self::Canceling,
17            0x1_u8 => Self::Executing,
18            0x2_u8 => Self::AllDone,
19            0x3_u8 => Self::Reject,
20            0xfe_u8 => Self::NonRepresentable,
21            _ => Self::NullVal,
22        }
23    }
24}
25impl From<ListOrderStatus> for u8 {
26    #[inline]
27    fn from(v: ListOrderStatus) -> Self {
28        match v {
29            ListOrderStatus::Canceling => 0x0_u8,
30            ListOrderStatus::Executing => 0x1_u8,
31            ListOrderStatus::AllDone => 0x2_u8,
32            ListOrderStatus::Reject => 0x3_u8,
33            ListOrderStatus::NonRepresentable => 0xfe_u8,
34            ListOrderStatus::NullVal => 0xff_u8,
35        }
36    }
37}
38impl core::str::FromStr for ListOrderStatus {
39    type Err = ();
40
41    #[inline]
42    fn from_str(v: &str) -> core::result::Result<Self, Self::Err> {
43        match v {
44            "Canceling" => Ok(Self::Canceling),
45            "Executing" => Ok(Self::Executing),
46            "AllDone" => Ok(Self::AllDone),
47            "Reject" => Ok(Self::Reject),
48            "NonRepresentable" => Ok(Self::NonRepresentable),
49            _ => Ok(Self::NullVal),
50        }
51    }
52}
53impl core::fmt::Display for ListOrderStatus {
54    #[inline]
55    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
56        match self {
57            Self::Canceling => write!(f, "Canceling"),
58            Self::Executing => write!(f, "Executing"),
59            Self::AllDone => write!(f, "AllDone"),
60            Self::Reject => write!(f, "Reject"),
61            Self::NonRepresentable => write!(f, "NonRepresentable"),
62            Self::NullVal => write!(f, "NullVal"),
63        }
64    }
65}