pub fn find_by_user(store: &impl ProcessStore, target_user: &str) -> Vec<u32>Expand description
Find all PIDs whose user matches the given string.
use proc_tree::{DefaultStore, find_by_user, ProcessStore, ProcessInfo};
let store = DefaultStore::new(0);
store.insert_process(1, ProcessInfo { ppid: 0, cmd: "init".into(), user: "root".into(), tgid: 1, start_time_ns: 0 });
store.insert_process(100, ProcessInfo { ppid: 1, cmd: "bash".into(), user: "alice".into(), tgid: 100, start_time_ns: 0 });
assert_eq!(find_by_user(&store, "root"), vec![1]);
assert_eq!(find_by_user(&store, "alice"), vec![100]);
assert_eq!(find_by_user(&store, "nobody"), Vec::<u32>::new());