Skip to content

Commit f05ea77

Browse files
committed
lib v0.2.3: newline_before_comment support
1 parent 6a1e23f commit f05ea77

4 files changed

Lines changed: 41 additions & 9 deletions

File tree

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "svg2gcode"
3-
version = "0.2.2"
3+
version = "0.2.3"
44
authors = ["Sameer Puri <crates@purisa.me>"]
55
edition = "2021"
66
description = "Convert paths in SVG files to GCode for a pen plotter, laser engraver, or other machine."

lib/src/lib.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,4 +305,33 @@ mod test {
305305
"#;
306306
serde_json::from_str::<Settings>(json).unwrap();
307307
}
308+
309+
#[test]
310+
#[cfg(feature = "serde")]
311+
fn deserialize_v4_config_succeeds() {
312+
let json = r#"
313+
{
314+
"conversion": {
315+
"tolerance": 0.002,
316+
"feedrate": 300.0,
317+
"dpi": 96.0
318+
},
319+
"machine": {
320+
"supported_functionality": {
321+
"circular_interpolation": true
322+
},
323+
"tool_on_sequence": null,
324+
"tool_off_sequence": null,
325+
"begin_sequence": null,
326+
"end_sequence": null
327+
},
328+
"postprocess": {
329+
"checksums": false,
330+
"line_numbers": false,
331+
"newline_before_comment": false
332+
}
333+
}
334+
"#;
335+
serde_json::from_str::<Settings>(json).unwrap();
336+
}
308337
}

lib/src/postprocess.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ pub struct PostprocessConfig {
1010
/// Convenience field for [g_code::emit::FormatOptions] field
1111
#[cfg_attr(feature = "serde", serde(default))]
1212
pub line_numbers: bool,
13+
/// Convenience field for [g_code::emit::FormatOptions] field
14+
#[cfg_attr(feature = "serde", serde(default))]
15+
pub newline_before_comment: bool,
1316
}

0 commit comments

Comments
 (0)