1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use super::*;
use crate::svd::{Access, Protection, RegisterProperties};

impl Parse for RegisterProperties {
    type Object = Self;
    type Error = SVDErrorAt;
    type Config = Config;

    fn parse(tree: &Node, config: &Self::Config) -> Result<Self, Self::Error> {
        RegisterProperties::new()
            .size(optional::<u32>("size", tree, &())?)
            .access(optional::<Access>("access", tree, config)?)
            .protection(optional::<Protection>("protection", tree, config)?)
            .reset_value(optional::<u64>("resetValue", tree, &())?)
            .reset_mask(optional::<u64>("resetMask", tree, &())?)
            .build(config.validate_level)
            .map_err(|e| SVDError::from(e).at(tree.id()))
    }
}