Debian Codegraph @

src/options/config/temperature.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 superrust-analyzer cargo bottom 0.14.9 options/config/::IgnoreListrust-analyzer cargo bottom 0.14.9 options/config/ignore_list/IgnoreList#;
4 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/::TempWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/temperature_table/TempWidgetColumn#};
5
6 /// Temperature configuration.
7 #[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:)]
8 #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))]
9 #[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:))]
10 pub(craterust-analyzer cargo bottom 0.14.9 crate/) struct TempConfigrust-analyzer cargo bottom 0.14.9 options/config/temperature/TempConfig# {
11 /// A filter over the sensor names.
12 pub(craterust-analyzer cargo bottom 0.14.9 crate/) sensor_filterrust-analyzer cargo bottom 0.14.9 options/config/temperature/TempConfig#sensor_filter.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<IgnoreListrust-analyzer cargo bottom 0.14.9 options/config/ignore_list/IgnoreList#>,
13
14 /// The default sort column.
15 #[serderust-analyzer cargo serde_derive 1.0.228 serde:(default)]
16 pub(craterust-analyzer cargo bottom 0.14.9 crate/) default_sortrust-analyzer cargo bottom 0.14.9 options/config/temperature/TempConfig#default_sort.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TempWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/temperature_table/TempWidgetColumn#>,
17
18 /// The default sort order. Defaults to ascending.
19 #[serderust-analyzer cargo serde_derive 1.0.228 serde:(default)]
20 pub(craterust-analyzer cargo bottom 0.14.9 crate/) sort_orderrust-analyzer cargo bottom 0.14.9 options/config/temperature/TempConfig#sort_order.: SortOrderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/sortable/SortOrder#,
21 }
22
23 #[cfg(test)]
24 mod testsrust-analyzer cargo bottom 0.14.9 options/config/temperature/tests/ {
25 /// Test that temp enum variants that are advertised in the schema are valid.
26 #[cfg(feature = "generate_schema")]
27 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
28 fn ensure_temp_column_schema_is_accepted() {
29 use strum::VariantArray;
30
31 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#, TempWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/temperature_table/TempWidgetColumn#};
32
33 for column in TempWidgetColumn::VARIANTS {
34 for &name in columnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/column!.get_schema_names() {
35 let config = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("[temperature]\ndefault_sort= \"{name}\"\n");
36 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| {
37 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}")
38 });
39 }
40 }
41 }
42 }