| 1 | pub mod cpurust-analyzer cargo bottom 0.14.9 options/config/cpu/; |
| 2 | pub mod diskrust-analyzer cargo bottom 0.14.9 options/config/disk/; |
| 3 | pub mod disk_io_graphrust-analyzer cargo bottom 0.14.9 options/config/disk_io_graph/; |
| 4 | pub mod flagsrust-analyzer cargo bottom 0.14.9 options/config/flags/; |
| 5 | mod ignore_listrust-analyzer cargo bottom 0.14.9 options/config/ignore_list/; |
| 6 | pub mod layoutrust-analyzer cargo bottom 0.14.9 options/config/layout/; |
| 7 | pub mod memory_graphrust-analyzer cargo bottom 0.14.9 options/config/memory_graph/; |
| 8 | pub mod network_graphrust-analyzer cargo bottom 0.14.9 options/config/network_graph/; |
| 9 | pub mod processrust-analyzer cargo bottom 0.14.9 options/config/process/; |
| 10 | pub mod stylerust-analyzer cargo bottom 0.14.9 options/config/style/; |
| 11 | pub mod temperaturerust-analyzer cargo bottom 0.14.9 options/config/temperature/; |
| 12 | pub mod temperature_graphrust-analyzer cargo bottom 0.14.9 options/config/temperature_graph/; |
| 13 | |
| 14 | use diskrust-analyzer cargo bottom 0.14.9 options/config/disk/::DiskConfigrust-analyzer cargo bottom 0.14.9 options/config/disk/DiskConfig#; |
| 15 | use disk_io_graphrust-analyzer cargo bottom 0.14.9 options/config/disk_io_graph/::DiskIoGraphConfigrust-analyzer cargo bottom 0.14.9 options/config/disk_io_graph/DiskIoGraphConfig#; |
| 16 | use flagsrust-analyzer cargo bottom 0.14.9 options/config/flags/::GeneralConfigrust-analyzer cargo bottom 0.14.9 options/config/flags/GeneralConfig#; |
| 17 | use network_graphrust-analyzer cargo bottom 0.14.9 options/config/network_graph/::NetworkGraphConfigrust-analyzer cargo bottom 0.14.9 options/config/network_graph/NetworkGraphConfig#; |
| 18 | use serderust-analyzer cargo serde 1.0.228 crate/::{Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#, Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#}; |
| 19 | use stylerust-analyzer cargo bottom 0.14.9 options/config/style/::StyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#; |
| 20 | use temperaturerust-analyzer cargo bottom 0.14.9 options/config/temperature/::TempConfigrust-analyzer cargo bottom 0.14.9 options/config/temperature/TempConfig#; |
| 21 | use temperature_graphrust-analyzer cargo bottom 0.14.9 options/config/temperature_graph/::TempGraphConfigrust-analyzer cargo bottom 0.14.9 options/config/temperature_graph/TempGraphConfig#; |
| 22 | |
| 23 | pub use selfrust-analyzer cargo bottom 0.14.9 options/config/::ignore_listrust-analyzer cargo bottom 0.14.9 options/config/ignore_list/::IgnoreListrust-analyzer cargo bottom 0.14.9 options/config/ignore_list/IgnoreList#; |
| 24 | use selfrust-analyzer cargo bottom 0.14.9 options/config/::{cpurust-analyzer cargo bottom 0.14.9 options/config/cpu/::CpuConfigrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig#, layoutrust-analyzer cargo bottom 0.14.9 options/config/layout/::Rowrust-analyzer cargo bottom 0.14.9 options/config/layout/Row#, processrust-analyzer cargo bottom 0.14.9 options/config/process/::ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#}; |
| 25 | 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/::memory_graphrust-analyzer cargo bottom 0.14.9 options/config/memory_graph/::MemoryGraphConfigrust-analyzer cargo bottom 0.14.9 options/config/memory_graph/MemoryGraphConfig#; |
| 26 | |
| 27 | /// Overall config for `bottom`. |
| 28 | #[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:)] |
| 29 | #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))] |
| 30 | #[cfg_attr(test, serde(deny_unknown_fields), derive(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:))] |
| 31 | pub struct Configrust-analyzer cargo bottom 0.14.9 options/config/Config# { |
| 32 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) flagsrust-analyzer cargo bottom 0.14.9 options/config/Config#flags.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<GeneralConfigrust-analyzer cargo bottom 0.14.9 options/config/flags/GeneralConfig#>, |
| 33 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) stylesrust-analyzer cargo bottom 0.14.9 options/config/Config#styles.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<StyleConfigrust-analyzer cargo bottom 0.14.9 options/config/style/StyleConfig#>, |
| 34 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) rowrust-analyzer cargo bottom 0.14.9 options/config/Config#row.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Rowrust-analyzer cargo bottom 0.14.9 options/config/layout/Row#>>, |
| 35 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) processesrust-analyzer cargo bottom 0.14.9 options/config/Config#processes.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ProcessesConfigrust-analyzer cargo bottom 0.14.9 options/config/process/ProcessesConfig#>, |
| 36 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) diskrust-analyzer cargo bottom 0.14.9 options/config/Config#disk.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DiskConfigrust-analyzer cargo bottom 0.14.9 options/config/disk/DiskConfig#>, |
| 37 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) disk_io_graphrust-analyzer cargo bottom 0.14.9 options/config/Config#disk_io_graph.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<DiskIoGraphConfigrust-analyzer cargo bottom 0.14.9 options/config/disk_io_graph/DiskIoGraphConfig#>, |
| 38 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) temperaturerust-analyzer cargo bottom 0.14.9 options/config/Config#temperature.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TempConfigrust-analyzer cargo bottom 0.14.9 options/config/temperature/TempConfig#>, |
| 39 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) temperature_graphrust-analyzer cargo bottom 0.14.9 options/config/Config#temperature_graph.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TempGraphConfigrust-analyzer cargo bottom 0.14.9 options/config/temperature_graph/TempGraphConfig#>, |
| 40 | #[serderust-analyzer cargo serde_derive 1.0.228 serde:(alias = "network")] |
| 41 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) network_graphrust-analyzer cargo bottom 0.14.9 options/config/Config#network_graph.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<NetworkGraphConfigrust-analyzer cargo bottom 0.14.9 options/config/network_graph/NetworkGraphConfig#>, |
| 42 | #[serderust-analyzer cargo serde_derive 1.0.228 serde:(alias = "memory")] |
| 43 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) memory_graphrust-analyzer cargo bottom 0.14.9 options/config/Config#memory_graph.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<MemoryGraphConfigrust-analyzer cargo bottom 0.14.9 options/config/memory_graph/MemoryGraphConfig#>, |
| 44 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) cpurust-analyzer cargo bottom 0.14.9 options/config/Config#cpu.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<CpuConfigrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuConfig#>, |
| 45 | } |
| 46 | |
| 47 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)] |
| 48 | #[serde(untagged)] |
| 49 | #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))] |
| 50 | #[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:))] |
| 51 | pub(craterust-analyzer cargo bottom 0.14.9 crate/) enum StringOrNumrust-analyzer cargo bottom 0.14.9 options/config/StringOrNum# { |
| 52 | Stringrust-analyzer cargo bottom 0.14.9 options/config/StringOrNum#String#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 53 | Numrust-analyzer cargo bottom 0.14.9 options/config/StringOrNum#Num#(u64), |
| 54 | } |
| 55 | |
| 56 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> for StringOrNumrust-analyzer cargo bottom 0.14.9 options/config/StringOrNum# { |
| 57 | fn fromrust-analyzer cargo bottom 0.14.9 options/config/impl#[StringOrNum][`From<String>`]from().(value: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Selfrust-analyzer cargo bottom 0.14.9 options/config/impl#[StringOrNum][`From<String>`] { |
| 58 | StringOrNumrust-analyzer cargo bottom 0.14.9 options/config/StringOrNum#::Stringrust-analyzer cargo bottom 0.14.9 options/config/StringOrNum#String#(value) |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<u64> for StringOrNumrust-analyzer cargo bottom 0.14.9 options/config/StringOrNum# { |
| 63 | fn fromrust-analyzer cargo bottom 0.14.9 options/config/impl#[StringOrNum][`From<u64>`]from().(value: u64) -> Selfrust-analyzer cargo bottom 0.14.9 options/config/impl#[StringOrNum][`From<u64>`] { |
| 64 | StringOrNumrust-analyzer cargo bottom 0.14.9 options/config/StringOrNum#::Numrust-analyzer cargo bottom 0.14.9 options/config/StringOrNum#Num#(value) |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | // I didn't do an invalid config test as a lot of them _are_ valid Config |
| 69 | // when parsed, but fail other checks. |
| 70 | #[cfg(test)] |
| 71 | mod testrust-analyzer cargo bottom 0.14.9 options/config/test/ { |
| 72 | |
| 73 | // Test all valid configs in the integration test folder and ensure they are |
| 74 | // accepted. We need this separated as only test library code sets |
| 75 | // `serde(deny_unknown_fields)`. |
| 76 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 77 | #[cfg(feature = "default")] |
| 78 | fn test_integration_valid_configsrust-analyzer cargo bottom 0.14.9 options/config/test/test_integration_valid_configs().() { |
| 79 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/; |
| 80 | |
| 81 | use superrust-analyzer cargo bottom 0.14.9 options/config/::Configrust-analyzer cargo bottom 0.14.9 options/config/Config#; |
| 82 | |
| 83 | for config_path in fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_dir().("./tests/valid_configs").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() { |
| 84 | let dir_entry = config_path.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 85 | let path = dir_entry.pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]path().(); |
| 86 | |
| 87 | if path.is_filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]is_file().() { |
| 88 | let config_path_str = path.displayrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]display().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 89 | let config_str = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_to_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_to_string().(path).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 90 | |
| 91 | 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().::<Configrust-analyzer cargo bottom 0.14.9 options/config/Config#>(&config_str) |
| 92 | .unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_else().(|_| panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("incorrectly rejected '{config_path_str}'")); |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | } |