Process

Struct Process 

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

Represent a process in a POSIX system.

Implementations§

Source§

impl Process

Source

pub fn from_pid(pid: ProcessId) -> Process

Creates a process from a provided id. The process does not have to exists at the time of creation. But all other methods may fail when the process does not exist.

Source

pub fn from_self() -> Process

Create a process object from own process.

Source

pub fn from_parent() -> Process

Create a process object from the parents process.

Source

pub fn is_alive(&self) -> bool

Checks if the process is still alive

Source

pub fn id(&self) -> ProcessId

Returns the id of the process.

Source

pub fn executable(&self) -> Result<FilePath, ProcessExecutablePathError>

Returns the executable path of the Process.

Source

pub fn send_signal(&self, signal: Signal) -> Result<(), ProcessSendSignalError>

Sends a signal to the process.

Source

pub fn get_priority(&self) -> Result<u8, ProcessGetSchedulerError>

Returns the priority of the process. 0 is the lowest and 255 the highest priority.

Source

pub fn set_priority( &mut self, priority: u8, ) -> Result<(), ProcessGetSchedulerError>

Set the priority of the process. 0 is the lowest priority and 255 the highest.

Source

pub fn get_scheduler(&self) -> Result<Scheduler, ProcessGetSchedulerError>

Returns the currently in use Scheduler by the process.

Source

pub fn set_scheduler( &mut self, scheduler: Scheduler, ) -> Result<Scheduler, ProcessSetSchedulerError>

Sets a new Scheduler for the process and returns the formerly used Scheduler on success.

Trait Implementations§

Source§

impl Debug for Process

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