gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 8TOML 3CSS 1317 Sutichaykuna

Add total_node_count method to Taffy struct

c2db86dfc600067c6f4d70c8ea398cbcc5d42dbd · ruwaq Nico Burns · (2 wata ñawpaq) · tayta 61b253745 · kay commitpi sach'ata qhaway

Semántico sayk'uy · 1

src/node.rs

1 qillqakuna · +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())