[−][src]Struct heim::process::Process
System process.
Some extra methods can be found in the OS extensions
Methods
impl Process
[src]
pub fn pid(&self) -> i32
[src]
Returns the process pid.
pub fn parent_pid(&self) -> impl Future<Output = Result<i32, ProcessError>>
[src]
Returns future which resolves into the process parent pid.
pub fn parent(&self) -> impl Future<Output = Result<Process, ProcessError>>
[src]
Returns future which resolves into the parent Process.
pub fn name(&self) -> impl Future<Output = Result<String, ProcessError>>
[src]
Returns future which resolves into the process name.
pub fn exe(&self) -> impl Future<Output = Result<PathBuf, ProcessError>>
[src]
Returns future which resolves into the process executable as an absolute path.
pub fn command(&self) -> impl Future<Output = Result<Command, ProcessError>>
[src]
Returns future which resolves into the process command line.
Example
let process = process::current().await?; let command = process.command().await?; println!("Command line arguments:"); for arg in &command { println!("{:?}", arg); }
pub fn cwd(&self) -> impl Future<Output = Result<PathBuf, ProcessError>>
[src]
Returns future which resolves into the process current working directory.
Compatibility
For Windows this method is not implemented yet and will always return an error, see #105.
pub fn status(&self) -> impl Future<Output = Result<Status, ProcessError>>
[src]
Returns future which resolves into the current process status.
pub fn create_time(
&self
) -> impl Future<Output = Result<Quantity<dyn Dimension<I = Z0, L = Z0, N = Z0, M = Z0, J = Z0, Th = Z0, Kind = dyn Kind + 'static, T = PInt<UInt<UTerm, B1>>> + 'static, dyn Units<f64, length = meter, amount_of_substance = mole, thermodynamic_temperature = kelvin, time = second, luminous_intensity = candela, mass = kilogram, electric_current = ampere> + 'static, f64>, ProcessError>>
[src]
&self
) -> impl Future<Output = Result<Quantity<dyn Dimension<I = Z0, L = Z0, N = Z0, M = Z0, J = Z0, Th = Z0, Kind = dyn Kind + 'static, T = PInt<UInt<UTerm, B1>>> + 'static, dyn Units<f64, length = meter, amount_of_substance = mole, thermodynamic_temperature = kelvin, time = second, luminous_intensity = candela, mass = kilogram, electric_current = ampere> + 'static, f64>, ProcessError>>
Returns future which resolves into the process creation time, expressed as a Time amount since the UNIX epoch.
pub fn cpu_time(&self) -> impl Future<Output = Result<CpuTime, ProcessError>>
[src]
Returns future which resolves into the accumulated process time.
pub fn cpu_usage(&self) -> impl Future<Output = Result<CpuUsage, ProcessError>>
[src]
Returns future which resolves into the CPU usage measurement.
Returned CpuUsage
struct represents instantaneous CPU usage and does not represent
any reasonable value by itself.
It is suggested to wait for a while with help of any async timer
(for accuracy recommended delay should be at least 100 ms),
call this method once again and subtract former CpuUsage
from the new one.
Same to any *nix system, calculated CPU usage might exceed 100 % if the process is running multiple threads on different CPU cores.
Example
let process = process::current().await?; let measurement_1 = process.cpu_usage().await?; // Or any other async timer at your choice futures_timer::Delay::new(Duration::from_millis(100)).await?; let measurement_2 = process.cpu_usage().await?; println!("CPU usage: {} %", (measurement_2 - measurement_1).get::<ratio::percent>());
pub fn memory(&self) -> impl Future<Output = Result<Memory, ProcessError>>
[src]
Returns future which resolves into the memory information about this process.
pub fn is_running(&self) -> impl Future<Output = Result<bool, ProcessError>>
[src]
Returns future which checks if this Process
is still running.
pub fn suspend(&self) -> impl Future<Output = Result<(), ProcessError>>
[src]
Suspend the current process.
Before the signal send, it checks whether process PID has been reused,
and if it is a case, NoSuchProcess
error will be returned.
Compatibility
For *nix systems it sends the SIGSTOP
signal to process.
pub fn resume(&self) -> impl Future<Output = Result<(), ProcessError>>
[src]
Resume the current process.
Before the signal send, it checks whether process PID has been reused,
and if it is a case, NoSuchProcess
error will be returned.
Compatibility
For *nix systems it sends the SIGCONT
signal to process.
pub fn terminate(&self) -> impl Future<Output = Result<(), ProcessError>>
[src]
Terminate the current process.
Before the signal send, it checks whether process PID has been reused,
and if it is a case, NoSuchProcess
error will be returned.
Compatibility
For *nix systems it sends the SIGTERM
signal to process.
For Windows it is an alias for the Process::kill
pub fn kill(&self) -> impl Future<Output = Result<(), ProcessError>>
[src]
Kills the current process.
Before the signal send, it checks whether process PID has been reused,
and if it is a case, NoSuchProcess
error will be returned.
Compatibility
For *nix systems it sends the SIGKILL
signal to process.
TerminateProcess
function is used for Windows,
it initiates the termination but does not awaits for completion.
Trait Implementations
impl ProcessExt for Process
[src]
fn signal(
&self,
signal: Signal
) -> Pin<Box<dyn Future<Output = Result<(), ProcessError>> + Send>>
[src]
&self,
signal: Signal
) -> Pin<Box<dyn Future<Output = Result<(), ProcessError>> + Send>>
impl ProcessExt for Process
[src]
fn io_counters(
&self
) -> Pin<Box<dyn Future<Output = Result<IoCounters, ProcessError>> + Send>>
[src]
&self
) -> Pin<Box<dyn Future<Output = Result<IoCounters, ProcessError>> + Send>>
fn net_io_counters(
&self
) -> Pin<Box<dyn Stream<Item = Result<IoCounters, ProcessError>> + Send>>
[src]
&self
) -> Pin<Box<dyn Stream<Item = Result<IoCounters, ProcessError>> + Send>>
impl Eq for Process
[src]
impl Debug for Process
[src]
impl Hash for Process
[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Process> for Process
[src]
Auto Trait Implementations
impl Send for Process
impl Unpin for Process
impl Sync for Process
impl UnwindSafe for Process
impl RefUnwindSafe for Process
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self