process: move Identifier code to the bottom
This commit is contained in:
+27
-27
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user