Function wraited_struct::read[][src]

pub unsafe fn read<T, R: Read>(reader: &mut R) -> Result<T>

Read T with byte array

Example

extern crate wraited_struct;
use std::fs::File;

#[derive(Debug)]
struct Something {
    a: u8,
    b: u16,
    c: u32,
}

fn main() {
    let mut file = File::open("something.bin").unwrap();
    let something = wraited_struct::read::<Something, File>(&mut file).unwrap();
    println!("{:?}", something);
}