diff options
Diffstat (limited to 'src/structs/settings.rs')
| -rw-r--r-- | src/structs/settings.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/structs/settings.rs b/src/structs/settings.rs index fce6d9e..cf71453 100644 --- a/src/structs/settings.rs +++ b/src/structs/settings.rs | |||
| @@ -20,17 +20,17 @@ macro_rules! impl_byte_order { | |||
| 20 | impl ByteOrder {$( | 20 | impl ByteOrder {$( |
| 21 | pub fn $fr(&self, num: $n) -> Vec<u8> { | 21 | pub fn $fr(&self, num: $n) -> Vec<u8> { |
| 22 | match self { | 22 | match self { |
| 23 | ByteOrder::Le => num.to_le_bytes().to_vec(), | 23 | Self::Le => num.to_le_bytes().to_vec(), |
| 24 | ByteOrder::Be => num.to_be_bytes().to_vec(), | 24 | Self::Be => num.to_be_bytes().to_vec(), |
| 25 | ByteOrder::Ne => num.to_ne_bytes().to_vec(), | 25 | Self::Ne => num.to_ne_bytes().to_vec(), |
| 26 | } | 26 | } |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | pub fn $to(&self, bytes: [u8; size_of::<$n>()]) -> $n { | 29 | pub fn $to(&self, bytes: [u8; size_of::<$n>()]) -> $n { |
| 30 | match self { | 30 | match self { |
| 31 | ByteOrder::Le => $n::from_le_bytes(bytes), | 31 | Self::Le => $n::from_le_bytes(bytes), |
| 32 | ByteOrder::Be => $n::from_be_bytes(bytes), | 32 | Self::Be => $n::from_be_bytes(bytes), |
| 33 | ByteOrder::Ne => $n::from_ne_bytes(bytes), | 33 | Self::Ne => $n::from_ne_bytes(bytes), |
| 34 | } | 34 | } |
| 35 | } | 35 | } |
| 36 | )+} | 36 | )+} |
| @@ -55,10 +55,10 @@ impl_byte_order!( | |||
| 55 | impl VariantIndexType { | 55 | impl VariantIndexType { |
| 56 | pub fn cast(&self, num: u32, byte_order: &ByteOrder) -> Vec<u8> { | 56 | pub fn cast(&self, num: u32, byte_order: &ByteOrder) -> Vec<u8> { |
| 57 | match self { | 57 | match self { |
| 58 | VariantIndexType::U8 => byte_order.from_u8(num as u8), | 58 | Self::U8 => byte_order.from_u8(num as u8), |
| 59 | VariantIndexType::U16 => byte_order.form_u16(num as u16), | 59 | Self::U16 => byte_order.form_u16(num as u16), |
| 60 | VariantIndexType::U32 => byte_order.form_u32(num as u32), | 60 | Self::U32 => byte_order.form_u32(num), |
| 61 | VariantIndexType::U64 => byte_order.form_u64(num as u64), | 61 | Self::U64 => byte_order.form_u64(num as u64), |
| 62 | } | 62 | } |
| 63 | } | 63 | } |
| 64 | } | 64 | } |
