Skip to content

Commit f30e86b

Browse files
authored
Merge pull request #242 from rust-embedded/sugar
Sugar for _split and _merge
2 parents 7e46093 + 72f2f3d commit f30e86b

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG-rust.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ This changelog tracks the Rust `svdtools` project. See
55

66
## [Unreleased]
77

8+
* Sugar for simple `_split` and `_merge`
9+
810
## [v0.3.18] 2024-08-10
911

1012
* Replace `yaml-rust` with `yaml-rust2`. Check for duplicate keys and other YAML parse errors

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ _rebase:
255255
ARRAY*:
256256
name: NEW_NAME%s
257257
_modify:
258-
FIELD: [MINIMUM, MAXIMUM]
259258
FIELD:
260259
description: NEWDESC
261260
OTHER_ARRAY*: {}

src/patch/register.rs

+8
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ impl RegisterExt for Register {
203203
.with_context(|| format!("Merging fields matched to `{fspec}`"))?;
204204
}
205205
}
206+
Some(Yaml::String(fspec)) => {
207+
self.merge_fields(fspec, None, &rpath)
208+
.with_context(|| format!("Merging fields matched to `{fspec}`"))?;
209+
}
206210
_ => {}
207211
}
208212

@@ -222,6 +226,10 @@ impl RegisterExt for Register {
222226
.with_context(|| format!("Splitting fields matched to `{fspec}`"))?;
223227
}
224228
}
229+
Some(Yaml::String(fspec)) => {
230+
self.split_fields(fspec, &Hash::new(), &rpath)
231+
.with_context(|| format!("Splitting fields matched to `{fspec}`"))?;
232+
}
225233
_ => {}
226234
}
227235

0 commit comments

Comments
 (0)