svd_parser/
interrupt.rs

1use super::*;
2use crate::svd::Interrupt;
3
4impl Parse for Interrupt {
5    type Object = Self;
6    type Error = SVDErrorAt;
7    type Config = Config;
8
9    fn parse(tree: &Node, config: &Self::Config) -> Result<Self, Self::Error> {
10        if !tree.has_tag_name("interrupt") {
11            return Err(SVDError::NotExpectedTag("interrupt".to_string()).at(tree.id()));
12        }
13        let name = tree.get_child_text("name")?;
14
15        Interrupt::builder()
16            .name(name)
17            .description(tree.get_child_text_opt("description")?)
18            .value(tree.get_child_u32("value")?)
19            .build(config.validate_level)
20            .map_err(|e| SVDError::from(e).at(tree.id()))
21    }
22}