| 1 | //! Code related to attributes, which should be "searchable" leaf nodes. |
| 2 | |
| 3 | use regexrust-analyzer cargo regex 1.13.1 crate/::Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#; |
| 4 | |
| 5 | use craterust-analyzer cargo bottom 0.14.9 crate/::{ |
| 6 | collectionrust-analyzer cargo bottom 0.14.9 collection/::processesrust-analyzer cargo bottom 0.14.9 collection/processes/::ProcessHarvestrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#, |
| 7 | widgetsrust-analyzer cargo bottom 0.14.9 widgets/::queryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/::{ |
| 8 | NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#, PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#, QueryOptionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryOptions#, TimeQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/TimeQuery#, |
| 9 | errorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/::{QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#, QueryResultrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryResult#}, |
| 10 | new_regexrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/new_regex()., |
| 11 | }, |
| 12 | }; |
| 13 | |
| 14 | /// An attribute (leaf node) for a process. |
| 15 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 16 | pub(superrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/) enum ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute# { |
| 17 | /// This is a bit of a hack to allow for "empty" attributes. We can fix it |
| 18 | /// properly, but it would potentially require handling "empty" queries |
| 19 | /// better. Currently, we just treat it as a leaf node that always |
| 20 | /// succeeds on matches. |
| 21 | Emptyrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Empty#, |
| 22 | Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Pid#(Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#), |
| 23 | CpuPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#CpuPercentage#(NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#), |
| 24 | MemBytesrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#MemBytes#(NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#), |
| 25 | MemPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#MemPercentage#(NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#), |
| 26 | ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#ReadPerSecond#(NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#), |
| 27 | WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#WritePerSecond#(NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#), |
| 28 | TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#TotalRead#(NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#), |
| 29 | TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#TotalWrite#(NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#), |
| 30 | /// Note this is an "untagged" attribute (e.g. "btm", "firefox"). |
| 31 | Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Name#(Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#), |
| 32 | Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#State#(Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#), |
| 33 | Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#User#(Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#), |
| 34 | Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Time#(TimeQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/TimeQuery#), |
| 35 | #[cfg(unix)] |
| 36 | Nicerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Nice#(NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#), |
| 37 | Priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Priority#(NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#), |
| 38 | #[cfg(feature = "gpu")] |
| 39 | GpuPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#GpuPercentage#(NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#), |
| 40 | #[cfg(feature = "gpu")] |
| 41 | GpuMemoryPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#GpuMemoryPercentage#(NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#), |
| 42 | #[cfg(feature = "gpu")] |
| 43 | GpuMemoryBytesrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#GpuMemoryBytes#(NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#), |
| 44 | } |
| 45 | |
| 46 | impl ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute# { |
| 47 | pub(superrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/) fn checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/impl#[ProcessAttribute]check().(&self, process: &ProcessHarvestrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#, is_using_command: bool) -> bool { |
| 48 | match self { |
| 49 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Emptyrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Empty# => true, |
| 50 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Pid#(re) => re.is_matchrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]is_match().(process.pidrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#pid..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().().as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 51 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::CpuPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#CpuPercentage#(cmp) => cmp.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[NumericalQuery]check().(process.cpu_usage_percentrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#cpu_usage_percent.), |
| 52 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::MemBytesrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#MemBytes#(cmp) => cmp.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[NumericalQuery]check().(process.mem_usagerust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#mem_usage. as f64), |
| 53 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::MemPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#MemPercentage#(cmp) => cmp.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[NumericalQuery]check().(process.mem_usage_percentrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#mem_usage_percent.), |
| 54 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#ReadPerSecond#(cmp) => cmp.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[NumericalQuery]check().(process.read_per_secrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#read_per_sec. as f64), |
| 55 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#WritePerSecond#(cmp) => cmp.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[NumericalQuery]check().(process.write_per_secrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#write_per_sec. as f64), |
| 56 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#TotalRead#(cmp) => cmp.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[NumericalQuery]check().(process.total_readrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#total_read. as f64), |
| 57 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#TotalWrite#(cmp) => cmp.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[NumericalQuery]check().(process.total_writerust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#total_write. as f64), |
| 58 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Name#(re) => re.is_matchrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]is_match().(if is_using_command { |
| 59 | process.commandrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#command..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().() |
| 60 | } else { |
| 61 | process.namerust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#name..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().() |
| 62 | }), |
| 63 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#State#(re) => re.is_matchrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]is_match().(process.process_staterust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#process_state..0), |
| 64 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#User#(re) => match process.userrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#user..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() { |
| 65 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(user) => re.is_matchrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]is_match().(user), |
| 66 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => re.is_matchrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]is_match().("N/A"), |
| 67 | }, |
| 68 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Time#(time) => time.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[TimeQuery]check().(process.timerust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#time.), |
| 69 | // TODO: It's a bit silly for some of these, like nice/priority, where it's casted to an |
| 70 | // f64. |
| 71 | #[cfg(unix)] |
| 72 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Nicerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Nice#(cmp) => cmp.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[NumericalQuery]check().(process.nicerust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#nice. as f64), |
| 73 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Priority#(cmp) => cmp.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[NumericalQuery]check().(process.priorityrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#priority. as f64), |
| 74 | #[cfg(feature = "gpu")] |
| 75 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::GpuPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#GpuPercentage#(cmp) => cmp.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[NumericalQuery]check().(process.gpu_utilrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#gpu_util. as f64), |
| 76 | #[cfg(feature = "gpu")] |
| 77 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::GpuMemoryPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#GpuMemoryPercentage#(cmp) => cmp.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[NumericalQuery]check().(process.gpu_mem_percentrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#gpu_mem_percent. as f64), |
| 78 | #[cfg(feature = "gpu")] |
| 79 | ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::GpuMemoryBytesrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#GpuMemoryBytes#(cmp) => cmp.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[NumericalQuery]check().(process.gpu_memrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#gpu_mem. as f64), |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | /// Given a string prefix type, obtain the appropriate [`ProcessAttribute`]. |
| 85 | pub(superrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/) fn new_string_attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/new_string_attribute().( |
| 86 | prefix_type: PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#, base: &str, regex_options: &QueryOptionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryOptions#, |
| 87 | ) -> QueryResultrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryResult#<ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#> { |
| 88 | match prefix_type { |
| 89 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#Pid# | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#Name# | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#State# | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#User# => { |
| 90 | let re = new_regexrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/new_regex().(base, regex_options)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 91 | |
| 92 | match prefix_type { |
| 93 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#Pid# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Pid#(re)), |
| 94 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#Name# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Name#(re)), |
| 95 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#State# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#State#(re)), |
| 96 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#User# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#User#(re)), |
| 97 | _ => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(), |
| 98 | } |
| 99 | } |
| 100 | _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 101 | "process attribute type {prefix_type:?} is not a supported string attribute" |
| 102 | ))), |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | /// Given a time prefix type, obtain the appropriate [`ProcessAttribute`]. |
| 107 | pub(superrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/) fn new_time_attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/new_time_attribute().( |
| 108 | prefix_type: PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#, query: TimeQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/TimeQuery#, |
| 109 | ) -> QueryResultrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryResult#<ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#> { |
| 110 | match prefix_type { |
| 111 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#Time# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Time#(query)), |
| 112 | _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 113 | "process attribute type {prefix_type:?} is not a supported time attribute" |
| 114 | ))), |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | /// Given a numerical prefix type, obtain the appropriate [`ProcessAttribute`]. |
| 119 | pub(superrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/) fn new_numerical_attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/new_numerical_attribute().( |
| 120 | prefix_type: PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#, query: NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#, |
| 121 | ) -> QueryResultrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryResult#<ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#> { |
| 122 | match prefix_type { |
| 123 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::CpuPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#CpuPercentage# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::CpuPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#CpuPercentage#(query)), |
| 124 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::MemBytesrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#MemBytes# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::MemBytesrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#MemBytes#(query)), |
| 125 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::MemPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#MemPercentage# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::MemPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#MemPercentage#(query)), |
| 126 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#ReadPerSecond# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#ReadPerSecond#(query)), |
| 127 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#WritePerSecond# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#WritePerSecond#(query)), |
| 128 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#TotalRead# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#TotalRead#(query)), |
| 129 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#TotalWrite# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#TotalWrite#(query)), |
| 130 | #[cfg(unix)] |
| 131 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Nicerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#Nice# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Nicerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Nice#(query)), |
| 132 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#Priority# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Priority#(query)), |
| 133 | #[cfg(feature = "gpu")] |
| 134 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::GpuPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#GpuPercentage# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::GpuPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#GpuPercentage#(query)), |
| 135 | #[cfg(feature = "gpu")] |
| 136 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::GpuMemoryBytesrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#GpuMemoryBytes# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::GpuMemoryBytesrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#GpuMemoryBytes#(query)), |
| 137 | #[cfg(feature = "gpu")] |
| 138 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::GpuMemoryPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#GpuMemoryPercentage# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::GpuMemoryPercentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#GpuMemoryPercentage#(query)), |
| 139 | _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 140 | "process attribute type {prefix_type:?} is not a supported numerical attribute" |
| 141 | ))), |
| 142 | } |
| 143 | } |