diff --git a/src/debug.rs b/src/debug.rs index 46a620fcc..43807a0f5 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -29,6 +29,29 @@ impl std::fmt::Debug for crate::System { } } +#[cfg(feature = "system")] +impl std::fmt::Debug for crate::Process { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Process") + .field("pid", &self.pid()) + .field("parent", &self.parent()) + .field("name", &self.name()) + .field("environ", &self.environ()) + .field("command", &self.cmd()) + .field("executable path", &self.exe()) + .field("current working directory", &self.cwd()) + .field("memory usage", &self.memory()) + .field("virtual memory usage", &self.virtual_memory()) + .field("CPU usage", &self.cpu_usage()) + .field("status", &self.status()) + .field("root", &self.root()) + .field("disk_usage", &self.disk_usage()) + .field("user_id", &self.user_id()) + .field("effective_user_id", &self.effective_user_id()) + .finish() + } +} + #[cfg(feature = "disk")] impl std::fmt::Debug for crate::Disk { fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -53,29 +76,6 @@ impl std::fmt::Debug for crate::Disks { } } -#[cfg(feature = "system")] -impl std::fmt::Debug for crate::Process { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("Process") - .field("pid", &self.pid()) - .field("parent", &self.parent()) - .field("name", &self.name()) - .field("environ", &self.environ()) - .field("command", &self.cmd()) - .field("executable path", &self.exe()) - .field("current working directory", &self.cwd()) - .field("memory usage", &self.memory()) - .field("virtual memory usage", &self.virtual_memory()) - .field("CPU usage", &self.cpu_usage()) - .field("status", &self.status()) - .field("root", &self.root()) - .field("disk_usage", &self.disk_usage()) - .field("user_id", &self.user_id()) - .field("effective_user_id", &self.effective_user_id()) - .finish() - } -} - #[cfg(feature = "component")] impl std::fmt::Debug for crate::Components { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {