Skip to main content

tree_len

Function tree_len 

Source
pub fn tree_len(store: &impl ProcessStore) -> usize
Expand description

Get the number of entries in the store.

use proc_tree::{DefaultStore, tree_len, ProcessStore, ProcessInfo};

let store = DefaultStore::new(0);
assert_eq!(tree_len(&store), 0);

store.insert_process(1, ProcessInfo { ppid: 0, cmd: "init".into(), user: "root".into(), tgid: 1, start_time_ns: 0 });
store.insert_process(2, ProcessInfo { ppid: 1, cmd: "bash".into(), user: "root".into(), tgid: 2, start_time_ns: 0 });
assert_eq!(tree_len(&store), 2);