process: move Identifier code to the bottom

This commit is contained in:
2025-12-04 08:06:30 +00:00
parent 06123b5b7b
commit c18c427af5
+27 -27
View File
@@ -4,33 +4,6 @@ use crate::{
}; };
use derive_more::{Debug, derive::Display}; use derive_more::{Debug, derive::Display};
#[derive(Display)]
/// an identifier for searching for a process
pub enum Identifier {
/// process id to search for
Pid(u32),
/// process name to search for
Name(String),
}
impl From<u32> for Identifier {
fn from(value: u32) -> Self {
Self::Pid(value)
}
}
impl From<&str> for Identifier {
fn from(value: &str) -> Self {
Self::Name(value.to_string())
}
}
impl From<String> for Identifier {
fn from(value: String) -> Self {
Self::Name(value)
}
}
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, Clone)]
/// a process running on the system /// a process running on the system
pub struct Process { pub struct Process {
@@ -163,3 +136,30 @@ pub struct Module {
#[debug("0x{base_size:X}")] #[debug("0x{base_size:X}")]
pub base_size: usize, pub base_size: usize,
} }
#[derive(Display)]
/// an identifier for searching for a process
pub enum Identifier {
/// process id to search for
Pid(u32),
/// process name to search for
Name(String),
}
impl From<u32> for Identifier {
fn from(value: u32) -> Self {
Self::Pid(value)
}
}
impl From<&str> for Identifier {
fn from(value: &str) -> Self {
Self::Name(value.to_string())
}
}
impl From<String> for Identifier {
fn from(value: String) -> Self {
Self::Name(value)
}
}