Skip to main content

tree_len

Function tree_len 

Source
pub fn tree_len(tree: &impl TreeStore) -> u64
Expand description

Get the number of entries in the tree.

use proc_tree::{DefaultTree, tree_len, TreeStore, PidNode};

let tree = DefaultTree::new(100, 0);
assert_eq!(tree_len(&tree), 0);

tree.insert_node(1, PidNode { ppid: 0, cmd: "init".into() });
tree.insert_node(2, PidNode { ppid: 1, cmd: "bash".into() });
assert_eq!(tree_len(&tree), 2);