From 010367279e194544f8f3a96771a7cc43b56c3a00 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 11 Oct 2026 12:44:15 +0200 Subject: [PATCH] std: add doctest to parent_id --- library/std/src/os/unix/process.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/std/src/os/unix/process.rs b/library/std/src/os/unix/process.rs index 9fa731de82691..a498ff49d6971 100644 --- a/library/std/src/os/unix/process.rs +++ b/library/std/src/os/unix/process.rs @@ -747,6 +747,15 @@ impl From for process::ChildStderr { } /// Returns the OS-assigned process identifier associated with this process's parent. +/// +/// # Example +/// +#[cfg_attr(target_family = "unix", doc = "```")] +#[cfg_attr(not(target_family = "unix"), doc = "```ignore (needs unix)")] +/// use std::os::unix::process; +/// let parent = process::parent_id(); +/// println!("The parent process has ID {}", parent); +/// ``` #[must_use] #[stable(feature = "unix_ppid", since = "1.27.0")] pub fn parent_id() -> u32 {