Remove the Option around the pins Vec.
This commit is contained in:
		| @@ -41,7 +41,7 @@ pub struct Peripheral { | |||||||
|     #[serde(default)] |     #[serde(default)] | ||||||
|     pub clock: Option<String>, |     pub clock: Option<String>, | ||||||
|     #[serde(default)] |     #[serde(default)] | ||||||
|     pub pins: Option<Vec<Pin>>, |     pub pins: Vec<Pin>, | ||||||
| } | } | ||||||
|  |  | ||||||
| #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] | #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] | ||||||
| @@ -52,11 +52,12 @@ pub struct Pin { | |||||||
| } | } | ||||||
|  |  | ||||||
| struct BlockInfo { | struct BlockInfo { | ||||||
|  |     /// usart_v1/USART -> usart | ||||||
|     module: String, |     module: String, | ||||||
|     // usart_v1/USART -> usart |     /// usart_v1/USART -> v1 | ||||||
|     version: String, |     version: String, | ||||||
|     // usart_v1/USART -> v1 |     /// usart_v1/USART -> USART | ||||||
|     block: String,   // usart_v1/USART -> USART |     block: String, | ||||||
| } | } | ||||||
|  |  | ||||||
| impl BlockInfo { | impl BlockInfo { | ||||||
| @@ -161,8 +162,7 @@ fn main() { | |||||||
|         if let Some(block) = &p.block { |         if let Some(block) = &p.block { | ||||||
|             let bi = BlockInfo::parse(block); |             let bi = BlockInfo::parse(block); | ||||||
|  |  | ||||||
|             if let Some(pins) = &p.pins { |             for pin in &p.pins { | ||||||
|                 for pin in pins { |  | ||||||
|                 let mut row = Vec::new(); |                 let mut row = Vec::new(); | ||||||
|                 row.push(name.clone()); |                 row.push(name.clone()); | ||||||
|                 row.push(bi.module.clone()); |                 row.push(bi.module.clone()); | ||||||
| @@ -174,7 +174,6 @@ fn main() { | |||||||
|                 } |                 } | ||||||
|                 peripheral_pins_table.push(row); |                 peripheral_pins_table.push(row); | ||||||
|             } |             } | ||||||
|             } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|             cfgs.insert(bi.module.clone()); |             cfgs.insert(bi.module.clone()); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user