cranpose_core/
packed_u64.rs1use std::fmt;
4
5#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[cfg_attr(target_os = "espidf", repr(C, packed(4)))]
12#[cfg_attr(not(target_os = "espidf"), repr(transparent))]
13pub struct PackedU64(u64);
14
15impl PackedU64 {
16 pub const fn new(value: u64) -> Self {
18 Self(value)
19 }
20
21 pub const fn get(self) -> u64 {
23 self.0
24 }
25}
26
27impl From<u64> for PackedU64 {
28 fn from(value: u64) -> Self {
29 Self(value)
30 }
31}
32
33impl fmt::Debug for PackedU64 {
34 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
35 self.get().fmt(f)
36 }
37}