binary-rs

Crate GitHub Workflow Status Coverage Status

A binary reader/writer for the rust language, with a similar syntax to the C# BinaryWriter and BinaryReader

Examples

Example code for reading

```rust extern crate binaryrw; use binaryrw::{ filestream::{Filestream, OpenType}, BinaryReader };

fn main() { let mut fs = Filestream::new("test.bin", OpenType::Open).expect("Failed to open file"); let mut binary_file = BinaryReader::new(&mut fs);

let readvalue = binaryfile.readf32().expect("Failed to read f32"); println!("{:?}", readvalue); } ```

Example code for writing ```rust extern crate binaryrw; use binaryrw::{ filestream::{Filestream, OpenType}, BinaryReader };

fn main() { let mut fs = Filestream::new("test.bin", OpenType::OpenAndCreate).expect("Failed to open file"); let mut binary_file = BinaryWriter::new(&mut fs);

let value: f32 = 30.5; binaryfile.writef32(value).expect("Failed to write f32"); } ```

TODO