1use core::fmt::Debug;
2
3#[derive(Copy, Clone, Default, Debug, PartialEq, PartialOrd)]
4pub struct Little<T: Copy + Clone + Default + Debug + PartialEq + PartialOrd + Sized>(T);
5
6macro_rules! define {
7 ($type:ty) => {
8 impl Little<$type> {
9 pub fn to_ne(self) -> $type {
10 <$type>::from_le(self.0)
11 }
12 }
13
14 impl Into<$type> for Little<$type> {
15 #[inline]
16 fn into(self) -> $type {
17 <$type>::from_le(self.0)
18 }
19 }
20
21 impl From<$type> for Little<$type> {
22 #[inline]
23 fn from(t: $type) -> Self {
24 Self(<$type>::to_le(t))
25 }
26 }
27 };
28}
29
30define!(u16);
31define!(u32);
32define!(u64);
33define!(usize);