stdto_core/
enums.rs

1#![allow(unused)]
2
3use core::fmt;
4
5#[non_exhaustive]
6#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
7pub enum Endian {
8    Big,
9    #[default]
10    Little,
11    Native,
12}
13
14#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
15pub enum HexMode {
16    #[default]
17    Lower,
18    Upper,
19    Lower0x,
20    Upper0x,
21}
22
23impl HexMode {
24    #[inline]
25    pub fn has_0x(&self) -> bool {
26        matches!(self, HexMode::Lower0x | HexMode::Upper0x)
27    }
28    #[inline]
29    pub fn is_lower(&self) -> bool {
30        matches!(self, HexMode::Lower | HexMode::Lower0x)
31    }
32    #[inline]
33    pub fn is_upper(&self) -> bool {
34        matches!(self, HexMode::Upper | HexMode::Upper0x)
35    }
36}
37
38impl fmt::Display for HexMode {
39    #[inline]
40    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
41        write!(f, "{:?}", self)
42    }
43}