#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Endian {
Big,
Little,
}
impl Endian {
#[cfg(target_endian = "little")]
pub const NATIVE: Self = Self::Little;
#[cfg(target_endian = "big")]
pub const NATIVE: Self = Self::Big;
#[inline]
pub const fn is_big(self) -> bool {
matches!(self, Self::Big)
}
#[inline]
pub const fn is_little(self) -> bool {
matches!(self, Self::Little)
}
#[inline]
pub const fn is_native(self) -> bool {
matches!(self, Self::NATIVE)
}
}
impl Default for Endian {
#[inline]
fn default() -> Self {
Self::NATIVE
}
}