gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 10TOML 3CSS 1348 Definiciones

Add total_node_count method to Taffy struct

c2db86dfc600067c6f4d70c8ea398cbcc5d42dbd · por Nico Burns · (hace 2 años) · padre 61b253745 · ver el árbol en este commit

Delta semántico · 1

src/node.rs

1 archivos · +5 −0

diff --git a/src/node.rs b/src/node.rs
index d4789c09a..6bfd85797 100644
--- a/src/node.rs
+++ b/src/node.rs
@@ -350,6 +350,11 @@ impl Taffy {
         Ok(self.children[parent][child_index])
     }
 
+    /// Returns the total number of nodes in the tree
+    pub fn total_node_count(&self) -> usize {
+        self.nodes.len()
+    }
+
     /// Returns the number of children of the `parent` [`Node`]
     pub fn child_count(&self, parent: Node) -> TaffyResult<usize> {
         Ok(self.children[parent].len())