Struct read_process_memory::ProcessHandle
source · pub struct ProcessHandle(_);
Expand description
A handle to a running process. This is not a process ID on all platforms.
For convenience, this crate implements TryFrom
-backed conversions from
Pid
to ProcessHandle
.
Examples
use read_process_memory::*;
use std::convert::TryInto;
use std::io;
fn pid_to_handle(pid: Pid) -> io::Result<ProcessHandle> {
Ok(pid.try_into()?)
}
This operation is not guaranteed to succeed. Specifically, on Windows
OpenProcess
may fail. On macOS task_for_pid
will generally fail
unless run as root, and even then it may fail when called on certain
programs; it may however run without root on the current process.
On Linux a ProcessHandle
is just a libc::pid_t
.
Trait Implementations§
source§impl Clone for ProcessHandle
impl Clone for ProcessHandle
source§fn clone(&self) -> ProcessHandle
fn clone(&self) -> ProcessHandle
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl CopyAddress for ProcessHandle
impl CopyAddress for ProcessHandle
source§impl TryFrom<&Child> for ProcessHandle
impl TryFrom<&Child> for ProcessHandle
A process::Child
always has a pid, which is all we need on Linux.