Add total_node_count method to Taffy struct
Semantic delta · 1
src/node.rs
- new fn total_node_count pub
1 files · +5 −0
- src/node.rs +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())