Expand description
§binarygcode
A no_std
+ alloc
rust library and binary (CLI) to deserialise and serialise binary gcode (.bgcode
) files. The binary gcode specification can be found here.
§Support
Please consider supporting the crate by:
- Downloading and using the crate.
- Raising issues and improvements on the GitHub repo.
- Recommending the crate to others.
- ⭐ the crate on GitHub.
- Sponsoring the maintainer.
§Example
Examples can be found in the examples
folder. Below is an example of reading the headers
use std::{env, fs};
use binarygcode::binary_to_ascii;
fn main() {
// Create the path to the gcode file
let mut path = env::current_dir().unwrap();
path.push("test_files");
path.push("mini_cube_b.bgcode");
let binary = fs::read(path).unwrap();
let gcode = binary_to_ascii(&binary, true).unwrap();
println!(
"Binary Length: {}, ASCII Lenght: {}",
binary.len(),
gcode.len()
);
fs::write("tmp/ascii.gcode", gcode.as_ref()).unwrap();
}
§References
Structs§
- Deserialised
Block - A struct representing a deserialised binary gcode block.
- Deserialised
File Header - A struct containing the header details of the bgcode.
- Deserialiser
- A binarygcode deserialiser that can parse a bgcode file. It can digest data in chunks and returns header and blocks when available. The block remain compressed so the user can decide which ones they which to decompress.
Enums§
- Binary
Gcode Error - An enum of errors that can occur when using the crate.
- Block
Kind - Defines the various kinds of block that are in the binary gcode specification.
- Checksum
- The valid checksums for the binary gcode format.
- Deserialised
Result - The possible outputs from a call to deserialise().
Functions§
- ascii_
to_ binary - Returns a bgcode from an ascii binary
- binary_
to_ ascii - Provide a reference to a u8 slice of the entire binary file you would like to decode.
- serialise_
block - Serialise a gcode block.
- serialise_
file_ header