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