heim_process/pids.rs
1use heim_common::prelude::{Future, Stream};
2
3use crate::{sys, Pid, ProcessError};
4
5/// Returns stream which yields [Pid]s of processes currently running in the system.
6///
7/// Consequent calls are not guaranteed to return pids in the same order.
8///
9/// [Pid]: type.Pid.html
10pub fn pids() -> impl Stream<Item = Result<Pid, ProcessError>> {
11 sys::pids()
12}
13
14/// Returns future which checks if process with passed `pid` is exists.
15pub fn pid_exists(pid: Pid) -> impl Future<Output = Result<bool, ProcessError>> {
16 sys::pid_exists(pid)
17}