| 1 | use serderust-analyzer cargo serde 1.0.228 crate/::Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#; |
| 2 | |
| 3 | /// The default selected entry of the CPU widget. |
| 4 | #[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:, 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:)] |
| 5 | #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))] |
| 6 | #[serde(rename_all = "lowercase")] |
| 7 | #[cfg_attr(test, 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:))] |
| 8 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) enum CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault# { |
| 9 | #[defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/default:] |
| 10 | Allrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#All#, |
| 11 | #[serderust-analyzer cargo serde_derive 1.0.228 serde:(alias = "avg")] |
| 12 | Averagerust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#Average#, |
| 13 | } |
| 14 | |
| 15 | /// CPU column settings. |
| 16 | #[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:)] |
| 17 | #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))] |
| 18 | #[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:))] |
| 19 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) struct CpuConfigrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig# { |
| 20 | /// The default selected entry of the CPU widget. |
| 21 | #[serderust-analyzer cargo serde_derive 1.0.228 serde:(default)] |
| 22 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) defaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig#default.: CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#, |
| 23 | |
| 24 | /// Whether to show a decimal place for CPU usage values. |
| 25 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) show_decimalrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig#show_decimal.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 26 | |
| 27 | /// Whether to hide the average CPU entry. |
| 28 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) hide_avg_cpurust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig#hide_avg_cpu.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 29 | |
| 30 | /// Whether to put the CPU chart legend on the left side. |
| 31 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) left_legendrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig#left_legend.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 32 | |
| 33 | /// Whether to give the average CPU entry a dedicated row in basic mode. |
| 34 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) basic_average_cpu_rowrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig#basic_average_cpu_row.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 35 | } |
| 36 | |
| 37 | #[cfg(test)] |
| 38 | mod testrust-analyzer cargo bottom 0.14.9 options/config/cpu/test/ { |
| 39 | use superrust-analyzer cargo bottom 0.14.9 options/config/cpu/::*; |
| 40 | |
| 41 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 42 | fn default_cpu_defaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/test/default_cpu_default().() { |
| 43 | let config = ""; |
| 44 | let generated: CpuConfigrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig# = 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().(); |
| 45 | match generated.defaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig#default. { |
| 46 | CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#::Allrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#All# => {} |
| 47 | CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#::Averagerust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#Average# => { |
| 48 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("the default should be all") |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 54 | fn all_cpu_defaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/test/all_cpu_default().() { |
| 55 | let config = r#" |
| 56 | default = "all" |
| 57 | "#; |
| 58 | let generated: CpuConfigrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig# = 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().(); |
| 59 | match generated.defaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig#default. { |
| 60 | CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#::Allrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#All# => {} |
| 61 | CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#::Averagerust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#Average# => { |
| 62 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("the default should be all") |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 68 | fn avg_cpu_defaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/test/avg_cpu_default().() { |
| 69 | let config = r#" |
| 70 | default = "avg" |
| 71 | "#; |
| 72 | |
| 73 | let generated: CpuConfigrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig# = 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().(); |
| 74 | match generated.defaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig#default. { |
| 75 | CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#::Allrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#All# => { |
| 76 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("the avg should be set") |
| 77 | } |
| 78 | CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#::Averagerust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#Average# => {} |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 83 | fn average_cpu_defaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/test/average_cpu_default().() { |
| 84 | let config = r#" |
| 85 | default = "average" |
| 86 | "#; |
| 87 | |
| 88 | let generated: CpuConfigrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig# = 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().(); |
| 89 | match generated.defaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig#default. { |
| 90 | CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#::Allrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#All# => { |
| 91 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("the avg should be set") |
| 92 | } |
| 93 | CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#::Averagerust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#Average# => {} |
| 94 | } |
| 95 | } |
| 96 | } |