[librsvg/librsvg-2.46] Turn AcquiredNode into a real struct, not a tuple struct
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.46] Turn AcquiredNode into a real struct, not a tuple struct
- Date: Tue, 15 Oct 2019 16:47:38 +0000 (UTC)
commit 653a4b46c027d350b904f28b1a4836a6832a4356
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Oct 15 08:32:24 2019 -0500
Turn AcquiredNode into a real struct, not a tuple struct
rsvg_internals/src/drawing_ctx.rs | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index 09022295..a6ccc824 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -1068,19 +1068,22 @@ impl From<RsvgRectangle> for cairo::Rectangle {
}
}
-pub struct AcquiredNode(Rc<RefCell<NodeStack>>, RsvgNode);
+pub struct AcquiredNode {
+ stack: Rc<RefCell<NodeStack>>,
+ node: RsvgNode,
+}
impl Drop for AcquiredNode {
fn drop(&mut self) {
- let mut stack = self.0.borrow_mut();
+ let mut stack = self.stack.borrow_mut();
let last = stack.pop().unwrap();
- assert!(last == self.1);
+ assert!(last == self.node);
}
}
impl AcquiredNode {
pub fn get(&self) -> &RsvgNode {
- &self.1
+ &self.node
}
}
@@ -1137,7 +1140,10 @@ impl AcquiredNodes {
Err(AcquireError::CircularReference(fragment.clone()))
} else {
self.node_stack.borrow_mut().push(&node);
- let acquired = AcquiredNode(self.node_stack.clone(), node.clone());
+ let acquired = AcquiredNode {
+ stack: self.node_stack.clone(),
+ node: node.clone()
+ };
Ok(acquired)
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]