Debian Codegraph @

src/options/config/process.rs

raw symbols SCIP
1 use serderust-analyzer cargo serde 1.0.228 crate/::Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#;
2
3 use craterust-analyzer cargo bottom 0.14.9 crate/::{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/::SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#, widgetsrust-analyzer cargo bottom 0.14.9 widgets/::ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#};
4
5 /// Process configuration fields.
6 #[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:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:)]
7 #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))]
8 #[cfg_attr(test, serde(deny_unknown_fields), 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:))]
9 pub(craterust-analyzer cargo bottom 0.14.9 crate/) struct ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig# {
10 /// A list of process widget columns.
11 #[serderust-analyzer cargo serde_derive 1.0.228 serde:(default)]
12 pub columnsrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#columns.: 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#>, // TODO: make this more composable(?) in the future, we might need to rethink how it's done for custom widgets
13
14 /// The default sort column.
15 #[serderust-analyzer cargo serde_derive 1.0.228 serde:(default)]
16 pub default_sortrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#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#>,
17
18 /// The default sort order. If not set, defaults to column-specific defaults
19 /// (e.g. CPU usage is descending, process names are ascending).
20 #[serderust-analyzer cargo serde_derive 1.0.228 serde:(default)]
21 pub(craterust-analyzer cargo bottom 0.14.9 crate/) sort_orderrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#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#>,
22
23 /// Whether to get process child threads.
24 pub get_threadsrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#get_threads.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
25
26 /// Hide kernel threads from being shown. Linux only.
27 #[cfg_attr(not(target_os = "linux"), allow(dead_code))]
28 pub hide_k_threadsrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#hide_k_threads.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
29
30 /// Collapse the process tree by default when tree mode is set.
31 pub tree_collapserust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#tree_collapse.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
32
33 /// Shows the full command name instead of the process name by default.
34 pub process_commandrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#process_command.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
35
36 // This does nothing on Windows, but we leave it enabled to make the config file consistent
37 // across platforms.
38 //
39 // #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))]
40 /// Disable the advanced kill dialog and just show the basic one with no options.
41 #[cfg_attr(
42 not(any(target_os = "linux", target_os = "macos", target_os = "freebsd")),
43 allow(dead_code)
44 )]
45 pub disable_advanced_killrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#disable_advanced_kill.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
46
47 /// Defaults to showing process memory usage by value.
48 pub default_memory_valuerust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#default_memory_value.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
49
50 /// Groups processes with the same name by default. No effect if `--tree` is set.
51 pub default_groupedrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#default_grouped.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
52
53 /// Enables regex by default while searching.
54 pub regexrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#regex.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
55
56 /// Enables case sensitivity by default when searching.
57 pub case_sensitiverust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#case_sensitive.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
58
59 /// Enables whole-word matching by default while searching.
60 pub whole_wordrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#whole_word.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
61
62 /// Makes the process widget use tree mode by default.
63 pub default_treerust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#default_tree.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
64
65 /// Calculates process CPU usage as a percentage of current usage rather than total usage.
66 pub current_usagerust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#current_usage.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
67
68 /// Show process CPU% usage without averaging over the number of CPU cores.
69 pub unnormalized_cpurust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#unnormalized_cpu.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>,
70 }
71
72 #[cfg(test)]
73 mod testrust-analyzer cargo bottom 0.14.9 options/config/process/test/ {
74 use superrust-analyzer cargo bottom 0.14.9 options/config/process/::{ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#, ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#};
75 use craterust-analyzer cargo bottom 0.14.9 crate/::widgetsrust-analyzer cargo bottom 0.14.9 widgets/::ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#;
76
77 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
78 fn empty_column_settingrust-analyzer cargo bottom 0.14.9 options/config/process/test/empty_column_setting().() {
79 let config = "";
80 let generated: ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig# = toml_editrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 crate/::derust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/::from_strrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/from_str().(config).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
81 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(generated.columnsrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#columns..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().());
82 }
83
84 fn to_columnsrust-analyzer cargo bottom 0.14.9 options/config/process/test/to_columns().(columns: 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#>) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#> {
85 columns
86 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
87 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(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().)
88 .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#<_>>()
89 }
90
91 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
92 fn valid_process_column_configrust-analyzer cargo bottom 0.14.9 options/config/process/test/valid_process_column_config().() {
93 #[cfg(unix)]
94 let config = r#"
95 columns = ["CPU%", "PiD", "user", "MEM", "virt", "Tread", "T.Write", "Rps", "W/s", "tiMe", "USER", "state", "prioRity", "Nice"]
96 "#;
97
98 #[cfg(target_os = "windows")]
99 let config = r#"
100 columns = ["CPU%", "PiD", "user", "MEM", "virt", "Tread", "T.Write", "Rps", "W/s", "tiMe", "USER", "state", "prioRity"]
101 "#;
102
103 let generated: ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig# = toml_editrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 crate/::derust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/::from_strrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/from_str().(config).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
104 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
105 to_columnsrust-analyzer cargo bottom 0.14.9 options/config/process/test/to_columns().(generated.columnsrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#columns.),
106 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
107 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Cpurust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Cpu#,
108 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::PidOrCountrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#PidOrCount#,
109 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#User#,
110 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Memrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Mem#,
111 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::VirtualMemrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#VirtualMem#,
112 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#TotalRead#,
113 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#TotalWrite#,
114 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ReadPerSecond#,
115 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#WritePerSecond#,
116 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Time#,
117 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#User#,
118 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#State#,
119 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Priorityrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Priority#,
120 #[cfg(unix)]
121 ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::Nicerust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#Nice#,
122 ],
123 );
124 }
125
126 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
127 fn bad_process_column_configrust-analyzer cargo bottom 0.14.9 options/config/process/test/bad_process_column_config().() {
128 let config = r#"columns = ["MEM", "TWrite", "Cpuz", "read", "wps"]"#;
129 toml_editrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 crate/::derust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/::from_strrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/from_str().::<ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#>(config).expect_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect_err().("Should error out!");
130 }
131
132 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
133 fn valid_default_sort_configrust-analyzer cargo bottom 0.14.9 options/config/process/test/valid_default_sort_config().() {
134 let config = r#"default_sort = "mem""#;
135 let generated: ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig# = toml_editrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 crate/::derust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/::from_strrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/from_str().(config).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
136 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(generated.default_sortrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#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#));
137
138 let config = r#"default_sort = "PID""#;
139 let generated: ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig# = toml_editrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 crate/::derust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/::from_strrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/from_str().(config).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
140 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(generated.default_sortrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#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#));
141
142 let config = "";
143 let generated: ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig# = toml_editrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 crate/::derust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/::from_strrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/from_str().(config).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
144 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(generated.default_sortrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#default_sort., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
145 }
146
147 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
148 fn invalid_default_sort_configrust-analyzer cargo bottom 0.14.9 options/config/process/test/invalid_default_sort_config().() {
149 let config = r#"default_sort = "soup""#;
150 toml_editrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 crate/::derust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/::from_strrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/from_str().::<ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#>(config).expect_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect_err().("Should error out!");
151 }
152
153 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
154 fn valid_process_column_config_2rust-analyzer cargo bottom 0.14.9 options/config/process/test/valid_process_column_config_2().() {
155 let config = r#"columns = ["Twrite", "T.Write"]"#;
156 let generated: ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig# = toml_editrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 crate/::derust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/::from_strrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/from_str().(config).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
157 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
158 to_columnsrust-analyzer cargo bottom 0.14.9 options/config/process/test/to_columns().(generated.columnsrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#columns.),
159 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#TotalWrite#; 2]
160 );
161
162 let config = r#"columns = ["Tread", "T.read"]"#;
163 let generated: ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig# = toml_editrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 crate/::derust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/::from_strrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/from_str().(config).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
164 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
165 to_columnsrust-analyzer cargo bottom 0.14.9 options/config/process/test/to_columns().(generated.columnsrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#columns.),
166 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#TotalRead#; 2]
167 );
168
169 let config = r#"columns = ["read", "rps", "r/s"]"#;
170 let generated: ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig# = toml_editrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 crate/::derust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/::from_strrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/from_str().(config).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
171 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
172 to_columnsrust-analyzer cargo bottom 0.14.9 options/config/process/test/to_columns().(generated.columnsrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#columns.),
173 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#ReadPerSecond#; 3]
174 );
175
176 let config = r#"columns = ["write", "wps", "w/s"]"#;
177 let generated: ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig# = toml_editrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 crate/::derust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/::from_strrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/from_str().(config).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
178 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
179 to_columnsrust-analyzer cargo bottom 0.14.9 options/config/process/test/to_columns().(generated.columnsrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#columns.),
180 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ProcWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#::WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/ProcWidgetColumn#WritePerSecond#; 3]
181 );
182 }
183
184 /// Test that process enum variants that are advertised in the schema are valid.
185 #[cfg(feature = "generate_schema")]
186 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
187 fn ensure_process_column_schema_is_accepted() {
188 use strum::VariantArray;
189
190 use craterust-analyzer cargo bottom 0.14.9 crate/::optionsrust-analyzer cargo bottom 0.14.9 options/::{Configrust-analyzer cargo bottom 0.14.9 options/config/Config#, ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#};
191
192 for column in ProcColumnrust-analyzer cargo bottom 0.14.9 widgets/process_table/process_columns/ProcColumn#::VARIANTS {
193 for &name in columnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/column!.get_schema_names() {
194 let config = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("[processes]\ncolumns = [\"{name}\"]\n");
195 toml_editrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 crate/::derust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/::from_strrust-analyzer cargo toml_edit 0.25.12+spec-1.1.0 de/from_str().::<Config>(&config).unwrap_or_else(|e| {
196 panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("schema name {name:?} was rejected:\n{e}\nconfig was:\n{config}")
197 });
198 }
199 }
200 }
201 }