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.
1 parent 45301d5 commit a5fecedCopy full SHA for a5feced
src/main.rs
@@ -41,17 +41,17 @@ fn main() {
41
}
42
43
Some(pattern) => {
44
- for peripheral in &d.peripherals {
45
- if peripheral.name.to_ascii_lowercase().contains(&pattern) {
46
- println!("{}",
47
- svd2rust::gen_peripheral(peripheral, &d.defaults)
48
- .iter()
49
- .map(|i| i.to_string())
50
- .collect::<Vec<_>>()
51
- .join("\n\n"));
+ if let Some(peripheral) = d.peripherals
+ .iter()
+ .find(|x| x.name.to_ascii_lowercase() == pattern)
+ .or(d.peripherals.iter().find(|x| x.name.to_ascii_lowercase().contains(&pattern))) {
+ println!("{}",
+ svd2rust::gen_peripheral(peripheral, &d.defaults)
+ .map(|i| i.to_string())
52
+ .collect::<Vec<_>>()
53
+ .join("\n\n"));
54
- break;
- }
55
56
57
0 commit comments