Crates.io | g-win |
lib.rs | g-win |
version | |
source | src |
created_at | 2024-10-30 22:11:26.639605 |
updated_at | 2025-02-02 02:43:23.849719 |
description | A winnow parser for .gcode files |
homepage | |
repository | https://github.com/mj10021/g-win/ |
max_upload_size | |
id | 1429290 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
g-win
is a G-code parsing crate for Rust, built with winnow
. It aims to maximize compatibility by preserving unrecognized commands for later processing, ensuring compatibility across environments and handling of features like macros and templating.
Preserves Unrecognized Commands: Stores any unrecognized or custom commands as strings in place.
Custom Command Handling: Easily add rules to parse any command.
Lightweight: Minimal API designed to streamline implementation.
Add g-win
to your Cargo.toml
:
[dependencies]
g-win = "0.1.0"
Then, run:
cargo build
All G-code file information is stored in the GCodeModel
struct. The parser is implemented through the FromStr
trait, returning a result of the type Result<GCodeModel, GCodeParseError>
.
use g_win::GCodeModel;
let gcode = "
G21 ; Set units to millimeters
G90 ; Absolute positioning
M107 ; Fan Off
G28 ; Home
G1 Z15.0 F9000 ; Move Z Axis up
MCustomCommand ; This is a custom command
";
let gcode: GCodeModel = gcode.parse().expect("failed to parse");
println!("{:?}", gcode);
g-win
stores unrecognized or custom commands as Command::Raw(String)
, preserving their original content.
Licensed under either of
at your option.
Contributions are welcome! Please submit a pull request or open an issue for suggestions and improvements.
Fork the repository.
Create a new branch: git checkout -b feature/your-feature-name
.
Commit your changes: git commit 'Add some feature'
.
Push to the branch: git push origin feature/your-feature-name
.
Open a pull request.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.