Skip to content

Commit 69d9d9a

Browse files
authored
Merge pull request #217 from cameleon-rs/dependabot/cargo/roxmltree-0.21.1
Update roxmltree requirement from 0.15.0 to 0.21.1
2 parents 438096c + a62f554 commit 69d9d9a

File tree

3 files changed

+5
-29
lines changed

3 files changed

+5
-29
lines changed

genapi/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ keywords = ["genicam", "camera", "genapi"]
1616
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1717

1818
[dependencies]
19-
roxmltree = "0.15.0"
19+
roxmltree = "0.21.1"
2020
thiserror = "2.0.18"
2121
string-interner = "0.19.0"
2222
auto_impl = "1.0.1"

genapi/src/parser/port.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ mod tests {
6868
<Port Name="TestNode">
6969
<ChunkID>Fd3219</ChunkID>
7070
<SwapEndianess>Yes</SwapEndianess>
71-
<Port>
71+
</Port>
7272
"#;
7373

7474
let (node, ..): (PortNode, _, _, _) = parse_default(xml);
@@ -81,7 +81,7 @@ mod tests {
8181
let xml = r#"
8282
<Port Name="TestNode">
8383
<pChunkID>Fd3219</pChunkID>
84-
<Port>
84+
</Port>
8585
"#;
8686

8787
let (node, mut node_builder, ..): (PortNode, _, _, _) = parse_default(xml);
@@ -96,7 +96,7 @@ mod tests {
9696
let xml = r#"
9797
<Port Name="TestNode">
9898
<CacheChunkData>Yes</CacheChunkData>
99-
<Port>
99+
</Port>
100100
"#;
101101

102102
let (node, ..): (PortNode, _, _, _) = parse_default(xml);

genapi/src/parser/xml.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ impl<'input> Document<'input> {
3131
pub(super) struct Node<'a, 'input> {
3232
inner: roxmltree::Node<'a, 'input>,
3333
children: Peekable<roxmltree::Children<'a, 'input>>,
34-
attributes: Attributes<'a, 'input>,
3534
src: &'input str,
3635
}
3736

@@ -112,7 +111,7 @@ impl<'a, 'input> Node<'a, 'input> {
112111
}
113112

114113
pub(super) fn attribute_of(&self, name: &str) -> Option<&str> {
115-
self.attributes.attribute_of(name)
114+
self.inner.attribute(name)
116115
}
117116

118117
pub(super) fn text(&self) -> TextView<'a, 'input> {
@@ -122,12 +121,9 @@ impl<'a, 'input> Node<'a, 'input> {
122121
fn from_xmltree_node(node: roxmltree::Node<'a, 'input>, src: &'input str) -> Self {
123122
debug_assert!(node.node_type() == roxmltree::NodeType::Element);
124123
let children = node.children().peekable();
125-
let attributes = Attributes::from_xmltree_attrs(node.attributes());
126-
127124
Self {
128125
inner: node,
129126
children,
130-
attributes,
131127
src,
132128
}
133129
}
@@ -141,26 +137,6 @@ impl fmt::Debug for Node<'_, '_> {
141137
}
142138
}
143139

144-
struct Attributes<'a, 'input> {
145-
attrs: &'a [roxmltree::Attribute<'input>],
146-
}
147-
148-
impl<'a, 'input> Attributes<'a, 'input> {
149-
fn from_xmltree_attrs(attrs: &'a [roxmltree::Attribute<'input>]) -> Self {
150-
Self { attrs }
151-
}
152-
153-
fn attribute_of(&self, name: &str) -> Option<&str> {
154-
self.attrs.iter().find_map(|attr| {
155-
if attr.name() == name {
156-
Some(roxmltree::Attribute::value(attr))
157-
} else {
158-
None
159-
}
160-
})
161-
}
162-
}
163-
164140
pub(super) struct TextView<'a, 'input> {
165141
inner: roxmltree::Node<'a, 'input>,
166142
}

0 commit comments

Comments
 (0)