byteorder-pack 0.1.0

A binary data reader and writer that is similar to Python's struct module
Documentation
  • Coverage
  • 100%
    11 out of 11 items documented7 out of 7 items with examples
  • Size
  • Source code size: 12.43 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 568.31 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • kmod-midori/byteorder-pack
    0 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • kmod-midori

byteorder-pack

A binary data reader and writer that is similar to Python's struct module, but makes use of Rust's typing system.

Example

use std::io::Cursor;
use byteorder_pack::UnpackFrom;

let mut cursor = Cursor::new(vec![0x01, 0x02, 0x00, 0x03, 0x00, 0x04]);

let (a, b, cd) = <(u8, u8, [u16; 2])>::unpack_from_be(&mut cursor).unwrap();

assert_eq!(a, 1);
assert_eq!(b, 2);
assert_eq!(cd, [3, 4]);