diff options
Diffstat (limited to 'src/app/widgets/process_table/proc_widget_data.rs')
-rw-r--r-- | src/app/widgets/process_table/proc_widget_data.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/app/widgets/process_table/proc_widget_data.rs b/src/app/widgets/process_table/proc_widget_data.rs index acb33af4..94736336 100644 --- a/src/app/widgets/process_table/proc_widget_data.rs +++ b/src/app/widgets/process_table/proc_widget_data.rs @@ -16,18 +16,27 @@ use crate::{ Pid, }; -#[derive(Clone)] +#[derive(Clone, Debug)] enum IdType { Name(String), Command(String), } -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct Id { id_type: IdType, prefix: Option<String>, } +impl From<&'static str> for Id { + fn from(s: &'static str) -> Self { + Id { + id_type: IdType::Name(s.to_string()), + prefix: None, + } + } +} + impl Id { /// Returns the ID as a lowercase [`String`], with no prefix. This is primarily useful for /// cases like sorting where we treat everything as the same case (e.g. `Discord` comes before @@ -73,7 +82,7 @@ impl Display for Id { } // TODO: Can reduce this to 32 bytes. -#[derive(PartialEq, Clone)] +#[derive(PartialEq, Clone, Debug)] pub enum MemUsage { Percent(f64), Bytes(u64), @@ -98,7 +107,7 @@ impl Display for MemUsage { } } -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct ProcWidgetData { pub pid: Pid, pub ppid: Option<Pid>, |