| 1 | pub mod process_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/; |
| 2 | pub mod process_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/; |
| 3 | pub mod queryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/; |
| 4 | mod sort_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/sort_table/; |
| 5 | |
| 6 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#, collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#}; |
| 7 | |
| 8 | use indexmaprust-analyzer cargo indexmap 2.14.0 crate/::IndexSetrust-analyzer cargo indexmap 2.14.0 set/IndexSet#; |
| 9 | use itertoolsrust-analyzer cargo itertools 0.15.0 crate/::Itertoolsrust-analyzer cargo itertools 0.15.0 Itertools#; |
| 10 | pub use process_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/::*; |
| 11 | pub use process_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/::*; |
| 12 | use queryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/::{ProcessQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/ProcessQuery#, parse_queryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/parse_query().}; |
| 13 | use rustc_hashrust-analyzer cargo rustc-hash 2.1.3 crate/::{FxHashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap# as HashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap#, FxHashSetrust-analyzer cargo rustc-hash 2.1.3 FxHashSet# as HashSetrust-analyzer cargo rustc-hash 2.1.3 FxHashSet#}; |
| 14 | use sort_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/sort_table/::SortTableColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/sort_table/SortTableColumn#; |
| 15 | |
| 16 | use craterust-analyzer cargo bottom 0.14.9 crate/::{ |
| 17 | apprust-analyzer cargo bottom 0.14.9 app/::{ |
| 18 | AppConfigFieldsrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#, AppSearchStaterust-analyzer cargo bottom 0.14.9 app/states/AppSearchState#, |
| 19 | datarust-analyzer cargo bottom 0.14.9 app/data/::{InnerDatarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#, ProcessDatarust-analyzer cargo bottom 0.14.9 app/data/process/ProcessData#}, |
| 20 | }, |
| 21 | canvasrust-analyzer cargo bottom 0.14.9 canvas/::componentsrust-analyzer cargo bottom 0.14.9 canvas/components/::data_tablerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/::{ |
| 22 | Columnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/Column#, ColumnHeaderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/ColumnHeader#, ColumnWidthBoundsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/ColumnWidthBounds#, DataTablerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#, DataTableColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/DataTableColumn#, DataTablePropsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#, |
| 23 | DataTableStylingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/styling/DataTableStyling#, SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#, SortDataTablerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortDataTable#, SortDataTablePropsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortDataTableProps#, SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#, SortsRowrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortsRow#, |
| 24 | }, |
| 25 | collectionrust-analyzer cargo bottom 0.14.9 collection/::processesrust-analyzer cargo bottom 0.14.9 collection/processes/::{Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#, ProcessHarvestrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#}, |
| 26 | optionsrust-analyzer cargo bottom 0.14.9 options/::configrust-analyzer cargo bottom 0.14.9 options/config/::stylerust-analyzer cargo bottom 0.14.9 options/config/style/::Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#, |
| 27 | utilsrust-analyzer cargo bottom 0.14.9 utils/::int_hashrust-analyzer cargo bottom 0.14.9 utils/int_hash/::IntHashMaprust-analyzer cargo bottom 0.14.9 utils/int_hash/IntHashMap#, |
| 28 | widgetsrust-analyzer cargo bottom 0.14.9 widgets/::queryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/::QueryOptionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryOptions#, |
| 29 | }; |
| 30 | |
| 31 | /// ProcessSearchState only deals with process' search's current settings and |
| 32 | /// state. |
| 33 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 34 | pub struct ProcessSearchStaterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState# { |
| 35 | // TODO: Flatten AppSearchState as it's been generalized further. |
| 36 | pub search_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#search_state.: AppSearchStaterust-analyzer cargo bottom 0.14.9 app/states/AppSearchState#, |
| 37 | pub query_optionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#query_options.: QueryOptionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryOptions#, |
| 38 | } |
| 39 | |
| 40 | impl ProcessSearchStaterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState# { |
| 41 | pub fn search_toggle_ignore_caserust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcessSearchState]search_toggle_ignore_case().(&mut self) { |
| 42 | self.query_optionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#query_options..ignore_caserust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryOptions#ignore_case. = !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.query_optionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#query_options..ignore_caserust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryOptions#ignore_case.; |
| 43 | } |
| 44 | |
| 45 | pub fn search_toggle_whole_wordrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcessSearchState]search_toggle_whole_word().(&mut self) { |
| 46 | self.query_optionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#query_options..whole_wordrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryOptions#whole_word. = !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.query_optionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#query_options..whole_wordrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryOptions#whole_word.; |
| 47 | } |
| 48 | |
| 49 | pub fn search_toggle_regexrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcessSearchState]search_toggle_regex().(&mut self) { |
| 50 | self.query_optionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#query_options..use_regexrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryOptions#use_regex. = !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.query_optionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#query_options..use_regexrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryOptions#use_regex.; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | /// Whether to expand or collapse by default. |
| 55 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 56 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) enum TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed# { |
| 57 | DefaultCollapserust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultCollapse# { expanded_pidsrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultCollapse#expanded_pids.: HashSetrust-analyzer cargo rustc-hash 2.1.3 FxHashSet#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#> }, |
| 58 | DefaultExpandrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultExpand# { collapsed_pidsrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultExpand#collapsed_pids.: HashSetrust-analyzer cargo rustc-hash 2.1.3 FxHashSet#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#> }, |
| 59 | } |
| 60 | |
| 61 | impl TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed# { |
| 62 | /// Creates a new [`TreeCollapsed`]. |
| 63 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) fn newrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]new().(default_collapsed: bool) -> Selfrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed] { |
| 64 | if default_collapsed { |
| 65 | TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#::DefaultCollapserust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultCollapse# { |
| 66 | expanded_pidsrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultCollapse#expanded_pids.: HashSetrust-analyzer cargo rustc-hash 2.1.3 FxHashSet#::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S>`][Default]default().(), |
| 67 | } |
| 68 | } else { |
| 69 | TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#::DefaultExpandrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultExpand# { |
| 70 | collapsed_pidsrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultExpand#collapsed_pids.: HashSetrust-analyzer cargo rustc-hash 2.1.3 FxHashSet#::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S>`][Default]default().(), |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /// Check whether the given PID is collapsed. |
| 76 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) fn is_collapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]is_collapsed().(&self, pid: Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#) -> bool { |
| 77 | match self { |
| 78 | TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#::DefaultCollapserust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultCollapse# { expanded_pidsrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultCollapse#expanded_pids. } => !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().expanded_pids.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(&pid), |
| 79 | TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#::DefaultExpandrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultExpand# { collapsed_pidsrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultExpand#collapsed_pids. } => collapsed_pids.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(&pid), |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /// Collapse the given PID. |
| 84 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) fn collapserust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]collapse().(&mut self, pid: Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#) { |
| 85 | match self { |
| 86 | TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#::DefaultCollapserust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultCollapse# { expanded_pidsrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultCollapse#expanded_pids. } => { |
| 87 | expanded_pids.removerust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]remove().(&pid); |
| 88 | } |
| 89 | TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#::DefaultExpandrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultExpand# { collapsed_pidsrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultExpand#collapsed_pids. } => { |
| 90 | collapsed_pids.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(pid); |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | /// Expand the given PID. |
| 96 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) fn expandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]expand().(&mut self, pid: Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#) { |
| 97 | match self { |
| 98 | TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#::DefaultCollapserust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultCollapse# { expanded_pidsrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultCollapse#expanded_pids. } => { |
| 99 | expanded_pids.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(pid); |
| 100 | } |
| 101 | TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#::DefaultExpandrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultExpand# { collapsed_pidsrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultExpand#collapsed_pids. } => { |
| 102 | collapsed_pids.removerust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]remove().(&pid); |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | /// Toggle the given PID. |
| 108 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) fn togglerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]toggle().(&mut self, pid: Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#) { |
| 109 | match self { |
| 110 | TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#::DefaultCollapserust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultCollapse# { expanded_pidsrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultCollapse#expanded_pids. } => { |
| 111 | if expanded_pids.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(&pid) { |
| 112 | expanded_pids.removerust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]remove().(&pid); |
| 113 | } else { |
| 114 | expanded_pids.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(pid); |
| 115 | } |
| 116 | } |
| 117 | TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#::DefaultExpandrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultExpand# { collapsed_pidsrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#DefaultExpand#collapsed_pids. } => { |
| 118 | if collapsed_pids.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(&pid) { |
| 119 | collapsed_pids.removerust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]remove().(&pid); |
| 120 | } else { |
| 121 | collapsed_pids.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(pid); |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 129 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) enum ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode# { |
| 130 | Treerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Tree#(TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#), |
| 131 | Groupedrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Grouped#, |
| 132 | Normalrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Normal#, |
| 133 | } |
| 134 | |
| 135 | type ProcessTablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessTable# = SortDataTablerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortDataTable#<ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#, ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#>; |
| 136 | type SortTablerust-analyzer cargo bottom 0.14.9 widgets/process_table/SortTable# = DataTablerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str>, SortTableColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/sort_table/SortTableColumn#>; |
| 137 | type StringPidMaprust-analyzer cargo bottom 0.14.9 widgets/process_table/StringPidMap# = HashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#>>; |
| 138 | |
| 139 | fn make_columnrust-analyzer cargo bottom 0.14.9 widgets/process_table/make_column().(column: ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#) -> SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#<ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#> { |
| 140 | use ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::*; |
| 141 | |
| 142 | match column { |
| 143 | CpuPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#CpuPercent# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::newrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]new().(CpuPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#CpuPercent#).default_descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]default_descending().(), |
| 144 | MemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemValue# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::newrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]new().(MemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemValue#).default_descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]default_descending().(), |
| 145 | MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::newrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]new().(MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#).default_descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]default_descending().(), |
| 146 | VirtualMemrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#VirtualMem# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::newrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]new().(VirtualMemrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#VirtualMem#).default_descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]default_descending().(), |
| 147 | Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::newrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]new().(Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#), |
| 148 | Countrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Count# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::newrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]new().(Countrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Count#), |
| 149 | Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::softrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]soft().(Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0.3)), |
| 150 | Commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Command# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::softrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]soft().(Commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Command#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0.3)), |
| 151 | ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#ReadPerSecond# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::hardrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]hard().(ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#ReadPerSecond#, 8).default_descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]default_descending().(), |
| 152 | WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#WritePerSecond# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::hardrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]hard().(WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#WritePerSecond#, 8).default_descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]default_descending().(), |
| 153 | TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#TotalRead# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::hardrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]hard().(TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#TotalRead#, 8).default_descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]default_descending().(), |
| 154 | TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#TotalWrite# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::hardrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]hard().(TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#TotalWrite#, 8).default_descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]default_descending().(), |
| 155 | Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#User# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::softrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]soft().(Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#User#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0.05)), |
| 156 | Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::hardrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]hard().(Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, 9), |
| 157 | Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Time# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::newrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]new().(Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Time#), |
| 158 | Priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Priority# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::newrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]new().(Priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Priority#).default_descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]default_descending().(), |
| 159 | #[cfg(unix)] |
| 160 | Nicerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Nice# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::newrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]new().(Nicerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Nice#), |
| 161 | #[cfg(feature = "gpu")] |
| 162 | GpuMemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuMemValue# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::newrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]new().(GpuMemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuMemValue#).default_descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]default_descending().(), |
| 163 | #[cfg(feature = "gpu")] |
| 164 | GpuMemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuMemPercent# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::newrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]new().(GpuMemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuMemPercent#).default_descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]default_descending().(), |
| 165 | #[cfg(feature = "gpu")] |
| 166 | GpuUtilPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuUtilPercent# => SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#::newrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]new().(GpuUtilPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuUtilPercent#).default_descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]default_descending().(), |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 171 | pub struct ProcTableConfigrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig# { |
| 172 | pub is_case_sensitiverust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#is_case_sensitive.: bool, |
| 173 | pub is_match_whole_wordrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#is_match_whole_word.: bool, |
| 174 | pub is_use_regexrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#is_use_regex.: bool, |
| 175 | pub show_memory_as_valuesrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#show_memory_as_values.: bool, |
| 176 | pub is_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#is_command.: bool, |
| 177 | pub default_sortrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#default_sort.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#>, |
| 178 | pub sort_orderrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#sort_order.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#>, |
| 179 | } |
| 180 | |
| 181 | /// A hacky workaround for now. |
| 182 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 183 | pub enum ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn# { |
| 184 | PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 185 | ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 186 | Cpurust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Cpu#, |
| 187 | Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 188 | VirtualMemrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#VirtualMem#, |
| 189 | ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ReadPerSecond#, |
| 190 | WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#WritePerSecond#, |
| 191 | TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#TotalRead#, |
| 192 | TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#TotalWrite#, |
| 193 | Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#User#, |
| 194 | Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 195 | Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Time#, |
| 196 | Priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Priority#, |
| 197 | #[cfg(unix)] |
| 198 | Nicerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Nice#, |
| 199 | #[cfg(feature = "gpu")] |
| 200 | GpuMemrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#GpuMem#, |
| 201 | #[cfg(feature = "gpu")] |
| 202 | GpuUtilrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#GpuUtil#, |
| 203 | } |
| 204 | |
| 205 | // This is temporary. Switch back to `ProcColumn` later! |
| 206 | |
| 207 | pub struct ProcWidgetStaterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState# { |
| 208 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode.: ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#, |
| 209 | |
| 210 | /// The state of the search box. |
| 211 | pub proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search.: ProcessSearchStaterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#, |
| 212 | |
| 213 | /// The state of the main table. |
| 214 | pub tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.: ProcessTablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessTable#, |
| 215 | |
| 216 | /// The state of the togglable table that controls sorting. |
| 217 | pub sort_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#sort_table.: SortTablerust-analyzer cargo bottom 0.14.9 widgets/process_table/SortTable#, |
| 218 | |
| 219 | /// The internal column mapping as an [`IndexSet`], to allow us to do quick |
| 220 | /// mappings of column type -> index. |
| 221 | pub column_mappingrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#column_mapping.: IndexSetrust-analyzer cargo indexmap 2.14.0 set/IndexSet#<ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#>, |
| 222 | |
| 223 | /// A name-to-pid mapping. |
| 224 | pub id_pid_maprust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#id_pid_map.: StringPidMaprust-analyzer cargo bottom 0.14.9 widgets/process_table/StringPidMap#, |
| 225 | |
| 226 | /// The default sort index. |
| 227 | default_sort_indexrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#default_sort_index.: usize, |
| 228 | |
| 229 | /// The default sort order. |
| 230 | default_sort_orderrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#default_sort_order.: SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#, |
| 231 | |
| 232 | pub is_sort_openrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#is_sort_open.: bool, |
| 233 | pub force_rerenderrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#force_rerender.: bool, |
| 234 | pub force_update_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#force_update_data.: bool, |
| 235 | #[cfg(target_os = "linux")] |
| 236 | pub hide_k_threadsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#hide_k_threads.: bool, |
| 237 | } |
| 238 | |
| 239 | impl ProcWidgetStaterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState# { |
| 240 | fn new_sort_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]new_sort_table().(config: &AppConfigFieldsrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#, palette: &Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#) -> SortTablerust-analyzer cargo bottom 0.14.9 widgets/process_table/SortTable# { |
| 241 | const COLUMNSrust-analyzer cargo bottom 0.14.9 widgets/process_table/COLUMNS.: [Columnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/Column#<SortTableColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/sort_table/SortTableColumn#>; 1] = [Columnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/Column#::hardrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/impl#[`Column<H>`]hard().(SortTableColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/sort_table/SortTableColumn#, 7)]; |
| 242 | |
| 243 | let props = DataTablePropsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps# { |
| 244 | titlerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#title.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 245 | table_gaprust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#table_gap.: config.table_gaprust-analyzer cargo bottom 0.14.9 app/AppConfigFields#table_gap., |
| 246 | left_to_rightrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#left_to_right.: true, |
| 247 | is_basicrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#is_basic.: false, |
| 248 | show_table_scroll_positionrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#show_table_scroll_position.: false, |
| 249 | show_table_scroll_barrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#show_table_scroll_bar.: false, |
| 250 | show_current_entry_when_unfocusedrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#show_current_entry_when_unfocused.: false, |
| 251 | }; |
| 252 | let styling = DataTableStylingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/styling/DataTableStyling#::from_paletterust-analyzer cargo bottom 0.14.9 canvas/components/data_table/styling/impl#[DataTableStyling]from_palette().(palette); |
| 253 | |
| 254 | DataTablerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#::newrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/impl#[`DataTable<DataType, H>`]new().(COLUMNSrust-analyzer cargo bottom 0.14.9 widgets/process_table/COLUMNS., props, styling) |
| 255 | } |
| 256 | |
| 257 | fn new_process_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]new_process_table().( |
| 258 | config: &AppConfigFieldsrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#, colours: &Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#, columns: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#<ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#>>, |
| 259 | default_index: usize, default_order: SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#, |
| 260 | ) -> ProcessTablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessTable# { |
| 261 | let inner_props = DataTablePropsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps# { |
| 262 | titlerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#title.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(" Processes ".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()), |
| 263 | table_gaprust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#table_gap.: config.table_gaprust-analyzer cargo bottom 0.14.9 app/AppConfigFields#table_gap., |
| 264 | left_to_rightrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#left_to_right.: true, |
| 265 | is_basicrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#is_basic.: config.use_basic_moderust-analyzer cargo bottom 0.14.9 app/AppConfigFields#use_basic_mode., |
| 266 | show_table_scroll_positionrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#show_table_scroll_position.: config.show_table_scroll_positionrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#show_table_scroll_position., |
| 267 | show_table_scroll_barrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#show_table_scroll_bar.: config.show_table_scroll_barrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#show_table_scroll_bar., |
| 268 | show_current_entry_when_unfocusedrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#show_current_entry_when_unfocused.: false, |
| 269 | }; |
| 270 | let props = SortDataTablePropsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortDataTableProps# { |
| 271 | innerrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortDataTableProps#inner.: inner_props, |
| 272 | sort_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortDataTableProps#sort_index.: default_index, |
| 273 | orderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortDataTableProps#order.: default_order, |
| 274 | }; |
| 275 | let styling = DataTableStylingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/styling/DataTableStyling#::from_paletterust-analyzer cargo bottom 0.14.9 canvas/components/data_table/styling/impl#[DataTableStyling]from_palette().(colours); |
| 276 | |
| 277 | DataTablerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#::new_sortablerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]new_sortable().(columns, props, styling) |
| 278 | } |
| 279 | |
| 280 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) fn newrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]new().( |
| 281 | config: &AppConfigFieldsrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#, mode: ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#, table_config: ProcTableConfigrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#, |
| 282 | colours: &Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#, config_columns: &Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<IndexSetrust-analyzer cargo indexmap 2.14.0 set/IndexSet#<ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#>>, |
| 283 | ) -> Selfrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState] { |
| 284 | let process_search_state = { |
| 285 | let mut pss = ProcessSearchStaterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#::defaultrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcessSearchState][Default]default().(); |
| 286 | |
| 287 | if table_config.is_case_sensitiverust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#is_case_sensitive. { |
| 288 | // By default it's off. |
| 289 | pss.search_toggle_ignore_caserust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcessSearchState]search_toggle_ignore_case().(); |
| 290 | } |
| 291 | if table_config.is_match_whole_wordrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#is_match_whole_word. { |
| 292 | pss.search_toggle_whole_wordrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcessSearchState]search_toggle_whole_word().(); |
| 293 | } |
| 294 | if table_config.is_use_regexrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#is_use_regex. { |
| 295 | pss.search_toggle_regexrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcessSearchState]search_toggle_regex().(); |
| 296 | } |
| 297 | |
| 298 | pss |
| 299 | }; |
| 300 | |
| 301 | let columns: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<SortColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#<ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#>> = { |
| 302 | use ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::*; |
| 303 | |
| 304 | let is_count = matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(mode, ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Groupedrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Grouped#); |
| 305 | let is_command = table_config.is_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#is_command.; |
| 306 | let mem_as_values = table_config.show_memory_as_valuesrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#show_memory_as_values.; |
| 307 | |
| 308 | match config_columns { |
| 309 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(columns) if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().columns.is_emptyrust-analyzer cargo indexmap 2.14.0 set/impl#[`IndexSet<T, S>`]is_empty().() => columns |
| 310 | .into_iterrust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`&'a IndexSet<T, S>`][IntoIterator]into_iter().() |
| 311 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|c| { |
| 312 | let col = match c { |
| 313 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount# => { |
| 314 | if is_count { |
| 315 | Countrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Count# |
| 316 | } else { |
| 317 | Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid# |
| 318 | } |
| 319 | } |
| 320 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand# => { |
| 321 | if is_command { |
| 322 | Commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Command# |
| 323 | } else { |
| 324 | Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name# |
| 325 | } |
| 326 | } |
| 327 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Cpurust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Cpu# => CpuPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#CpuPercent#, |
| 328 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem# => { |
| 329 | if mem_as_values { |
| 330 | MemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemValue# |
| 331 | } else { |
| 332 | MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent# |
| 333 | } |
| 334 | } |
| 335 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::VirtualMemrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#VirtualMem# => VirtualMemrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#VirtualMem#, |
| 336 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ReadPerSecond# => ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#ReadPerSecond#, |
| 337 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#WritePerSecond# => WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#WritePerSecond#, |
| 338 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#TotalRead# => TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#TotalRead#, |
| 339 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#TotalWrite# => TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#TotalWrite#, |
| 340 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#User# => Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#User#, |
| 341 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State# => Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 342 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Time# => Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Time#, |
| 343 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Priority# => Priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Priority#, |
| 344 | #[cfg(unix)] |
| 345 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Nicerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Nice# => Nicerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Nice#, |
| 346 | #[cfg(feature = "gpu")] |
| 347 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::GpuMemrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#GpuMem# => { |
| 348 | if mem_as_values { |
| 349 | GpuMemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuMemValue# |
| 350 | } else { |
| 351 | GpuMemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuMemPercent# |
| 352 | } |
| 353 | } |
| 354 | #[cfg(feature = "gpu")] |
| 355 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::GpuUtilrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#GpuUtil# => GpuUtilPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuUtilPercent#, |
| 356 | }; |
| 357 | |
| 358 | make_columnrust-analyzer cargo bottom 0.14.9 widgets/process_table/make_column().(col) |
| 359 | }) |
| 360 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 361 | _ => { |
| 362 | let default_columns = [ |
| 363 | if is_count { Countrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Count# } else { Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid# }, |
| 364 | if is_command { Commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Command# } else { Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name# }, |
| 365 | CpuPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#CpuPercent#, |
| 366 | if mem_as_values { MemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemValue# } else { MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent# }, |
| 367 | ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#ReadPerSecond#, |
| 368 | WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#WritePerSecond#, |
| 369 | TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#TotalRead#, |
| 370 | TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#TotalWrite#, |
| 371 | Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#User#, |
| 372 | Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 373 | Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Time#, |
| 374 | Priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Priority#, |
| 375 | // Maybe add nice back as a default when I can figure out how to do the |
| 376 | // default configs better for Windows? As currently otherwise there's a |
| 377 | // mismatch. |
| 378 | ]; |
| 379 | |
| 380 | default_columns.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(make_columnrust-analyzer cargo bottom 0.14.9 widgets/process_table/make_column().).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 381 | } |
| 382 | } |
| 383 | }; |
| 384 | |
| 385 | let column_mapping = columns |
| 386 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 387 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|col| { |
| 388 | use ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::*; |
| 389 | |
| 390 | match col.innerrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]inner().() { |
| 391 | CpuPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#CpuPercent# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Cpurust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Cpu#, |
| 392 | MemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemValue# | MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 393 | VirtualMemrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#VirtualMem# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::VirtualMemrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#VirtualMem#, |
| 394 | Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid# | Countrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Count# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 395 | Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name# | Commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Command# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 396 | ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#ReadPerSecond# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ReadPerSecond#, |
| 397 | WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#WritePerSecond# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#WritePerSecond#, |
| 398 | TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#TotalRead# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#TotalRead#, |
| 399 | TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#TotalWrite# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#TotalWrite#, |
| 400 | Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 401 | Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#User# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#User#, |
| 402 | Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Time# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Time#, |
| 403 | Priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Priority# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Priority#, |
| 404 | #[cfg(unix)] |
| 405 | Nicerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Nice# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Nicerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Nice#, |
| 406 | #[cfg(feature = "gpu")] |
| 407 | GpuMemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuMemValue# | GpuMemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuMemPercent# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::GpuMemrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#GpuMem#, |
| 408 | #[cfg(feature = "gpu")] |
| 409 | GpuUtilPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuUtilPercent# => ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::GpuUtilrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#GpuUtil#, |
| 410 | } |
| 411 | }) |
| 412 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<IndexSetrust-analyzer cargo indexmap 2.14.0 set/IndexSet#<_>>(); |
| 413 | |
| 414 | let configured_default_sort = table_config.default_sortrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#default_sort..and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|c| { |
| 415 | let widget_col = ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::fromrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/impl#[ProcWidgetColumn][`From<&ProcColumn>`]from().(&c); |
| 416 | column_mapping |
| 417 | .get_index_ofrust-analyzer cargo indexmap 2.14.0 set/impl#[`IndexSet<T, S>`]get_index_of().(&widget_col) |
| 418 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|index| (index, columns[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..default_orderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#default_order.)) |
| 419 | }); |
| 420 | |
| 421 | let (default_sort_index, mut default_sort_order) = |
| 422 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pair) = configured_default_sort { |
| 423 | pair |
| 424 | } else if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(mode, ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Treerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Tree# { .. }) { |
| 425 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(index) = column_mapping.get_index_ofrust-analyzer cargo indexmap 2.14.0 set/impl#[`IndexSet<T, S>`]get_index_of().(&ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#) { |
| 426 | (index, columns[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..default_orderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#default_order.) |
| 427 | } else { |
| 428 | (0, columns[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..default_orderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#default_order.) |
| 429 | } |
| 430 | } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(index) = column_mapping.get_index_ofrust-analyzer cargo indexmap 2.14.0 set/impl#[`IndexSet<T, S>`]get_index_of().(&ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Cpurust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Cpu#) { |
| 431 | (index, columns[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..default_orderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#default_order.) |
| 432 | } else { |
| 433 | (0, columns[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..default_orderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#default_order.) |
| 434 | }; |
| 435 | |
| 436 | // If configured, override it with this. |
| 437 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(order) = table_config.sort_orderrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#sort_order. { |
| 438 | default_sort_order = order; |
| 439 | } |
| 440 | |
| 441 | let sort_table = Selfrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]::new_sort_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]new_sort_table().(config, colours); |
| 442 | let table = Selfrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]::new_process_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]new_process_table().( |
| 443 | config, |
| 444 | colours, |
| 445 | columns, |
| 446 | default_sort_index, |
| 447 | default_sort_order, |
| 448 | ); |
| 449 | |
| 450 | let id_pid_map = HashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap#::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`][Default]default().(); |
| 451 | |
| 452 | let mut table = ProcWidgetStaterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState# { |
| 453 | proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search.: process_search_state, |
| 454 | tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table., |
| 455 | sort_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#sort_table., |
| 456 | id_pid_maprust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#id_pid_map., |
| 457 | column_mappingrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#column_mapping., |
| 458 | is_sort_openrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#is_sort_open.: false, |
| 459 | moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode., |
| 460 | force_rerenderrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#force_rerender.: true, |
| 461 | force_update_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#force_update_data.: false, |
| 462 | default_sort_indexrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#default_sort_index., |
| 463 | default_sort_orderrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#default_sort_order., |
| 464 | #[cfg(target_os = "linux")] |
| 465 | hide_k_threadsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#hide_k_threads.: config.hide_k_threadsrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#hide_k_threads., |
| 466 | }; |
| 467 | table.sort_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#sort_table..set_datarust-analyzer cargo bottom 0.14.9 canvas/components/data_table/impl#[`DataTable<DataType, H, S, C>`]set_data().(table.column_textrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]column_text().()); |
| 468 | |
| 469 | table |
| 470 | } |
| 471 | |
| 472 | pub fn is_using_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]is_using_command().(&self) -> bool { |
| 473 | self.column_mappingrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#column_mapping. |
| 474 | .get_index_ofrust-analyzer cargo indexmap 2.14.0 set/impl#[`IndexSet<T, S>`]get_index_of().(&ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#) |
| 475 | .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|index| { |
| 476 | self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table. |
| 477 | .columnsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#columns. |
| 478 | .getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(index) |
| 479 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|col| matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(col.innerrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]inner().(), ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Command#)) |
| 480 | }) |
| 481 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(false) |
| 482 | } |
| 483 | |
| 484 | pub fn is_mem_percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]is_mem_percent().(&self) -> bool { |
| 485 | self.column_mappingrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#column_mapping. |
| 486 | .get_index_ofrust-analyzer cargo indexmap 2.14.0 set/impl#[`IndexSet<T, S>`]get_index_of().(&ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#) |
| 487 | .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|index| self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..columnsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#columns..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(index)) |
| 488 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|col| matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(col.innerrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]inner().(), ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#)) |
| 489 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(false) |
| 490 | } |
| 491 | |
| 492 | fn get_queryrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_query().(&self) -> &Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ProcessQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/ProcessQuery#> { |
| 493 | if self.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..search_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#search_state..is_invalid_or_blank_searchrust-analyzer cargo bottom 0.14.9 app/states/impl#[AppSearchState]is_invalid_or_blank_search().() { |
| 494 | &Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 495 | } else { |
| 496 | &self.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..search_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#search_state..queryrust-analyzer cargo bottom 0.14.9 app/states/AppSearchState#query. |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | /// Update the current table data. |
| 501 | /// |
| 502 | /// This function *only* updates the displayed process data. If there is a |
| 503 | /// need to update the actual *stored* data, call it before this |
| 504 | /// function. |
| 505 | pub fn set_table_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]set_table_data().(&mut self, stored_data: &InnerDatarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#) { |
| 506 | let data = match &self.moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode. { |
| 507 | ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Groupedrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Grouped# | ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Normalrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Normal# => { |
| 508 | self.get_normal_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_normal_data().(&stored_data.process_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#process_data..process_harvestrust-analyzer cargo bottom 0.14.9 app/data/process/ProcessData#process_harvest.) |
| 509 | } |
| 510 | ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Treerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Tree#(collapse) => self.get_tree_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_tree_data().(collapse, stored_data), |
| 511 | }; |
| 512 | self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..set_datarust-analyzer cargo bottom 0.14.9 canvas/components/data_table/impl#[`DataTable<DataType, H, S, C>`]set_data().(data); |
| 513 | self.force_update_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#force_update_data. = false; |
| 514 | } |
| 515 | |
| 516 | fn get_tree_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_tree_data().( |
| 517 | &self, collapsed: &TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#, stored_data: &InnerDatarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#, |
| 518 | ) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#> { |
| 519 | const BRANCH_ENDrust-analyzer cargo bottom 0.14.9 widgets/process_table/BRANCH_END.: char = 'â””'; |
| 520 | const BRANCH_SPLITrust-analyzer cargo bottom 0.14.9 widgets/process_table/BRANCH_SPLIT.: char = '├'; |
| 521 | const BRANCH_HORIZONTALrust-analyzer cargo bottom 0.14.9 widgets/process_table/BRANCH_HORIZONTAL.: char = '─'; |
| 522 | const SPACED_BRANCH_VERTICALrust-analyzer cargo bottom 0.14.9 widgets/process_table/SPACED_BRANCH_VERTICAL.: &str = "│ "; |
| 523 | |
| 524 | let search_query = self.get_queryrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_query().(); |
| 525 | let is_using_command = self.is_using_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]is_using_command().(); |
| 526 | let is_mem_percent = self.is_mem_percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]is_mem_percent().(); |
| 527 | |
| 528 | let ProcessDatarust-analyzer cargo bottom 0.14.9 app/data/process/ProcessData# { |
| 529 | process_harvestrust-analyzer cargo bottom 0.14.9 app/data/process/ProcessData#process_harvest., |
| 530 | process_parent_mappingrust-analyzer cargo bottom 0.14.9 app/data/process/ProcessData#process_parent_mapping., |
| 531 | orphan_pidsrust-analyzer cargo bottom 0.14.9 app/data/process/ProcessData#orphan_pids., |
| 532 | .. |
| 533 | } = &stored_data.process_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#process_data.; |
| 534 | |
| 535 | // Only keep a set of the kept PIDs. |
| 536 | let kept_pids = stored_data |
| 537 | .process_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#process_data. |
| 538 | .process_harvestrust-analyzer cargo bottom 0.14.9 app/data/process/ProcessData#process_harvest. |
| 539 | .iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().() |
| 540 | .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|(pid, process)| { |
| 541 | if search_query |
| 542 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 543 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|q| q.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[ProcessQuery]check().(process, is_using_command)) |
| 544 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(true) |
| 545 | { |
| 546 | #[cfg(target_os = "linux")] |
| 547 | if self.hide_k_threadsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#hide_k_threads. && process.process_typerust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#process_type..is_kernelrust-analyzer cargo bottom 0.14.9 collection/processes/impl#[ProcessType]is_kernel().() { |
| 548 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 549 | } |
| 550 | |
| 551 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().pid) |
| 552 | } else { |
| 553 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 554 | } |
| 555 | }) |
| 556 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<HashSetrust-analyzer cargo rustc-hash 2.1.3 FxHashSet#<_>>(); |
| 557 | |
| 558 | #[inline] |
| 559 | fn is_ancestor_shownrust-analyzer cargo bottom 0.14.9 widgets/process_table/is_ancestor_shown().( |
| 560 | current_process: &ProcessHarvestrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#, kept_pids: &HashSetrust-analyzer cargo rustc-hash 2.1.3 FxHashSet#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#>, |
| 561 | process_harvest: &BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#, ProcessHarvestrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#>, |
| 562 | ) -> bool { |
| 563 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ppid) = current_process.parent_pidrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#parent_pid. { |
| 564 | if kept_pids.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(&ppid) { |
| 565 | true |
| 566 | } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(parent) = process_harvest.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(&ppid) { |
| 567 | is_ancestor_shownrust-analyzer cargo bottom 0.14.9 widgets/process_table/is_ancestor_shown().(parent, kept_pids, process_harvest) |
| 568 | } else { |
| 569 | false |
| 570 | } |
| 571 | } else { |
| 572 | false |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | // A process is shown under the filtered tree if at least one of these |
| 577 | // conditions hold: |
| 578 | // - The process itself matches. |
| 579 | // - The process contains some descendant that matches. |
| 580 | // - The process's parent (and only parent, not any ancestor) matches. |
| 581 | let filtered_tree = { |
| 582 | let mut filtered_tree: IntHashMaprust-analyzer cargo bottom 0.14.9 utils/int_hash/IntHashMap#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#>> = IntHashMaprust-analyzer cargo bottom 0.14.9 utils/int_hash/IntHashMap#::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`][Default]default().(); |
| 583 | |
| 584 | // We do a simple DFS traversal to build our filtered parent-to-tree mappings. |
| 585 | let mut visited_pids: IntHashMaprust-analyzer cargo bottom 0.14.9 utils/int_hash/IntHashMap#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#, bool> = IntHashMaprust-analyzer cargo bottom 0.14.9 utils/int_hash/IntHashMap#::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`][Default]default().(); |
| 586 | let mut stack = orphan_pids |
| 587 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 588 | .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|process| process_harvest.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(process)) |
| 589 | .collect_vecrust-analyzer cargo itertools 0.15.0 Itertools#collect_vec().(); |
| 590 | |
| 591 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(process) = stack.lastrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]last().() { |
| 592 | let is_process_matching = kept_pids.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(&process.pidrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#pid.); |
| 593 | |
| 594 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(children_pids) = process_parent_mapping.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&process.pidrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#pid.) { |
| 595 | if children_pids |
| 596 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 597 | .allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]all().(|pid| visited_pids.contains_keyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]contains_key().(pid)) |
| 598 | { |
| 599 | let shown_children = children_pids |
| 600 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 601 | .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|pid| visited_pids.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().pid).copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<&T>`]copied().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(false)) |
| 602 | .collect_vecrust-analyzer cargo itertools 0.15.0 Itertools#collect_vec().(); |
| 603 | |
| 604 | // Show the entry if it is: |
| 605 | // - Matches the filter. |
| 606 | // - Has at least one child (doesn't have to be direct) that matches the |
| 607 | // filter. |
| 608 | // - Is the child of a shown process. |
| 609 | let is_shown = is_process_matching |
| 610 | || !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().shown_children.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() |
| 611 | || is_ancestor_shownrust-analyzer cargo bottom 0.14.9 widgets/process_table/is_ancestor_shown().(process, &kept_pids, process_harvest); |
| 612 | visited_pids.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(process.pidrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#pid., is_shown); |
| 613 | |
| 614 | if is_shown { |
| 615 | filtered_tree.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().( |
| 616 | process.pidrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#pid., |
| 617 | shown_children |
| 618 | .into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().() |
| 619 | .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|pid| { |
| 620 | process_harvest.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(pid).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|process| process.pidrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#pid.) |
| 621 | }) |
| 622 | .collect_vecrust-analyzer cargo itertools 0.15.0 Itertools#collect_vec().(), |
| 623 | ); |
| 624 | } |
| 625 | |
| 626 | stack.poprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]pop().(); |
| 627 | } else { |
| 628 | children_pids |
| 629 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 630 | .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|process| process_harvest.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(process)) |
| 631 | .revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().() |
| 632 | .for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|process| { |
| 633 | stack.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(process); |
| 634 | }); |
| 635 | } |
| 636 | } else { |
| 637 | let is_shown = is_process_matching |
| 638 | || is_ancestor_shownrust-analyzer cargo bottom 0.14.9 widgets/process_table/is_ancestor_shown().(process, &kept_pids, process_harvest); |
| 639 | |
| 640 | if is_shown { |
| 641 | filtered_tree.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(process.pidrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#pid., vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]); |
| 642 | } |
| 643 | |
| 644 | visited_pids.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(process.pidrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#pid., is_shown); |
| 645 | stack.poprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]pop().(); |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | filtered_tree |
| 650 | }; |
| 651 | |
| 652 | let mut data = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 653 | let mut prefixes = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 654 | let mut stack = orphan_pids |
| 655 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 656 | .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|pid| { |
| 657 | if filtered_tree.contains_keyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]contains_key().(pid) { |
| 658 | process_harvest.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(pid).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|process| { |
| 659 | ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#::from_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData]from_data().(process, is_using_command, is_mem_percent) |
| 660 | }) |
| 661 | } else { |
| 662 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 663 | } |
| 664 | }) |
| 665 | .collect_vecrust-analyzer cargo itertools 0.15.0 Itertools#collect_vec().(); |
| 666 | |
| 667 | stack.sort_unstable_by_keyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable_by_key().(|p| p.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.); |
| 668 | |
| 669 | let column = self |
| 670 | .tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table. |
| 671 | .columnsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#columns. |
| 672 | .getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..sort_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]sort_index().()) |
| 673 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("columns should contain the current sort index"); |
| 674 | sort_skip_pid_ascrust-analyzer cargo bottom 0.14.9 widgets/process_table/sort_skip_pid_asc().(column.innerrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]inner().(), &mut stack, self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..orderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]order().()); |
| 675 | |
| 676 | let mut length_stack = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![stack.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()]; |
| 677 | stack.reverserust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]reverse().(); |
| 678 | |
| 679 | while let (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(process), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(siblings_left)) = (stack.poprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]pop().(), length_stack.last_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]last_mut().()) { |
| 680 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().siblings_left rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign().1; |
| 681 | |
| 682 | let disabled = !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().kept_pids.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(&process.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.); |
| 683 | let is_last = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().siblings_left rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0; |
| 684 | |
| 685 | if collapsed.is_collapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]is_collapsed().(process.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.) { |
| 686 | let mut summed_process = process.clonerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData][Clone]clone().(); |
| 687 | let mut has_children = false; |
| 688 | |
| 689 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(children_pids) = filtered_tree.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&process.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.) { |
| 690 | let mut sum_queue = children_pids |
| 691 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 692 | .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|child| { |
| 693 | process_harvest.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(child).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|p| { |
| 694 | ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#::from_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData]from_data().(p, is_using_command, is_mem_percent) |
| 695 | }) |
| 696 | }) |
| 697 | .collect_vecrust-analyzer cargo itertools 0.15.0 Itertools#collect_vec().(); |
| 698 | |
| 699 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(process) = sum_queue.poprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]pop().() { |
| 700 | summed_process.addrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData]add().(&process); |
| 701 | |
| 702 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pids) = filtered_tree.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&process.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.) { |
| 703 | sum_queue.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(pids.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|child| { |
| 704 | process_harvest.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(child).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|p| { |
| 705 | ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#::from_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData]from_data().(p, is_using_command, is_mem_percent) |
| 706 | }) |
| 707 | })); |
| 708 | } |
| 709 | } |
| 710 | |
| 711 | has_children = !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().children_pids.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().(); |
| 712 | } |
| 713 | |
| 714 | // This is so that if an entry is "collapsed" but there are no children, avoid |
| 715 | // drawing the "+". |
| 716 | let prefix = if has_children { |
| 717 | if prefixes.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 718 | "+ ".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 719 | } else { |
| 720 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 721 | "{}{}{} + ", |
| 722 | prefixes.joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(""), |
| 723 | if is_last { BRANCH_ENDrust-analyzer cargo bottom 0.14.9 widgets/process_table/BRANCH_END. } else { BRANCH_SPLITrust-analyzer cargo bottom 0.14.9 widgets/process_table/BRANCH_SPLIT. }, |
| 724 | BRANCH_HORIZONTALrust-analyzer cargo bottom 0.14.9 widgets/process_table/BRANCH_HORIZONTAL. |
| 725 | ) |
| 726 | } |
| 727 | } else if prefixes.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 728 | Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Default]default().() |
| 729 | } else { |
| 730 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 731 | "{}{}{} ", |
| 732 | prefixes.joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(""), |
| 733 | if is_last { BRANCH_ENDrust-analyzer cargo bottom 0.14.9 widgets/process_table/BRANCH_END. } else { BRANCH_SPLITrust-analyzer cargo bottom 0.14.9 widgets/process_table/BRANCH_SPLIT. }, |
| 734 | BRANCH_HORIZONTALrust-analyzer cargo bottom 0.14.9 widgets/process_table/BRANCH_HORIZONTAL. |
| 735 | ) |
| 736 | }; |
| 737 | |
| 738 | data.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(summed_process.prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData]prefix().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(prefix)).disabledrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData]disabled().(disabled)); |
| 739 | } else { |
| 740 | let prefix = if prefixes.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 741 | Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Default]default().() |
| 742 | } else { |
| 743 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 744 | "{}{}{} ", |
| 745 | prefixes.joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(""), |
| 746 | if is_last { BRANCH_ENDrust-analyzer cargo bottom 0.14.9 widgets/process_table/BRANCH_END. } else { BRANCH_SPLITrust-analyzer cargo bottom 0.14.9 widgets/process_table/BRANCH_SPLIT. }, |
| 747 | BRANCH_HORIZONTALrust-analyzer cargo bottom 0.14.9 widgets/process_table/BRANCH_HORIZONTAL. |
| 748 | ) |
| 749 | }; |
| 750 | let pid = process.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.; |
| 751 | data.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(process.prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData]prefix().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(prefix)).disabledrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData]disabled().(disabled)); |
| 752 | |
| 753 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(children_pids) = filtered_tree.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&pid) { |
| 754 | if prefixes.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 755 | prefixes.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(""); |
| 756 | } else { |
| 757 | prefixes.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(if is_last { |
| 758 | " " |
| 759 | } else { |
| 760 | SPACED_BRANCH_VERTICALrust-analyzer cargo bottom 0.14.9 widgets/process_table/SPACED_BRANCH_VERTICAL. |
| 761 | }); |
| 762 | } |
| 763 | |
| 764 | let mut children = children_pids |
| 765 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 766 | .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|child_pid| { |
| 767 | process_harvest.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(child_pid).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|p| { |
| 768 | ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#::from_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData]from_data().(p, is_using_command, is_mem_percent) |
| 769 | }) |
| 770 | }) |
| 771 | .collect_vecrust-analyzer cargo itertools 0.15.0 Itertools#collect_vec().(); |
| 772 | |
| 773 | column.sort_byrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<T>`]sort_by().(&mut children, self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..orderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]order().().revrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[SortOrder]rev().()); |
| 774 | |
| 775 | length_stack.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(children.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()); |
| 776 | stack.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(children); |
| 777 | } |
| 778 | } |
| 779 | |
| 780 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(children_left) = length_stack.lastrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]last().() { |
| 781 | if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().children_left rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { |
| 782 | length_stack.poprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]pop().(); |
| 783 | prefixes.poprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]pop().(); |
| 784 | } else { |
| 785 | break; |
| 786 | } |
| 787 | } |
| 788 | } |
| 789 | |
| 790 | data |
| 791 | } |
| 792 | |
| 793 | fn get_normal_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_normal_data().( |
| 794 | &mut self, process_harvest: &BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#, ProcessHarvestrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#>, |
| 795 | ) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#> { |
| 796 | let search_query = self.get_queryrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_query().(); |
| 797 | let is_using_command = self.is_using_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]is_using_command().(); |
| 798 | let is_mem_percent = self.is_mem_percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]is_mem_percent().(); |
| 799 | |
| 800 | let filtered_iter = process_harvest.valuesrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]values().().filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|process| { |
| 801 | #[cfg(target_os = "linux")] |
| 802 | if self.hide_k_threadsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#hide_k_threads. && process.process_typerust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#process_type..is_kernelrust-analyzer cargo bottom 0.14.9 collection/processes/impl#[ProcessType]is_kernel().() { |
| 803 | return false; |
| 804 | } |
| 805 | |
| 806 | search_query |
| 807 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 808 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|query| query.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[ProcessQuery]check().(process, is_using_command)) |
| 809 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(true) |
| 810 | }); |
| 811 | |
| 812 | let mut id_pid_map: HashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#>> = HashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap#::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`][Default]default().(); |
| 813 | let mut filtered_data: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#> = if let ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Groupedrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Grouped# = self.moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode. { |
| 814 | let mut id_process_mapping: HashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap#<&Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#> = HashMaprust-analyzer cargo rustc-hash 2.1.3 FxHashMap#::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`][Default]default().(); |
| 815 | |
| 816 | for process in filtered_iter { |
| 817 | let id = if is_using_command { |
| 818 | &process.commandrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#command. |
| 819 | } else { |
| 820 | &process.namerust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#name. |
| 821 | }; |
| 822 | let pid = process.pidrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#pid.; |
| 823 | |
| 824 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(entry) = id_pid_map.get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get_mut().(id) { |
| 825 | entry.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(pid); |
| 826 | } else { |
| 827 | id_pid_map.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(id.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![pid]); |
| 828 | } |
| 829 | |
| 830 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pwd) = id_process_mapping.get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get_mut().(id) { |
| 831 | pwd.cpu_usage_percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#cpu_usage_percent. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`AddAssign<Self>`]add_assign().process.cpu_usage_percentrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#cpu_usage_percent.; |
| 832 | |
| 833 | match &mut pwd.mem_usagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#mem_usage. { |
| 834 | MemUsagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#::Percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#Percent#(usage) => { |
| 835 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().usage rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`AddAssign<Self>`]add_assign().process.mem_usage_percentrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#mem_usage_percent.; |
| 836 | } |
| 837 | MemUsagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#::Bytesrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#Bytes#(usage) => { |
| 838 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().usage rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().process.mem_usagerust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#mem_usage.; |
| 839 | } |
| 840 | } |
| 841 | |
| 842 | pwd.rpsrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#rps. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().process.read_per_secrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#read_per_sec.; |
| 843 | pwd.wpsrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#wps. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().process.write_per_secrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#write_per_sec.; |
| 844 | pwd.total_readrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#total_read. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().process.total_readrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#total_read.; |
| 845 | pwd.total_writerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#total_write. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().process.total_writerust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#total_write.; |
| 846 | pwd.timerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#time. = pwd.timerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#time..maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#max().(process.timerust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#time.); |
| 847 | #[cfg(feature = "gpu")] |
| 848 | { |
| 849 | pwd.gpu_usagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#gpu_usage. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`AddAssign<Self>`]add_assign().process.gpu_utilrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#gpu_util.; |
| 850 | match &mut pwd.gpu_mem_usagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#gpu_mem_usage. { |
| 851 | MemUsagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#::Percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#Percent#(usage) => { |
| 852 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().usage rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][`AddAssign<Self>`]add_assign().process.gpu_mem_percentrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#gpu_mem_percent.; |
| 853 | } |
| 854 | MemUsagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#::Bytesrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#Bytes#(usage) => { |
| 855 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().usage rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().process.gpu_memrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#gpu_mem.; |
| 856 | } |
| 857 | } |
| 858 | } |
| 859 | |
| 860 | pwd.num_similarrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#num_similar. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().1; |
| 861 | } else { |
| 862 | id_process_mapping.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().( |
| 863 | id, |
| 864 | ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#::from_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData]from_data().(process, is_using_command, is_mem_percent), |
| 865 | ); |
| 866 | } |
| 867 | } |
| 868 | |
| 869 | id_process_mapping.into_valuesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]into_values().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 870 | } else { |
| 871 | filtered_iter |
| 872 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|process| ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#::from_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData]from_data().(process, is_using_command, is_mem_percent)) |
| 873 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 874 | }; |
| 875 | |
| 876 | self.id_pid_maprust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#id_pid_map. = id_pid_map; |
| 877 | |
| 878 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(column) = self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..columnsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#columns..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..sort_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]sort_index().()) { |
| 879 | sort_skip_pid_ascrust-analyzer cargo bottom 0.14.9 widgets/process_table/sort_skip_pid_asc().(column.innerrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]inner().(), &mut filtered_data, self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..orderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]order().()); |
| 880 | } |
| 881 | |
| 882 | filtered_data |
| 883 | } |
| 884 | |
| 885 | #[inline(always)] |
| 886 | fn get_mut_proc_colrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_mut_proc_col().(&mut self, index: usize) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&mut ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#> { |
| 887 | self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..columnsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#columns..get_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get_mut().(index).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|col| col.inner_mutrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]inner_mut().()) |
| 888 | } |
| 889 | |
| 890 | pub fn toggle_mem_percentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_mem_percentage().(&mut self) { |
| 891 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(index) = self.column_mappingrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#column_mapping..get_index_ofrust-analyzer cargo indexmap 2.14.0 set/impl#[`IndexSet<T, S>`]get_index_of().(&ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#) |
| 892 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mem) = self.get_mut_proc_colrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_mut_proc_col().(index) |
| 893 | { |
| 894 | match mem { |
| 895 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemValue# => { |
| 896 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().mem = ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#; |
| 897 | } |
| 898 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent# => { |
| 899 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().mem = ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemValue#; |
| 900 | } |
| 901 | _ => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(), |
| 902 | } |
| 903 | |
| 904 | self.sort_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#sort_table..set_datarust-analyzer cargo bottom 0.14.9 canvas/components/data_table/impl#[`DataTable<DataType, H, S, C>`]set_data().(self.column_textrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]column_text().()); |
| 905 | self.force_data_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_data_update().(); |
| 906 | } |
| 907 | #[cfg(feature = "gpu")] |
| 908 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(index) = self.column_mappingrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#column_mapping..get_index_ofrust-analyzer cargo indexmap 2.14.0 set/impl#[`IndexSet<T, S>`]get_index_of().(&ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::GpuMemrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#GpuMem#) |
| 909 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mem) = self.get_mut_proc_colrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_mut_proc_col().(index) |
| 910 | { |
| 911 | match mem { |
| 912 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::GpuMemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuMemValue# => { |
| 913 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().mem = ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::GpuMemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuMemPercent#; |
| 914 | } |
| 915 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::GpuMemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuMemPercent# => { |
| 916 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().mem = ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::GpuMemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#GpuMemValue#; |
| 917 | } |
| 918 | _ => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(), |
| 919 | } |
| 920 | |
| 921 | self.sort_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#sort_table..set_datarust-analyzer cargo bottom 0.14.9 canvas/components/data_table/impl#[`DataTable<DataType, H, S, C>`]set_data().(self.column_textrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]column_text().()); |
| 922 | self.force_data_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_data_update().(); |
| 923 | } |
| 924 | } |
| 925 | |
| 926 | /// Forces an update of the data stored. |
| 927 | #[inline] |
| 928 | pub fn force_data_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_data_update().(&mut self) { |
| 929 | self.force_update_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#force_update_data. = true; |
| 930 | } |
| 931 | |
| 932 | /// Forces an entire rerender and update of the data stored. |
| 933 | #[inline] |
| 934 | pub fn force_rerender_and_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_rerender_and_update().(&mut self) { |
| 935 | self.force_rerenderrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#force_rerender. = true; |
| 936 | self.force_update_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#force_update_data. = true; |
| 937 | } |
| 938 | |
| 939 | #[cfg(target_os = "linux")] |
| 940 | pub fn toggle_k_threadrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_k_thread().(&mut self) { |
| 941 | self.hide_k_threadsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#hide_k_threads. = !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.hide_k_threadsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#hide_k_threads.; |
| 942 | self.force_rerender_and_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_rerender_and_update().(); |
| 943 | } |
| 944 | |
| 945 | /// Marks the selected column as hidden, and automatically resets the |
| 946 | /// selected column to the default sort index and order. |
| 947 | fn hide_columnrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]hide_column().(&mut self, column: ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#) { |
| 948 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(index) = self.column_mappingrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#column_mapping..get_index_ofrust-analyzer cargo indexmap 2.14.0 set/impl#[`IndexSet<T, S>`]get_index_of().(&column) |
| 949 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(col) = self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..columnsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#columns..get_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get_mut().(index) |
| 950 | { |
| 951 | col.set_hiddenrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]set_hidden().(true); |
| 952 | |
| 953 | if self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..sort_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]sort_index().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().index { |
| 954 | self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..set_sort_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]set_sort_index().(self.default_sort_indexrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#default_sort_index.); |
| 955 | self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..set_orderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]set_order().(self.default_sort_orderrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#default_sort_order.); |
| 956 | } |
| 957 | } |
| 958 | } |
| 959 | |
| 960 | /// Marks the selected column as shown. |
| 961 | fn show_columnrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]show_column().(&mut self, column: ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#) { |
| 962 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(index) = self.column_mappingrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#column_mapping..get_index_ofrust-analyzer cargo indexmap 2.14.0 set/impl#[`IndexSet<T, S>`]get_index_of().(&column) |
| 963 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(col) = self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..columnsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#columns..get_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get_mut().(index) |
| 964 | { |
| 965 | col.set_hiddenrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]set_hidden().(false); |
| 966 | } |
| 967 | } |
| 968 | |
| 969 | /// Select a column. If the column is already selected, then just toggle the |
| 970 | /// sort order. |
| 971 | pub fn select_columnrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]select_column().(&mut self, column: ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#) { |
| 972 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(index) = self.column_mappingrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#column_mapping..get_index_ofrust-analyzer cargo indexmap 2.14.0 set/impl#[`IndexSet<T, S>`]get_index_of().(&column) { |
| 973 | self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..set_sort_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]set_sort_index().(index); |
| 974 | self.force_data_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_data_update().(); |
| 975 | } |
| 976 | } |
| 977 | |
| 978 | pub fn collapse_current_tree_branch_entryrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]collapse_current_tree_branch_entry().(&mut self) { |
| 979 | if let ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Treerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Tree#(collapsed) = &mut self.moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode. |
| 980 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(process) = self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..current_itemrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/impl#[`DataTable<DataType, H, S, C>`]current_item().() |
| 981 | { |
| 982 | collapsed.collapserust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]collapse().(process.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.); |
| 983 | self.force_data_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_data_update().(); |
| 984 | } |
| 985 | } |
| 986 | |
| 987 | pub fn expand_current_tree_branch_entryrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]expand_current_tree_branch_entry().(&mut self) { |
| 988 | if let ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Treerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Tree#(collapsed) = &mut self.moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode. |
| 989 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(process) = self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..current_itemrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/impl#[`DataTable<DataType, H, S, C>`]current_item().() |
| 990 | { |
| 991 | collapsed.expandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]expand().(process.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.); |
| 992 | self.force_data_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_data_update().(); |
| 993 | } |
| 994 | } |
| 995 | |
| 996 | pub fn toggle_current_tree_branch_entryrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_current_tree_branch_entry().(&mut self) { |
| 997 | if let ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Treerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Tree#(collapsed) = &mut self.moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode. |
| 998 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(process) = self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..current_itemrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/impl#[`DataTable<DataType, H, S, C>`]current_item().() |
| 999 | { |
| 1000 | collapsed.togglerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]toggle().(process.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.); |
| 1001 | self.force_data_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_data_update().(); |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | pub fn toggle_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_command().(&mut self) { |
| 1006 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(index) = self |
| 1007 | .column_mappingrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#column_mapping. |
| 1008 | .get_index_ofrust-analyzer cargo indexmap 2.14.0 set/impl#[`IndexSet<T, S>`]get_index_of().(&ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#) |
| 1009 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(col) = self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..columnsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#columns..get_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get_mut().(index) |
| 1010 | { |
| 1011 | let inner = col.inner_mutrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]inner_mut().(); |
| 1012 | match inner { |
| 1013 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name# => { |
| 1014 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().inner = ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Command#; |
| 1015 | if let ColumnWidthBoundsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/ColumnWidthBounds#::Softrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/ColumnWidthBounds#Soft# { max_percentagerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/ColumnWidthBounds#Soft#max_percentage., .. } = col.bounds_mutrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]bounds_mut().() { |
| 1016 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().max_percentage = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0.5); |
| 1017 | } |
| 1018 | } |
| 1019 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Command# => { |
| 1020 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().inner = ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#; |
| 1021 | if let ColumnWidthBoundsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/ColumnWidthBounds#::Softrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/ColumnWidthBounds#Soft# { max_percentagerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/ColumnWidthBounds#Soft#max_percentage., .. } = col.bounds_mutrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]bounds_mut().() { |
| 1022 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().max_percentage = match self.moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode. { |
| 1023 | ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Treerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Tree# { .. } => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0.5), |
| 1024 | ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Groupedrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Grouped# | ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Normalrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Normal# => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0.3), |
| 1025 | }; |
| 1026 | } |
| 1027 | } |
| 1028 | _ => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(), |
| 1029 | } |
| 1030 | self.sort_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#sort_table..set_datarust-analyzer cargo bottom 0.14.9 canvas/components/data_table/impl#[`DataTable<DataType, H, S, C>`]set_data().(self.column_textrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]column_text().()); |
| 1031 | self.force_rerender_and_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_rerender_and_update().(); |
| 1032 | } |
| 1033 | } |
| 1034 | |
| 1035 | /// Toggles the appropriate columns/settings when tab is pressed. |
| 1036 | /// |
| 1037 | /// If count is enabled, we should set the mode to |
| 1038 | /// [`ProcWidgetMode::Grouped`], and switch off the User and State |
| 1039 | /// columns. We should also move the user off of the columns if they were |
| 1040 | /// selected, as those columns are now hidden (handled by internal |
| 1041 | /// method calls), and go back to the "defaults". |
| 1042 | /// |
| 1043 | /// Otherwise, if count is disabled, then if the columns exist, the User and |
| 1044 | /// State columns should be re-enabled, and the mode switched to |
| 1045 | /// [`ProcWidgetMode::Normal`]. |
| 1046 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) fn toggle_tabrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_tab().(&mut self) { |
| 1047 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self.moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode., ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Treerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Tree# { .. }) |
| 1048 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(index) = self |
| 1049 | .column_mappingrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#column_mapping. |
| 1050 | .get_index_ofrust-analyzer cargo indexmap 2.14.0 set/impl#[`IndexSet<T, S>`]get_index_of().(&ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#) |
| 1051 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(sort_col) = self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..columnsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#columns..get_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get_mut().(index) |
| 1052 | { |
| 1053 | let col = sort_col.inner_mutrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]inner_mut().(); |
| 1054 | match col { |
| 1055 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid# => { |
| 1056 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().col = ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Countrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Count#; |
| 1057 | sort_col.default_orderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#default_order. = SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#::Descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#Descending#; |
| 1058 | |
| 1059 | self.hide_columnrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]hide_column().(ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#User#); |
| 1060 | self.hide_columnrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]hide_column().(ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#); |
| 1061 | self.moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode. = ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Groupedrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Grouped#; |
| 1062 | } |
| 1063 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Countrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Count# => { |
| 1064 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().col = ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#; |
| 1065 | sort_col.default_orderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortColumn#default_order. = SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#::Ascendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#Ascending#; |
| 1066 | |
| 1067 | self.show_columnrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]show_column().(ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#User#); |
| 1068 | self.show_columnrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]show_column().(ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#); |
| 1069 | self.moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode. = ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Normalrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Normal#; |
| 1070 | } |
| 1071 | _ => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(), |
| 1072 | } |
| 1073 | |
| 1074 | self.sort_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#sort_table..set_datarust-analyzer cargo bottom 0.14.9 canvas/components/data_table/impl#[`DataTable<DataType, H, S, C>`]set_data().(self.column_textrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]column_text().()); |
| 1075 | self.force_rerender_and_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_rerender_and_update().(); |
| 1076 | } |
| 1077 | } |
| 1078 | |
| 1079 | pub fn column_textrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]column_text().(&self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str>> { |
| 1080 | self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table. |
| 1081 | .columnsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#columns. |
| 1082 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 1083 | .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|c| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().c.is_hiddenrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]is_hidden().()) |
| 1084 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|c| c.innerrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]inner().().textrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/impl#[ProcColumn][ColumnHeader]text().()) |
| 1085 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>() |
| 1086 | } |
| 1087 | |
| 1088 | pub fn is_search_enabledrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]is_search_enabled().(&self) -> bool { |
| 1089 | self.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..search_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#search_state..is_enabledrust-analyzer cargo bottom 0.14.9 app/states/AppSearchState#is_enabled. |
| 1090 | } |
| 1091 | |
| 1092 | /// Update the current search query. |
| 1093 | /// |
| 1094 | /// TODO: Maybe debounce this. |
| 1095 | pub fn update_queryrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]update_query().(&mut self) { |
| 1096 | let current_query = self |
| 1097 | .proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search. |
| 1098 | .search_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#search_state. |
| 1099 | .input_field_staterust-analyzer cargo bottom 0.14.9 app/states/AppSearchState#input_field_state. |
| 1100 | .current_queryrust-analyzer cargo bottom 0.14.9 utils/input/impl#[InputFieldState]current_query().(); |
| 1101 | |
| 1102 | if current_query.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() { |
| 1103 | self.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..search_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#search_state..is_invalid_searchrust-analyzer cargo bottom 0.14.9 app/states/AppSearchState#is_invalid_search. = false; |
| 1104 | self.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..search_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#search_state..error_messagerust-analyzer cargo bottom 0.14.9 app/states/AppSearchState#error_message. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 1105 | } else { |
| 1106 | match parse_queryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/parse_query().(current_query, &self.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..query_optionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#query_options.) { |
| 1107 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(parsed_query) => { |
| 1108 | self.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..search_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#search_state..queryrust-analyzer cargo bottom 0.14.9 app/states/AppSearchState#query. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(parsed_query); |
| 1109 | self.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..search_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#search_state..is_invalid_searchrust-analyzer cargo bottom 0.14.9 app/states/AppSearchState#is_invalid_search. = false; |
| 1110 | self.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..search_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#search_state..error_messagerust-analyzer cargo bottom 0.14.9 app/states/AppSearchState#error_message. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 1111 | } |
| 1112 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) => { |
| 1113 | self.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..search_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#search_state..is_invalid_searchrust-analyzer cargo bottom 0.14.9 app/states/AppSearchState#is_invalid_search. = true; |
| 1114 | self.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..search_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#search_state..error_messagerust-analyzer cargo bottom 0.14.9 app/states/AppSearchState#error_message. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(err.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 1115 | } |
| 1116 | } |
| 1117 | } |
| 1118 | self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..staterust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#state..display_start_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/state/DataTableState#display_start_index. = 0; |
| 1119 | self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..staterust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#state..current_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/state/DataTableState#current_index. = 0; |
| 1120 | |
| 1121 | self.force_data_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_data_update().(); |
| 1122 | } |
| 1123 | |
| 1124 | pub fn clear_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]clear_search().(&mut self) { |
| 1125 | self.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..search_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#search_state..resetrust-analyzer cargo bottom 0.14.9 app/states/impl#[AppSearchState]reset().(); |
| 1126 | self.force_data_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_data_update().(); |
| 1127 | } |
| 1128 | |
| 1129 | /// Sets the [`ProcWidgetState`]'s current sort index to whatever was in the |
| 1130 | /// sort table if possible, then closes the sort table. |
| 1131 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) fn use_sort_table_valuerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]use_sort_table_value().(&mut self) { |
| 1132 | self.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..set_sort_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]set_sort_index().(self.sort_tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#sort_table..current_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/impl#[`DataTable<DataType, H, S, C>`]current_index().()); |
| 1133 | self.is_sort_openrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#is_sort_open. = false; |
| 1134 | self.force_rerender_and_updaterust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]force_rerender_and_update().(); |
| 1135 | } |
| 1136 | |
| 1137 | #[cfg(test)] |
| 1138 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) fn test_equalityrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]test_equality().(&self, other: &Selfrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]) -> bool { |
| 1139 | self.moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode. rust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetMode][`PartialEq<Self>`]eq().==rust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetMode][`PartialEq<Self>`]eq(). rust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetMode][`PartialEq<Self>`]eq().other.moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode. |
| 1140 | && self.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..query_optionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#query_options. rust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[QueryOptions][`PartialEq<Self>`]eq().==rust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[QueryOptions][`PartialEq<Self>`]eq(). rust-analyzer cargo bottom 0.14.9 widgets/process_table/query/impl#[QueryOptions][`PartialEq<Self>`]eq().other.proc_searchrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#proc_search..query_optionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessSearchState#query_options. |
| 1141 | && self |
| 1142 | .tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table. |
| 1143 | .columnsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#columns. |
| 1144 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 1145 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|c| c.headerrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]header().()) |
| 1146 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>() |
| 1147 | ==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().other |
| 1148 | .tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table. |
| 1149 | .columnsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#columns. |
| 1150 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 1151 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|c| c.headerrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]header().()) |
| 1152 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>() |
| 1153 | } |
| 1154 | } |
| 1155 | |
| 1156 | #[inline] |
| 1157 | fn sort_skip_pid_ascrust-analyzer cargo bottom 0.14.9 widgets/process_table/sort_skip_pid_asc().(column: &ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#, data: &mut [ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#], order: SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#) { |
| 1158 | let descending = matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(order, SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#::Descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#Descending#); |
| 1159 | match column { |
| 1160 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid# if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().descending => {} |
| 1161 | _ => { |
| 1162 | column.sort_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/impl#[ProcColumn][SortsRow]sort_data().(data, descending); |
| 1163 | } |
| 1164 | } |
| 1165 | } |
| 1166 | |
| 1167 | #[cfg(test)] |
| 1168 | mod testrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/ { |
| 1169 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#; |
| 1170 | |
| 1171 | use superrust-analyzer cargo bottom 0.14.9 widgets/process_table/::*; |
| 1172 | #[cfg(target_os = "linux")] |
| 1173 | use craterust-analyzer cargo bottom 0.14.9 crate/::collectionrust-analyzer cargo bottom 0.14.9 collection/::processesrust-analyzer cargo bottom 0.14.9 collection/processes/::ProcessTyperust-analyzer cargo bottom 0.14.9 collection/processes/ProcessType#; |
| 1174 | use craterust-analyzer cargo bottom 0.14.9 crate/::widgetsrust-analyzer cargo bottom 0.14.9 widgets/::MemUsagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#; |
| 1175 | |
| 1176 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1177 | fn test_proc_sortrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/test_proc_sort().() { |
| 1178 | let a = ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData# { |
| 1179 | pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.: 1, |
| 1180 | ppidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#ppid.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1181 | idrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#id.: "A".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1182 | cpu_usage_percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#cpu_usage_percent.: 0.0, |
| 1183 | mem_usagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#mem_usage.: MemUsagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#::Percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#Percent#(1.1), |
| 1184 | virtual_memrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#virtual_mem.: 100, |
| 1185 | rpsrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#rps.: 0, |
| 1186 | wpsrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#wps.: 0, |
| 1187 | total_readrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#total_read.: 0, |
| 1188 | total_writerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#total_write.: 0, |
| 1189 | process_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#process_state.: "N/A", |
| 1190 | process_charrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#process_char.: '?', |
| 1191 | #[cfg(unix)] |
| 1192 | userrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#user.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("root".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()), |
| 1193 | #[cfg(not(target_family = "unix"))] |
| 1194 | userrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#user.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("N/A".into()), |
| 1195 | num_similarrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#num_similar.: 0, |
| 1196 | disabledrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#disabled.: false, |
| 1197 | timerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#time.: Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#::from_secsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]from_secs().(0), |
| 1198 | #[cfg(feature = "gpu")] |
| 1199 | gpu_mem_usagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#gpu_mem_usage.: MemUsagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#::Percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#Percent#(1.1), |
| 1200 | #[cfg(feature = "gpu")] |
| 1201 | gpu_usagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#gpu_usage.: 0, |
| 1202 | #[cfg(target_os = "linux")] |
| 1203 | process_typerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#process_type.: craterust-analyzer cargo bottom 0.14.9 crate/::collectionrust-analyzer cargo bottom 0.14.9 collection/::processesrust-analyzer cargo bottom 0.14.9 collection/processes/::ProcessTyperust-analyzer cargo bottom 0.14.9 collection/processes/ProcessType#::Regularrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessType#Regular#, |
| 1204 | #[cfg(unix)] |
| 1205 | nicerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#nice.: 0, |
| 1206 | priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#priority.: -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().20, |
| 1207 | }; |
| 1208 | |
| 1209 | let b = ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData# { |
| 1210 | pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.: 2, |
| 1211 | ppidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#ppid.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1), |
| 1212 | idrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#id.: "B".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1213 | cpu_usage_percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#cpu_usage_percent.: 1.1, |
| 1214 | mem_usagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#mem_usage.: MemUsagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#::Percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#Percent#(2.2), |
| 1215 | ..(a.clonerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData][Clone]clone().()) |
| 1216 | }; |
| 1217 | |
| 1218 | let c = ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData# { |
| 1219 | pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.: 3, |
| 1220 | ppidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#ppid.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1), |
| 1221 | idrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#id.: "C".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1222 | cpu_usage_percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#cpu_usage_percent.: 2.2, |
| 1223 | mem_usagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#mem_usage.: MemUsagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#::Percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#Percent#(0.0), |
| 1224 | ..(a.clonerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData][Clone]clone().()) |
| 1225 | }; |
| 1226 | |
| 1227 | let d = ProcWidgetDatarust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData# { |
| 1228 | pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.: 4, |
| 1229 | ppidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#ppid.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(2), |
| 1230 | idrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#id.: "D".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1231 | cpu_usage_percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#cpu_usage_percent.: 0.0, |
| 1232 | mem_usagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#mem_usage.: MemUsagerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#::Percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/MemUsage#Percent#(0.0), |
| 1233 | ..(a.clonerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData][Clone]clone().()) |
| 1234 | }; |
| 1235 | let mut data = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![d.clonerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData][Clone]clone().(), b.clonerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData][Clone]clone().(), c.clonerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData][Clone]clone().(), a.clonerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/impl#[ProcWidgetData][Clone]clone().()]; |
| 1236 | |
| 1237 | // Assume we had sorted over by pid. |
| 1238 | data.sort_by_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]sort_by_key().(|p| p.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.); |
| 1239 | sort_skip_pid_ascrust-analyzer cargo bottom 0.14.9 widgets/process_table/sort_skip_pid_asc().(&ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::CpuPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#CpuPercent#, &mut data, SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#::Descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#Descending#); |
| 1240 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1241 | [&c, &b, &a, &d].iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|d| d.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), |
| 1242 | data.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|d| d.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), |
| 1243 | ); |
| 1244 | |
| 1245 | // Note that the PID ordering for ties is still ascending. |
| 1246 | data.sort_by_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]sort_by_key().(|p| p.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.); |
| 1247 | sort_skip_pid_ascrust-analyzer cargo bottom 0.14.9 widgets/process_table/sort_skip_pid_asc().(&ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::CpuPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#CpuPercent#, &mut data, SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#::Ascendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#Ascending#); |
| 1248 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1249 | [&a, &d, &b, &c].iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|d| d.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), |
| 1250 | data.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|d| d.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), |
| 1251 | ); |
| 1252 | |
| 1253 | data.sort_by_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]sort_by_key().(|p| p.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.); |
| 1254 | sort_skip_pid_ascrust-analyzer cargo bottom 0.14.9 widgets/process_table/sort_skip_pid_asc().(&ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, &mut data, SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#::Descendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#Descending#); |
| 1255 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1256 | [&b, &a, &c, &d].iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|d| d.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), |
| 1257 | data.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|d| d.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), |
| 1258 | ); |
| 1259 | |
| 1260 | // Note that the PID ordering for ties is still ascending. |
| 1261 | data.sort_by_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]sort_by_key().(|p| p.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.); |
| 1262 | sort_skip_pid_ascrust-analyzer cargo bottom 0.14.9 widgets/process_table/sort_skip_pid_asc().(&ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, &mut data, SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#::Ascendingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#Ascending#); |
| 1263 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1264 | [&c, &d, &a, &b].iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|d| d.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), |
| 1265 | data.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|d| d.pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_data/ProcWidgetData#pid.).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), |
| 1266 | ); |
| 1267 | } |
| 1268 | |
| 1269 | fn get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(table: &ProcessTablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcessTable#) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#> { |
| 1270 | table |
| 1271 | .columnsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#columns. |
| 1272 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 1273 | .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|c| { |
| 1274 | if c.is_hiddenrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]is_hidden().() { |
| 1275 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 1276 | } else { |
| 1277 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().c.innerrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`SortColumn<H>`][`DataTableColumn<H>`]inner().()) |
| 1278 | } |
| 1279 | }) |
| 1280 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>() |
| 1281 | } |
| 1282 | |
| 1283 | fn init_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_state().(table_config: ProcTableConfigrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#, columns: &[ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#]) -> ProcWidgetStaterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState# { |
| 1284 | let config = AppConfigFieldsrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#::defaultrust-analyzer cargo bottom 0.14.9 app/impl#[AppConfigFields][Default]default().(); |
| 1285 | let styling = Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#::defaultrust-analyzer cargo bottom 0.14.9 options/config/style/impl#[Styles][Default]default().(); |
| 1286 | let columns = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(columns.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()); |
| 1287 | |
| 1288 | ProcWidgetStaterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]new().( |
| 1289 | &config, |
| 1290 | ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Normalrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Normal#, |
| 1291 | table_config, |
| 1292 | &styling, |
| 1293 | &columns, |
| 1294 | ) |
| 1295 | } |
| 1296 | |
| 1297 | fn init_default_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_default_state().(columns: &[ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#]) -> ProcWidgetStaterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState# { |
| 1298 | init_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_state().(ProcTableConfigrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#::defaultrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcTableConfig][Default]default().(), columns) |
| 1299 | } |
| 1300 | |
| 1301 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1302 | fn default_sort_honouredrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/default_sort_honoured().() { |
| 1303 | let init_columns = [ |
| 1304 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1305 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1306 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Cpurust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Cpu#, |
| 1307 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1308 | ]; |
| 1309 | |
| 1310 | let state_default = init_default_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_default_state().(&init_columns); |
| 1311 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1312 | state_default.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..sort_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]sort_index().(), |
| 1313 | 2, |
| 1314 | "default sort should be CPU (index 2 in init_columns)" |
| 1315 | ); |
| 1316 | |
| 1317 | let table_config = ProcTableConfigrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig# { |
| 1318 | default_sortrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#default_sort.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#), |
| 1319 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcTableConfig][Default]default().() |
| 1320 | }; |
| 1321 | let state_mem = init_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_state().(table_config, &init_columns); |
| 1322 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(state_mem.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..sort_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]sort_index().(), 3); |
| 1323 | |
| 1324 | let table_config = ProcTableConfigrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig# { |
| 1325 | default_sortrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#default_sort.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#), |
| 1326 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcTableConfig][Default]default().() |
| 1327 | }; |
| 1328 | let state_pid = init_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_state().(table_config, &init_columns); |
| 1329 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(state_pid.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..sort_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]sort_index().(), 0); |
| 1330 | } |
| 1331 | |
| 1332 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1333 | fn default_sort_falls_back_when_column_absentrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/default_sort_falls_back_when_column_absent().() { |
| 1334 | // `default_sort` points at a column the user didn't include. We should |
| 1335 | // fall back to the built-in default rather than panic or pick column 0. |
| 1336 | let init_columns = [ |
| 1337 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1338 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1339 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Cpurust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Cpu#, |
| 1340 | ]; |
| 1341 | |
| 1342 | let table_config = ProcTableConfigrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig# { |
| 1343 | default_sortrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#default_sort.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#), |
| 1344 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcTableConfig][Default]default().() |
| 1345 | }; |
| 1346 | let state = init_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_state().(table_config, &init_columns); |
| 1347 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table..sort_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/impl#[`DataTable<D, H, Sortable, SortColumn<H>>`]sort_index().(), 2); |
| 1348 | } |
| 1349 | |
| 1350 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1351 | fn custom_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/custom_columns().() { |
| 1352 | let init_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1353 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1354 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1355 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1356 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 1357 | ]; |
| 1358 | let columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1359 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1360 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, |
| 1361 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, |
| 1362 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1363 | ]; |
| 1364 | let state = init_default_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_default_state().(&init_columns); |
| 1365 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), columns); |
| 1366 | } |
| 1367 | |
| 1368 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1369 | fn toggle_count_pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/toggle_count_pid().() { |
| 1370 | let init_columns = [ |
| 1371 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1372 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1373 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1374 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 1375 | ]; |
| 1376 | let original_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1377 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1378 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, |
| 1379 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, |
| 1380 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1381 | ]; |
| 1382 | let new_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Countrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Count#, ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#]; |
| 1383 | |
| 1384 | let mut state = init_default_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_default_state().(&init_columns); |
| 1385 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1386 | |
| 1387 | // This should hide the state. |
| 1388 | state.toggle_tabrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_tab().(); |
| 1389 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), new_columns); |
| 1390 | |
| 1391 | // This should re-reveal the state. |
| 1392 | state.toggle_tabrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_tab().(); |
| 1393 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1394 | } |
| 1395 | |
| 1396 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1397 | fn toggle_count_pid_2rust-analyzer cargo bottom 0.14.9 widgets/process_table/test/toggle_count_pid_2().() { |
| 1398 | let init_columns = [ |
| 1399 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1400 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1401 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#User#, |
| 1402 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 1403 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1404 | ]; |
| 1405 | let original_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1406 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, |
| 1407 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, |
| 1408 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#User#, |
| 1409 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1410 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1411 | ]; |
| 1412 | let new_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Countrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Count#]; |
| 1413 | |
| 1414 | let mut state = init_default_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_default_state().(&init_columns); |
| 1415 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1416 | |
| 1417 | // This should hide the state. |
| 1418 | state.toggle_tabrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_tab().(); |
| 1419 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), new_columns); |
| 1420 | |
| 1421 | // This should re-reveal the state. |
| 1422 | state.toggle_tabrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_tab().(); |
| 1423 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1424 | } |
| 1425 | |
| 1426 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1427 | fn toggle_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/toggle_command().() { |
| 1428 | let init_columns = [ |
| 1429 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1430 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 1431 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1432 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1433 | ]; |
| 1434 | let original_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1435 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1436 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1437 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, |
| 1438 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Command#, |
| 1439 | ]; |
| 1440 | let new_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1441 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1442 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1443 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, |
| 1444 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, |
| 1445 | ]; |
| 1446 | |
| 1447 | let table_config = ProcTableConfigrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig# { |
| 1448 | is_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#is_command.: true, |
| 1449 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcTableConfig][Default]default().() |
| 1450 | }; |
| 1451 | let mut state = init_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_state().(table_config, &init_columns); |
| 1452 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1453 | |
| 1454 | state.toggle_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_command().(); |
| 1455 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), new_columns); |
| 1456 | |
| 1457 | state.toggle_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_command().(); |
| 1458 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1459 | } |
| 1460 | |
| 1461 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1462 | fn toggle_mem_percentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/test/toggle_mem_percentage().() { |
| 1463 | let init_columns = [ |
| 1464 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1465 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1466 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 1467 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1468 | ]; |
| 1469 | let original_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1470 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1471 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, |
| 1472 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1473 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, |
| 1474 | ]; |
| 1475 | let new_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1476 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1477 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemValue#, |
| 1478 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1479 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, |
| 1480 | ]; |
| 1481 | |
| 1482 | let mut state = init_default_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_default_state().(&init_columns); |
| 1483 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1484 | |
| 1485 | state.toggle_mem_percentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_mem_percentage().(); |
| 1486 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), new_columns); |
| 1487 | |
| 1488 | state.toggle_mem_percentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_mem_percentage().(); |
| 1489 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1490 | } |
| 1491 | |
| 1492 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1493 | fn toggle_mem_percentage_2rust-analyzer cargo bottom 0.14.9 widgets/process_table/test/toggle_mem_percentage_2().() { |
| 1494 | let init_columns = [ |
| 1495 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1496 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1497 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 1498 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1499 | ]; |
| 1500 | let original_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1501 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1502 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemValue#, |
| 1503 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1504 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, |
| 1505 | ]; |
| 1506 | let new_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1507 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1508 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, |
| 1509 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1510 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, |
| 1511 | ]; |
| 1512 | |
| 1513 | let table_config = ProcTableConfigrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig# { |
| 1514 | show_memory_as_valuesrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#show_memory_as_values.: true, |
| 1515 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcTableConfig][Default]default().() |
| 1516 | }; |
| 1517 | let mut state = init_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_state().(table_config, &init_columns); |
| 1518 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1519 | |
| 1520 | state.toggle_mem_percentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_mem_percentage().(); |
| 1521 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), new_columns); |
| 1522 | |
| 1523 | state.toggle_mem_percentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_mem_percentage().(); |
| 1524 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1525 | } |
| 1526 | |
| 1527 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1528 | fn columns_and_is_using_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/columns_and_is_using_command().() { |
| 1529 | let init_columns = [ |
| 1530 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1531 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1532 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 1533 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1534 | ]; |
| 1535 | let original_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1536 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1537 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, |
| 1538 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1539 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Command#, |
| 1540 | ]; |
| 1541 | |
| 1542 | let table_config = ProcTableConfigrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig# { |
| 1543 | is_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#is_command.: true, |
| 1544 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcTableConfig][Default]default().() |
| 1545 | }; |
| 1546 | let mut state = init_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_state().(table_config, &init_columns); |
| 1547 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1548 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(state.is_using_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]is_using_command().()); |
| 1549 | |
| 1550 | state.toggle_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_command().(); |
| 1551 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().state.is_using_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]is_using_command().()); |
| 1552 | |
| 1553 | state.toggle_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_command().(); |
| 1554 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(state.is_using_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]is_using_command().()); |
| 1555 | } |
| 1556 | |
| 1557 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1558 | fn columns_and_is_memoryrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/columns_and_is_memory().() { |
| 1559 | let init_columns = [ |
| 1560 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1561 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1562 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 1563 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1564 | ]; |
| 1565 | let original_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1566 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1567 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemValue#, |
| 1568 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1569 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, |
| 1570 | ]; |
| 1571 | |
| 1572 | let table_config = ProcTableConfigrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig# { |
| 1573 | show_memory_as_valuesrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#show_memory_as_values.: true, |
| 1574 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcTableConfig][Default]default().() |
| 1575 | }; |
| 1576 | let mut state = init_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_state().(table_config, &init_columns); |
| 1577 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1578 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().state.is_mem_percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]is_mem_percent().()); |
| 1579 | |
| 1580 | state.toggle_mem_percentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_mem_percentage().(); |
| 1581 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(state.is_mem_percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]is_mem_percent().()); |
| 1582 | |
| 1583 | state.toggle_mem_percentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_mem_percentage().(); |
| 1584 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().state.is_mem_percentrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]is_mem_percent().()); |
| 1585 | } |
| 1586 | |
| 1587 | /// Tests toggling if both mem and mem% columns are configured. |
| 1588 | /// |
| 1589 | /// Currently, this test doesn't really do much, since we treat these two |
| 1590 | /// columns as the same - this test is intended for use later when we |
| 1591 | /// might allow both at the same time. |
| 1592 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1593 | fn double_memory_sim_togglerust-analyzer cargo bottom 0.14.9 widgets/process_table/test/double_memory_sim_toggle().() { |
| 1594 | let init_columns = [ |
| 1595 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1596 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1597 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 1598 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1599 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1600 | ]; |
| 1601 | let original_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1602 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, |
| 1603 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1604 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1605 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, |
| 1606 | ]; |
| 1607 | let new_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1608 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemValuerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemValue#, |
| 1609 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1610 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1611 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, |
| 1612 | ]; |
| 1613 | |
| 1614 | let mut state = init_default_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_default_state().(&init_columns); |
| 1615 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1616 | |
| 1617 | state.toggle_mem_percentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_mem_percentage().(); |
| 1618 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), new_columns); |
| 1619 | |
| 1620 | state.toggle_mem_percentagerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_mem_percentage().(); |
| 1621 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1622 | } |
| 1623 | |
| 1624 | /// Tests toggling if both pid and count columns are configured. |
| 1625 | /// |
| 1626 | /// Currently, this test doesn't really do much, since we treat these two |
| 1627 | /// columns as the same - this test is intended for use later when we |
| 1628 | /// might allow both at the same time. |
| 1629 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1630 | fn pid_and_count_sim_togglerust-analyzer cargo bottom 0.14.9 widgets/process_table/test/pid_and_count_sim_toggle().() { |
| 1631 | let init_columns = [ |
| 1632 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1633 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1634 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1635 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 1636 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1637 | ]; |
| 1638 | let original_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1639 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, |
| 1640 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1641 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, |
| 1642 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1643 | ]; |
| 1644 | let new_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Countrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Count#, ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#]; |
| 1645 | |
| 1646 | let mut state = init_default_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_default_state().(&init_columns); |
| 1647 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1648 | |
| 1649 | // This should hide the state. |
| 1650 | state.toggle_tabrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_tab().(); |
| 1651 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), new_columns); |
| 1652 | |
| 1653 | // This should re-reveal the state. |
| 1654 | state.toggle_tabrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_tab().(); |
| 1655 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1656 | } |
| 1657 | |
| 1658 | /// Tests toggling if both command and name columns are configured. |
| 1659 | /// |
| 1660 | /// Currently, this test doesn't really do much, since we treat these two |
| 1661 | /// columns as the same - this test is intended for use later when we |
| 1662 | /// might allow both at the same time. |
| 1663 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1664 | fn command_name_sim_togglerust-analyzer cargo bottom 0.14.9 widgets/process_table/test/command_name_sim_toggle().() { |
| 1665 | let init_columns = [ |
| 1666 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1667 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1668 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 1669 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1670 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1671 | ]; |
| 1672 | let original_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1673 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Command#, |
| 1674 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1675 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1676 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, |
| 1677 | ]; |
| 1678 | let new_columns = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1679 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Name#, |
| 1680 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#Pid#, |
| 1681 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#State#, |
| 1682 | ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::MemPercentrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#MemPercent#, |
| 1683 | ]; |
| 1684 | |
| 1685 | let table_config = ProcTableConfigrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig# { |
| 1686 | is_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcTableConfig#is_command.: true, |
| 1687 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcTableConfig][Default]default().() |
| 1688 | }; |
| 1689 | let mut state = init_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_state().(table_config, &init_columns); |
| 1690 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1691 | |
| 1692 | state.toggle_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_command().(); |
| 1693 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), new_columns); |
| 1694 | |
| 1695 | state.toggle_commandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_command().(); |
| 1696 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(get_columnsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/get_columns().(&state.tablerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#table.), original_columns); |
| 1697 | } |
| 1698 | |
| 1699 | /// Sanity test to ensure tree collapse logic works, both when |
| 1700 | /// enabled-by-default or disabled-by-default. |
| 1701 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1702 | fn test_tree_collapserust-analyzer cargo bottom 0.14.9 widgets/process_table/test/test_tree_collapse().() { |
| 1703 | { |
| 1704 | let mut collapsed_by_default = TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]new().(true); |
| 1705 | |
| 1706 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(collapsed_by_default.is_collapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]is_collapsed().(1)); |
| 1707 | |
| 1708 | collapsed_by_default.collapserust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]collapse().(1); |
| 1709 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(collapsed_by_default.is_collapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]is_collapsed().(1)); |
| 1710 | |
| 1711 | collapsed_by_default.expandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]expand().(1); |
| 1712 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().collapsed_by_default.is_collapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]is_collapsed().(1)); |
| 1713 | |
| 1714 | collapsed_by_default.togglerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]toggle().(1); |
| 1715 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(collapsed_by_default.is_collapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]is_collapsed().(1)); |
| 1716 | |
| 1717 | collapsed_by_default.togglerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]toggle().(1); |
| 1718 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().collapsed_by_default.is_collapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]is_collapsed().(1)); |
| 1719 | } |
| 1720 | |
| 1721 | { |
| 1722 | let mut expanded_by_default = TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]new().(false); |
| 1723 | |
| 1724 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().expanded_by_default.is_collapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]is_collapsed().(1)); |
| 1725 | |
| 1726 | expanded_by_default.collapserust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]collapse().(1); |
| 1727 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(expanded_by_default.is_collapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]is_collapsed().(1)); |
| 1728 | |
| 1729 | expanded_by_default.expandrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]expand().(1); |
| 1730 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().expanded_by_default.is_collapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]is_collapsed().(1)); |
| 1731 | |
| 1732 | expanded_by_default.togglerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]toggle().(1); |
| 1733 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(expanded_by_default.is_collapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]is_collapsed().(1)); |
| 1734 | |
| 1735 | expanded_by_default.togglerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]toggle().(1); |
| 1736 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().expanded_by_default.is_collapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]is_collapsed().(1)); |
| 1737 | } |
| 1738 | } |
| 1739 | #[cfg(target_os = "linux")] |
| 1740 | /// Sanity test to ensure kernel thread processes are toggled |
| 1741 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1742 | fn test_toggle_k_threadsrust-analyzer cargo bottom 0.14.9 widgets/process_table/test/test_toggle_k_threads().() { |
| 1743 | let init_columns = [ |
| 1744 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1745 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#, |
| 1746 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#, |
| 1747 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#, |
| 1748 | ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ProcNameOrCommandrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ProcNameOrCommand#, |
| 1749 | ]; |
| 1750 | let mut state = init_default_staterust-analyzer cargo bottom 0.14.9 widgets/process_table/test/init_default_state().(&init_columns); |
| 1751 | let process_harvest = ProcessHarvestrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest# { |
| 1752 | pidrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#pid.: 1, |
| 1753 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo bottom 0.14.9 collection/processes/impl#[ProcessHarvest][Default]default().() |
| 1754 | }; |
| 1755 | let k_process_harvest = ProcessHarvestrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest# { |
| 1756 | pidrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#pid.: 2, |
| 1757 | process_typerust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#process_type.: ProcessTyperust-analyzer cargo bottom 0.14.9 collection/processes/ProcessType#::Kernelrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessType#Kernel#, |
| 1758 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo bottom 0.14.9 collection/processes/impl#[ProcessHarvest][Default]default().() |
| 1759 | }; |
| 1760 | // test get_normal_data default is filtered by toggle_k_thread |
| 1761 | let mut normal_proc_harvest: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Pidrust-analyzer cargo bottom 0.14.9 collection/processes/Pid#, ProcessHarvestrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#> = BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(); |
| 1762 | normal_proc_harvest.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(1, process_harvest.clonerust-analyzer cargo bottom 0.14.9 collection/processes/impl#[ProcessHarvest][Clone]clone().()); |
| 1763 | normal_proc_harvest.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(2, k_process_harvest.clonerust-analyzer cargo bottom 0.14.9 collection/processes/impl#[ProcessHarvest][Clone]clone().()); |
| 1764 | let default_normal_results = state.get_normal_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_normal_data().(&normal_proc_harvest).lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(); |
| 1765 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(default_normal_results == 2); |
| 1766 | state.toggle_k_threadrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_k_thread().(); |
| 1767 | let filtered_normal_results = state.get_normal_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_normal_data().(&normal_proc_harvest).lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(); |
| 1768 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(filtered_normal_results == 1); |
| 1769 | // test that get_normal_data in grouped mode is still filtered |
| 1770 | state.moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode. = ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Groupedrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Grouped#; |
| 1771 | let filtered_grouped_results = state.get_normal_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_normal_data().(&normal_proc_harvest).lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(); |
| 1772 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(filtered_grouped_results == 1); |
| 1773 | // test that get_tree_data is filtered on toggle_k_thread |
| 1774 | let tree_collapsed = TreeCollapsedrust-analyzer cargo bottom 0.14.9 widgets/process_table/TreeCollapsed#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed]new().(false); |
| 1775 | state.moderust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#mode. = ProcWidgetModerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#::Treerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetMode#Tree#(tree_collapsed.clonerust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[TreeCollapsed][Clone]clone().()); |
| 1776 | state.hide_k_threadsrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetState#hide_k_threads. = false; |
| 1777 | let mut tree_proc_data = ProcessDatarust-analyzer cargo bottom 0.14.9 app/data/process/ProcessData#::defaultrust-analyzer cargo bottom 0.14.9 app/data/process/impl#[ProcessData][Default]default().(); |
| 1778 | tree_proc_data.process_harvestrust-analyzer cargo bottom 0.14.9 app/data/process/ProcessData#process_harvest..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(1, process_harvest); |
| 1779 | tree_proc_data.process_harvestrust-analyzer cargo bottom 0.14.9 app/data/process/ProcessData#process_harvest..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(2, k_process_harvest); |
| 1780 | tree_proc_data.orphan_pidsrust-analyzer cargo bottom 0.14.9 app/data/process/ProcessData#orphan_pids. = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 2]; |
| 1781 | let mut tree_stored_data = InnerDatarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#::defaultrust-analyzer cargo bottom 0.14.9 app/data/store/impl#[InnerData][Default]default().(); |
| 1782 | tree_stored_data.process_datarust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#process_data. = tree_proc_data; |
| 1783 | let default_tree_results = state |
| 1784 | .get_tree_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_tree_data().(&tree_collapsed, &tree_stored_data) |
| 1785 | .lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(); |
| 1786 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(default_tree_results == 2); |
| 1787 | state.toggle_k_threadrust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]toggle_k_thread().(); |
| 1788 | let filtered_tree_results = state |
| 1789 | .get_tree_datarust-analyzer cargo bottom 0.14.9 widgets/process_table/impl#[ProcWidgetState]get_tree_data().(&tree_collapsed, &tree_stored_data) |
| 1790 | .lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(); |
| 1791 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(filtered_tree_results == 1); |
| 1792 | } |
| 1793 | } |