[][src]Trait pwner::Process

pub trait Process: Drop {
#[must_use]    fn id(&self) -> Option<u32>;
}

The trait returned by Spawner::spawn_owned().

All implementations of Spawner must return a concrete instance capable of read/write.

Required methods

#[must_use]fn id(&self) -> Option<u32>

Returns the OS-assigned process identifier associated with this child.

Examples

Basic usage:

use std::process::Command;
use pwner::{ Spawner, Process };

let mut command = Command::new("ls");
if let Ok(child) = command.spawn_owned() {
    match child.id() {
      Some(pid) => println!("Child's ID is {}", pid),
      None => println!("Child has already exited"),
    }
} else {
    println!("ls command didn't start");
}
Loading content...

Implementors

impl Process for pwner::process::Process[src]

#[must_use]fn id(&self) -> Option<u32>[src]

Returns the OS-assigned process identifier associated with this child.

Examples

Basic usage:

use std::process::Command;
use pwner::{ Spawner, Process };

let mut command = Command::new("ls");
if let Ok(child) = command.spawn_owned() {
    match child.id() {
      Some(pid) => println!("Child's ID is {}", pid),
      None => println!("Child has already exited"),
    }
} else {
    println!("ls command didn't start");
}

impl Process for pwner::tokio::Process[src]

#[must_use]fn id(&self) -> Option<u32>[src]

Returns the OS-assigned process identifier associated with this child.

Examples

Basic usage:

use tokio::process::Command;
use pwner::{ Spawner, Process };

let mut command = Command::new("ls");
if let Ok(child) = command.spawn_owned() {
    match child.id() {
      Some(pid) => println!("Child's ID is {}", pid),
      None => println!("Child has already exited"),
    }
} else {
    println!("ls command didn't start");
}
Loading content...