pub struct Pid(/* private fields */);
Expand description
pid_t
—A non-zero Unix process ID.
This is a pid, and not a pidfd. It is not a file descriptor, and the process it refers to could disappear at any time and be replaced by another, unrelated, process.
Implementations§
source§impl Pid
impl Pid
sourcepub const fn from_raw(raw: RawPid) -> Option<Self>
pub const fn from_raw(raw: RawPid) -> Option<Self>
Converts a RawPid
into a Pid
.
Returns Some
for positive RawPid
s. Otherwise, returns None
.
This is safe because a Pid
is a number without any guarantees for the
kernel. Non-child Pid
s are always racy for any syscalls, but can only
cause logic errors. If you want race-free access to or control of
non-child processes, please consider other mechanisms like pidfd on
Linux.
sourcepub const unsafe fn from_raw_unchecked(raw: RawPid) -> Self
pub const unsafe fn from_raw_unchecked(raw: RawPid) -> Self
sourcepub fn from_child(child: &Child) -> Self
pub fn from_child(child: &Child) -> Self
Creates a Pid
holding the ID of the given child process.
sourcepub const fn as_raw_nonzero(self) -> NonZeroI32
pub const fn as_raw_nonzero(self) -> NonZeroI32
Converts a Pid
into a NonZeroI32
.
Trait Implementations§
impl Copy for Pid
impl Eq for Pid
impl StructuralPartialEq for Pid
Auto Trait Implementations§
impl Freeze for Pid
impl RefUnwindSafe for Pid
impl Send for Pid
impl Sync for Pid
impl Unpin for Pid
impl UnwindSafe for Pid
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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)