2020-12-15 17:33:25 +05:30
|
|
|
use nom::IResult;
|
|
|
|
use std::convert::TryInto;
|
|
|
|
|
|
|
|
use crate::pdata::unpack::*;
|
|
|
|
|
|
|
|
//------------------------------------------
|
|
|
|
|
|
|
|
#[derive(Clone, Copy)]
|
2021-03-04 16:43:08 +05:30
|
|
|
pub struct Hint {
|
|
|
|
pub hint: [u8; 4],
|
2020-12-15 17:33:25 +05:30
|
|
|
}
|
|
|
|
|
2021-03-04 16:43:08 +05:30
|
|
|
impl Unpack for Hint {
|
2020-12-15 17:33:25 +05:30
|
|
|
fn disk_size() -> u32 {
|
2021-03-04 16:43:08 +05:30
|
|
|
4
|
2020-12-15 17:33:25 +05:30
|
|
|
}
|
|
|
|
|
2021-03-04 16:43:08 +05:30
|
|
|
fn unpack(i: &[u8]) -> IResult<&[u8], Hint> {
|
|
|
|
let size = 4;
|
2020-12-15 17:33:25 +05:30
|
|
|
Ok((
|
|
|
|
&i[size..],
|
|
|
|
Hint {
|
|
|
|
hint: i[0..size].try_into().unwrap(),
|
|
|
|
},
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------
|