ProcList

Struct ProcList 

Source
pub struct ProcList { /* private fields */ }
Expand description

Process list. It can be viewed as a list of process or a list of process trees.

Implementations§

Source§

impl ProcList

Source

pub fn parent_of(&self, pid: Pid) -> Option<&Process>

Gets parent process’ pid of the process the pid of which is given.

Source

pub fn procs(&self) -> impl Iterator<Item = &ProcNode>

Returns all detected running processes.

§Examples
.............
.  ProcList .
.   /   \   .
.  1     4  .
. / \   / \ .
.2   3 5   6.
.............

This method will returns #1, #2, #3, #4, #5, #6.

Source

pub fn children<'a, 's: 'a>(&'s self) -> Proc<'a>

Returns all detected running process trees.

§Examples
.............
.  ProcList .
.   /   \   .
.  1     4  .
. / \   / \ .
.2   3 5   6.
.............

This method will returns #1 and #4.

Use .children() recursively to get descendant processes, e.g. #2.

Source

pub fn bfs<'a, 's: 'a>(&'s self) -> BfsForest<Splitted<Proc<'a>>>

Returns processes in breadth first search. This method helps to convert ProcList into trees::Forest.

See trees for more.

Trait Implementations§

Source§

impl Debug for ProcList

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ProcList

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for ProcList

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TupleTree<T, ()> for T

Source§

const SIZE: Size

Source§

fn descendants(_indirect_level: usize) -> usize

Source§

fn height() -> usize

Source§

fn preorder(self, f: &mut impl FnMut(Visit<T>))

Source§

fn preorder_with_size_hint(self, f: &mut impl FnMut(Visit<T>, Size))

Source§

fn postorder(self, f: &mut impl FnMut(Visit<T>))

Source§

fn postorder_with_size_hint(self, f: &mut impl FnMut(Visit<T>, Size))