rsm, ibb: Write and use a macro to parse attributes.
This commit is contained in:
parent
16899f8c23
commit
3c083709cb
3 changed files with 34 additions and 25 deletions
|
|
@ -61,10 +61,7 @@ impl<'a> TryFrom<&'a Element> for Set {
|
|||
if set.first.is_some() {
|
||||
return Err(Error::ParseError("Set can’t have more than one first."));
|
||||
}
|
||||
set.first_index = match child.attr("index") {
|
||||
Some(index) => Some(index.parse()?),
|
||||
None => None,
|
||||
};
|
||||
set.first_index = get_attr!(child, "index", optional, index, index.parse()?);
|
||||
set.first = Some(child.text());
|
||||
} else if child.is("index", ns::RSM) {
|
||||
if set.index.is_some() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue