This commit is contained in:
clizia 2024-11-11 16:50:37 +01:00
parent 9c1f66d5dc
commit 98516bcc9d

View File

@ -1,4 +1,4 @@
use std::fmt::{write, Display};
use std::fmt::Display;
use crc::Crc;
use crate::chunk_type::ChunkType;
@ -82,6 +82,7 @@ impl TryFrom<&[u8]> for Chunk {
value[2],
value[3]
];
let length_from_slice: u32 = u32::from_be_bytes(length_slice);
let chunk_type_slice: [u8; 4] = [
@ -90,6 +91,7 @@ impl TryFrom<&[u8]> for Chunk {
value[6],
value[7]
];
let chunk_type_from_slice: ChunkType = ChunkType::try_from(chunk_type_slice).unwrap();
let mut chunk_data_vec: Vec<u8> = Vec::new();
@ -129,9 +131,6 @@ impl TryFrom<&[u8]> for Chunk {
} else {
Ok(chunk)
}
}
}