1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
pub const TOC_ENTRY_SIZE: usize = 96;
#[repr(C)]
pub struct RawTocEntry {
pub cache_offset: i64,
pub timestamp: i64,
pub comp_len: i32,
pub len: i32,
pub reserved: i32,
pub parent_dir_index: i32,
pub name: [u8; 64],
}
impl From<&[u8; TOC_ENTRY_SIZE]> for RawTocEntry {
fn from(bytes: &[u8; TOC_ENTRY_SIZE]) -> Self {
Self {
cache_offset: i64::from_le_bytes(bytes[0..8].try_into().unwrap()),
timestamp: i64::from_le_bytes(bytes[8..16].try_into().unwrap()),
comp_len: i32::from_le_bytes(bytes[16..20].try_into().unwrap()),
len: i32::from_le_bytes(bytes[20..24].try_into().unwrap()),
reserved: i32::from_le_bytes(bytes[24..28].try_into().unwrap()),
parent_dir_index: i32::from_le_bytes(bytes[28..32].try_into().unwrap()),
name: bytes[32..96].try_into().unwrap(),
}
}
}