use zerocopy::FromBytes;
use zerocopy::AsBytes;
// use zerocopy::Unaligned;
use zerocopy::LayoutVerified;
use std::ops::Deref;

#[derive(FromBytes, AsBytes, Debug)]
#[repr(C)]
struct Header {
    name: [u8; 4],
    size: u32,
    reserved: u64,
}

pub fn run_main() {
    let h = Header {
        name: [1,2,3,4],
        size: 0xabcdef,
        reserved: 0x0123456789abcdef,
    };
    println!("{:?}", h.as_bytes());
    let h2: Option<LayoutVerified<&[u8], [Header]>> = LayoutVerified::new_slice(h.as_bytes());
    println!("{:?}", h2.unwrap().deref()[0]);
}
