Struct proc_status::ProcStatus[][src]

pub struct ProcStatus { /* fields omitted */ }

A snapshot of the status of a process

It’s stored in a string to ensure consistency and can be kept around and compared.

Implementations

impl ProcStatus[src]

pub fn read() -> Result<Self, ProcStatusError>[src]

read the proc status info of the current process.

It’s the same than ProcStatus::read(ProcRef::ProcSelf)

pub fn read_for(proc_ref: ProcRef) -> Result<Self, ProcStatusError>[src]

read the proc status info of a process.

pub fn entries(&self) -> ProcEntries<'_>

Notable traits for ProcEntries<'p>

impl<'p> Iterator for ProcEntries<'p> type Item = Result<ProcEntry<'p>, ProcStatusError>;
[src]

return an iterator over all key:value entries

pub fn entry(&self, key: &str) -> Result<ProcEntry<'_>, ProcStatusError>[src]

find an entry by name

pub fn value(&self, key: &str) -> Result<&str, ProcStatusError>[src]

return the value of an entry found by key

Example:

println!(
    "current process name: {:?}",
    proc_status::ProcStatus::read().unwrap().value("Name").unwrap(),
);

Be careful that the values written as “xxx kB” are in KiB, not kB, and are written this way for compatibility.

pub fn value_KiB(&self, key: &str) -> Result<usize, ProcStatusError>[src]

return the value of a memory related entry in KiB

pub fn mem_usage(&self) -> Result<MemUsage, ProcStatusError>[src]

return the current and peak ram usage of the process

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.