wraited-struct 0.2.0

Read and write `struct` with byte array
Documentation
  • Coverage
  • 66.67%
    2 out of 3 items documented2 out of 2 items with examples
  • Size
  • Source code size: 4.01 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.04 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • anekos

wraited-struct

Read and write struct

Usage

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

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

fn main() {
    let mut file = File::create("customer.bin").unwrap();
    wraited_struct::write::<Something, File>(&mut file, Something { a: 97, b: 98, c: 99 }).unwrap();

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