/// Filter to processes that match the condition
///
/// The condition is:
///
/// * Does not match me or my parent process
/// * Does match the regex, if it is present
/// * Does match *any* of the states
Filter to processes that match the condition
The condition is.

Does not match me or my parent process
Does match the regex, if it is present
Does match *any* of the states
Filter to processes that match the condition The condition is . Does not match me or my parent process Does match the regex if it is present Does match * any * of the states
fn filter_procs<'m>(
    re: &Option<Regex>,
    states: &[State],
    procs: &'m ProcMap,
) -> Vec<(&'m Pid, &'m Process)> {
    let me = getpid();
    let parent = getppid();
    debug!("filtering for procs that match: {:?} {:?}", re, states);
    procs
        .iter()
        .filter(|&(pid, _process)| *pid != me && *pid != parent)
        .filter(|&(_pid, process)| states.is_empty() || states.contains(&process.stat.state))
        .filter(|&(_pid, process)| {
            re.as_ref()
                .map(|re| {
                    let cmdline = process.useful_cmdline();
                    let is_match = re.is_match(&cmdline);
                    trace!("is_match={} process={}", is_match, cmdline);
                    is_match
                })
                .unwrap_or(true)
        })
        .collect()
}
fn filter_procs < ' m > ( re : & Option < Regex > , states : & [ State ] , procs : & ' m ProcMap , ) -> Vec < ( & ' m Pid , & ' m Process ) > { let me = getpid ( ) ; let parent = getppid ( ) ; debug ! ( " " re states ) ; procs . iter ( ) . filter ( | & ( pid , _process ) | * pid != me && * pid != parent ) . filter ( | & ( _pid , process ) | states . is_empty ( ) || states . contains ( & process . stat . state ) ) . filter ( | & ( _pid , process ) | { re . as_ref ( ) . map ( | re | { let cmdline = process . useful_cmdline ( ) ; let is_match = re . is_match ( & cmdline ) ; trace ! ( " " is_match cmdline ) ; is_match } ) . unwrap_or ( true ) } ) . collect ( ) }
Filter to processes that match the condition
The condition is:
Filter to processes that match the condition The condition is :
re
&Option<Regex>
states
&[State]
procs
&'m ProcMap