Remove last use of byteorder crate

This commit is contained in:
2024-03-09 23:29:51 -08:00
parent 59221648ca
commit 2d9fce3f59
3 changed files with 1 additions and 11 deletions
+1 -3
View File
@@ -1,4 +1,3 @@
use byteorder::{ByteOrder, LittleEndian};
use nom::{
bytes::complete::take,
number::complete::{le_i16, le_u8},
@@ -43,8 +42,7 @@ impl World {
header: Vec::from(&bytes[0..512]),
boards: vec![],
};
// TODO: Remove LittleEndian entirely?
let num_boards = 1 + LittleEndian::read_u16(&world.header[2..4]);
let num_boards = 1 + u16::from_le_bytes((&world.header[2..4]).try_into().unwrap());
let mut offset = world.header.len();
for _ in 0..num_boards {
// Ideally, this wouldn't panic if we run out of bytes