Struct Pid

Source
pub struct Pid {
    pub fds: Vec<PidFd>,
    pub nss: Vec<PidNs>,
}

Fields§

§fds: Vec<PidFd>§nss: Vec<PidNs>

Implementations§

Source§

impl Pid

Source

pub fn from_file<P>(path: P) -> Pid
where P: AsRef<Path>,

Examples found in repository?
examples/pid.rs (line 15)
4fn main() {
5    env_logger::init();
6    // let mut pids = Vec::default();
7    for entry in fs::read_dir("/proc").unwrap() {
8        let name = entry.unwrap();
9
10        if name.file_name().to_string_lossy().parse::<u32>().is_ok() {
11            // pids.push(Pid::from_file(name.path()).unwrap());
12            println!(
13                "{:?}: {:?}",
14                name.path(),
15                Pid::from_file(name.path())
16            );
17        }
18    }
19}

Trait Implementations§

Source§

impl Debug for Pid

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Pid

§

impl RefUnwindSafe for Pid

§

impl Send for Pid

§

impl Sync for Pid

§

impl Unpin for Pid

§

impl UnwindSafe for Pid

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, 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.