cleaned
This commit is contained in:
parent
9c1f66d5dc
commit
98516bcc9d
@ -1,4 +1,4 @@
|
|||||||
use std::fmt::{write, Display};
|
use std::fmt::Display;
|
||||||
use crc::Crc;
|
use crc::Crc;
|
||||||
|
|
||||||
use crate::chunk_type::ChunkType;
|
use crate::chunk_type::ChunkType;
|
||||||
@ -82,6 +82,7 @@ impl TryFrom<&[u8]> for Chunk {
|
|||||||
value[2],
|
value[2],
|
||||||
value[3]
|
value[3]
|
||||||
];
|
];
|
||||||
|
|
||||||
let length_from_slice: u32 = u32::from_be_bytes(length_slice);
|
let length_from_slice: u32 = u32::from_be_bytes(length_slice);
|
||||||
|
|
||||||
let chunk_type_slice: [u8; 4] = [
|
let chunk_type_slice: [u8; 4] = [
|
||||||
@ -90,6 +91,7 @@ impl TryFrom<&[u8]> for Chunk {
|
|||||||
value[6],
|
value[6],
|
||||||
value[7]
|
value[7]
|
||||||
];
|
];
|
||||||
|
|
||||||
let chunk_type_from_slice: ChunkType = ChunkType::try_from(chunk_type_slice).unwrap();
|
let chunk_type_from_slice: ChunkType = ChunkType::try_from(chunk_type_slice).unwrap();
|
||||||
|
|
||||||
let mut chunk_data_vec: Vec<u8> = Vec::new();
|
let mut chunk_data_vec: Vec<u8> = Vec::new();
|
||||||
@ -129,9 +131,6 @@ impl TryFrom<&[u8]> for Chunk {
|
|||||||
} else {
|
} else {
|
||||||
Ok(chunk)
|
Ok(chunk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user