We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4a03b42 + a9a9d82 commit 20f2ba0Copy full SHA for 20f2ba0
src/lib.rs
@@ -178,6 +178,17 @@ pub struct Peripheral {
178
}
179
180
impl Peripheral {
181
+ pub fn derive_from(&self, other: &Peripheral) -> Peripheral {
182
+ let mut derived = self.clone();
183
+ derived.group_name = derived.group_name.or(other.group_name.clone());
184
+ derived.description = derived.description.or(other.description.clone());
185
+ derived.registers = derived.registers.or(other.registers.clone());
186
+ if derived.interrupt.is_empty() {
187
+ derived.interrupt = other.interrupt.clone();
188
+ }
189
+ derived
190
191
+
192
fn parse(tree: &Element) -> Peripheral {
193
assert_eq!(tree.name, "peripheral");
194
0 commit comments