aboutsummaryrefslogtreecommitdiff
path: root/src/structs
diff options
context:
space:
mode:
Diffstat (limited to 'src/structs')
-rw-r--r--src/structs/error.rs6
-rw-r--r--src/structs/settings.rs20
2 files changed, 13 insertions, 13 deletions
diff --git a/src/structs/error.rs b/src/structs/error.rs
index f08c9a3..3e74e45 100644
--- a/src/structs/error.rs
+++ b/src/structs/error.rs
@@ -23,13 +23,13 @@ impl From<StructError> for ArchiveError<StructError> {
23impl Display for StructError { 23impl Display for StructError {
24 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 24 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25 match self { 25 match self {
26 StructError::SerializationNotSupported { type_name } => { 26 Self::SerializationNotSupported { type_name } => {
27 writeln!(f, "Serialization for type '{type_name}' not supported") 27 writeln!(f, "Serialization for type '{type_name}' not supported")
28 } 28 }
29 StructError::DeserializationNotSupported { type_name } => { 29 Self::DeserializationNotSupported { type_name } => {
30 writeln!(f, "Deserialization for type '{type_name}' not supported") 30 writeln!(f, "Deserialization for type '{type_name}' not supported")
31 } 31 }
32 StructError::UnexpectedEOF => writeln!(f, "Unexpected EOF"), 32 Self::UnexpectedEOF => writeln!(f, "Unexpected EOF"),
33 } 33 }
34 } 34 }
35} 35}
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!(
55impl VariantIndexType { 55impl 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}