tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 5544Rust 88Markdown 11TOML 91926 Definiciones

Add `TaffyTree.get_node_context` function (get immutable ref to context)

b63c2ae07043a077af961ec863b5a89b16b704d5 · por Nico Burns · (hace 2 años) · padre 9d3f2ba06 · ver el árbol en este commit

Delta semántico · 1

src/tree/taffy_tree.rs

1 archivos · +6 −1

diff --git a/src/tree/taffy_tree.rs b/src/tree/taffy_tree.rs
index 9a97faacf..4692944ff 100644
--- a/src/tree/taffy_tree.rs
+++ b/src/tree/taffy_tree.rs
@@ -344,7 +344,12 @@ impl<NodeContext> TaffyTree<NodeContext> {
         Ok(())
     }
 
-    /// Get's a mutable reference to the the context data associated with the node
+    /// Gets a reference to the the context data associated with the node
+    pub fn get_node_context(&self, node: NodeId) -> Option<&NodeContext> {
+        self.node_context_data.get(node.into())
+    }
+
+    /// Gets a mutable reference to the the context data associated with the node
     pub fn get_node_context_mut(&mut self, node: NodeId) -> Option<&mut NodeContext> {
         self.node_context_data.get_mut(node.into())
     }