Skip to content

Commit c9d920a

Browse files
committed
Refactor and document generator.rs
* Refactored generator.rs and added some documentation. * Existing function order left unchanged where possible to ease review. New or refactored code follows the newspaper metaphor: high-level logic first, supporting details and helpers later.
1 parent 854e104 commit c9d920a

File tree

2 files changed

+265
-209
lines changed

2 files changed

+265
-209
lines changed

stm32-data-gen/src/chips.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ pub struct ChipGroup {
7272
pub xml: xml::Mcu,
7373
pub ips: HashMap<String, xml::Ip>,
7474
pub pins: HashMap<String, xml::Pin>,
75-
pub family: Option<String>,
76-
pub line: Option<String>,
77-
pub die: Option<String>,
75+
pub family: String,
76+
pub line: String,
77+
pub die: String,
7878
}
7979

8080
fn chip_name_from_package_name(x: &str) -> String {
@@ -211,9 +211,9 @@ fn parse_group(
211211
xml: parsed.clone(),
212212
ips: HashMap::new(),
213213
pins: HashMap::new(),
214-
family: None,
215-
line: None,
216-
die: None,
214+
family: parsed.family.clone(),
215+
line: parsed.line.clone(),
216+
die: parsed.die.clone(),
217217
});
218218
group_idx
219219
});

0 commit comments

Comments
 (0)