pub struct ProcessHandle(/* private fields */);
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 duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const 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
A process::Child
always has a pid, which is all we need on Linux.
impl TryFrom<&Child> for ProcessHandle
A process::Child
always has a pid, which is all we need on Linux.
Auto Trait Implementations§
impl Freeze for ProcessHandle
impl RefUnwindSafe for ProcessHandle
impl Send for ProcessHandle
impl Sync for ProcessHandle
impl Unpin for ProcessHandle
impl UnwindSafe for ProcessHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more