1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
use heim_common::prelude::{Future, Stream};

use crate::{sys, Pid, ProcessError};

/// Returns stream which yields [Pid]s of processes currently running in the system.
///
/// Consequent calls are not guaranteed to return pids in the same order.
///
/// [Pid]: type.Pid.html
pub fn pids() -> impl Stream<Item = Result<Pid, ProcessError>> {
    sys::pids()
}

/// Returns future which checks if process with passed `pid` is exists.
pub fn pid_exists(pid: Pid) -> impl Future<Output = Result<bool, ProcessError>> {
    sys::pid_exists(pid)
}