File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,23 @@ pub struct Peripheral {
178
178
}
179
179
180
180
impl Peripheral {
181
+ pub fn derive_from ( & self , other : & Peripheral ) -> Peripheral {
182
+ let mut derived = self . clone ( ) ;
183
+ if derived. group_name . is_none ( ) && other. group_name . is_some ( ) {
184
+ derived. group_name = other. group_name . clone ( ) ;
185
+ }
186
+ if derived. description . is_none ( ) && other. description . is_some ( ) {
187
+ derived. description = other. description . clone ( ) ;
188
+ }
189
+ if derived. registers . is_none ( ) && other. registers . is_some ( ) {
190
+ derived. registers = other. registers . clone ( ) ;
191
+ }
192
+ if derived. interrupt . is_empty ( ) {
193
+ derived. interrupt = other. interrupt . clone ( ) ;
194
+ }
195
+ derived
196
+ }
197
+
181
198
fn parse ( tree : & Element ) -> Peripheral {
182
199
assert_eq ! ( tree. name, "peripheral" ) ;
183
200
You can’t perform that action at this time.
0 commit comments