Debian Codegraph @

src/widgets/cpu_graph.rs

raw symbols SCIP
1 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#, numrust-analyzer cargo std https://github.com/rust-lang/rust/library/std num/::NonZeroU16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU16#, timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#};
2
3 use concat_stringrust-analyzer cargo concat-string 1.0.1 crate/::concat_stringrust-analyzer cargo concat-string 1.0.1 concat_string!;
4 use ratatuirust-analyzer cargo ratatui 0.30.2 crate/::widgetsrust-analyzer cargo ratatui 0.30.2 widgets/::Rowrust-analyzer cargo ratatui-widgets 0.3.2 table/row/Row#;
5
6 use craterust-analyzer cargo bottom 0.14.9 crate/::{
7 apprust-analyzer cargo bottom 0.14.9 app/::AppConfigFieldsrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#,
8 canvasrust-analyzer cargo bottom 0.14.9 canvas/::{
9 Painterrust-analyzer cargo bottom 0.14.9 canvas/Painter#,
10 componentsrust-analyzer cargo bottom 0.14.9 canvas/components/::data_tablerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/::{
11 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#, 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#, DataTableStylingrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/styling/DataTableStyling#,
12 DataToCellrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/data_type/DataToCell#,
13 },
14 },
15 collectionrust-analyzer cargo bottom 0.14.9 collection/::cpurust-analyzer cargo bottom 0.14.9 collection/cpu/::{CpuDatarust-analyzer cargo bottom 0.14.9 collection/cpu/CpuData#, CpuDataTyperust-analyzer cargo bottom 0.14.9 collection/cpu/CpuDataType#},
16 componentsrust-analyzer cargo bottom 0.14.9 components/::time_seriesrust-analyzer cargo bottom 0.14.9 components/time_series/::{PercentTimeGraphrust-analyzer cargo bottom 0.14.9 components/time_series/percent/PercentTimeGraph#, TimeseriesConfigrust-analyzer cargo bottom 0.14.9 components/time_series/TimeseriesConfig#},
17 optionsrust-analyzer cargo bottom 0.14.9 options/::configrust-analyzer cargo bottom 0.14.9 options/config/::{cpurust-analyzer cargo bottom 0.14.9 options/config/cpu/::CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#, stylerust-analyzer cargo bottom 0.14.9 options/config/style/::Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#},
18 };
19
20 pub enum CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn# {
21 Cpurust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#Cpu#,
22 Userust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#Use# { show_decimalrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#Use#show_decimal.: bool },
23 }
24
25 impl ColumnHeaderrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/ColumnHeader# for CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn# {
26 fn textrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/impl#[CpuWidgetColumn][ColumnHeader]text().(&self) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str> {
27 match self {
28 CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#::Cpurust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#Cpu# => "CPU".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
29 CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#::Userust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#Use# { .. } => "Use".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
30 }
31 }
32 }
33
34 pub enum CpuWidgetTableDatarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData# {
35 Allrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#All#,
36 Entryrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#Entry# { data_typerust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#Entry#data_type.: CpuDataTyperust-analyzer cargo bottom 0.14.9 collection/cpu/CpuDataType#, usagerust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#Entry#usage.: f32 },
37 }
38
39 impl CpuWidgetTableDatarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData# {
40 pub fn from_cpu_datarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/impl#[CpuWidgetTableData]from_cpu_data().(data: &CpuDatarust-analyzer cargo bottom 0.14.9 collection/cpu/CpuData#) -> CpuWidgetTableDatarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData# {
41 CpuWidgetTableDatarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#::Entryrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#Entry# {
42 data_typerust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#Entry#data_type.: data.data_typerust-analyzer cargo bottom 0.14.9 collection/cpu/CpuData#data_type.,
43 usagerust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#Entry#usage.: data.usagerust-analyzer cargo bottom 0.14.9 collection/cpu/CpuData#usage.,
44 }
45 }
46 }
47
48 impl DataToCellrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/data_type/DataToCell#<CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#> for CpuWidgetTableDatarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData# {
49 fn to_cell_textrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/impl#[CpuWidgetTableData][`DataToCell<CpuWidgetColumn>`]to_cell_text().(
50 &self, column: &CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#, calculated_width: NonZeroU16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU16#,
51 ) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str>> {
52 const CPU_TRUNCATE_BREAKPOINTrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CPU_TRUNCATE_BREAKPOINT.: u16 = 5;
53
54 let calculated_width = calculated_width.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]get().();
55
56 // This is a bit of a hack, but apparently we can avoid having to do any fancy
57 // checks of showing the "All" on a specific column if the other is
58 // hidden by just always showing it on the CPU (first) column - if there
59 // isn't room for it, it will just collapse down.
60 //
61 // This is the same for the use percentages - we just *always* show them, and
62 // *always* hide the CPU column if it is too small.
63 match &self {
64 CpuWidgetTableDatarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#::Allrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#All# => match column {
65 CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#::Cpurust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#Cpu# => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("All".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()),
66 CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#::Userust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#Use# { .. } => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
67 },
68 CpuWidgetTableDatarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#::Entryrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#Entry# {
69 data_typerust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#Entry#data_type.,
70 usagerust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#Entry#usage.: last_entry,
71 } => {
72 if calculated_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().0 {
73 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
74 } else {
75 match column {
76 CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#::Cpurust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#Cpu# => match data_type {
77 CpuDataTyperust-analyzer cargo bottom 0.14.9 collection/cpu/CpuDataType#::Avgrust-analyzer cargo bottom 0.14.9 collection/cpu/CpuDataType#Avg# => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("AVG".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()),
78 CpuDataTyperust-analyzer cargo bottom 0.14.9 collection/cpu/CpuDataType#::Cpurust-analyzer cargo bottom 0.14.9 collection/cpu/CpuDataType#Cpu#(index) => {
79 let index_str = index.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().();
80 let text = if calculated_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().CPU_TRUNCATE_BREAKPOINTrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CPU_TRUNCATE_BREAKPOINT. {
81 index_str.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
82 } else {
83 concat_stringrust-analyzer cargo concat-string 1.0.1 concat_string!!("CPU", index_str).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
84 };
85
86 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(text)
87 }
88 },
89 CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#::Userust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#Use# { show_decimalrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#Use#show_decimal. } => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().show_decimal {
90 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{last_entry:.1}%").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
91 } else {
92 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{last_entry:.0}%").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
93 }),
94 }
95 }
96 }
97 }
98 }
99
100 #[inline(always)]
101 fn style_rowrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/impl#[CpuWidgetTableData][`DataToCell<CpuWidgetColumn>`]style_row().<'a>(&self, row: Rowrust-analyzer cargo ratatui-widgets 0.3.2 table/row/Row#<'a>, painter: &Painterrust-analyzer cargo bottom 0.14.9 canvas/Painter#) -> Rowrust-analyzer cargo ratatui-widgets 0.3.2 table/row/Row#<'a> {
102 let style = match self {
103 CpuWidgetTableDatarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#::Allrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#All# => painter.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..all_cpu_colourrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#all_cpu_colour.,
104 CpuWidgetTableDatarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#::Entryrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#Entry# {
105 data_typerust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#Entry#data_type.,
106 usagerust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#Entry#usage.: _,
107 } => match data_type {
108 CpuDataTyperust-analyzer cargo bottom 0.14.9 collection/cpu/CpuDataType#::Avgrust-analyzer cargo bottom 0.14.9 collection/cpu/CpuDataType#Avg# => painter.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..avg_cpu_colourrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#avg_cpu_colour.,
109 CpuDataTyperust-analyzer cargo bottom 0.14.9 collection/cpu/CpuDataType#::Cpurust-analyzer cargo bottom 0.14.9 collection/cpu/CpuDataType#Cpu#(index) => {
110 painter.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..cpu_colour_stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#cpu_colour_styles.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Rem<usize>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Rem<usize>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Rem<usize>`]rem().painter.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..cpu_colour_stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#cpu_colour_styles..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().
111 }
112 },
113 };
114
115 row.stylerust-analyzer cargo ratatui-widgets 0.3.2 table/row/impl#[`Row<'a>`]style().(style)
116 }
117
118 fn column_widthsrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/impl#[CpuWidgetTableData][`DataToCell<CpuWidgetColumn>`]column_widths().<C: DataTableColumnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/DataTableColumn#<CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#>>(
119 _data: &[Selfrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/impl#[CpuWidgetTableData][`DataToCell<CpuWidgetColumn>`]], _columns: &[C],
120 ) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u16>
121 where
122 Selfrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/impl#[CpuWidgetTableData][`DataToCell<CpuWidgetColumn>`]: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
123 {
124 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 3]
125 }
126 }
127
128 pub struct CpuWidgetStaterust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState# {
129 pub graphrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState#graph.: PercentTimeGraphrust-analyzer cargo bottom 0.14.9 components/time_series/percent/PercentTimeGraph#,
130 pub is_legend_hiddenrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState#is_legend_hidden.: bool,
131 pub tablerust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState#table.: DataTablerust-analyzer cargo bottom 0.14.9 canvas/components/data_table/DataTable#<CpuWidgetTableDatarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#, CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#>,
132 pub force_update_datarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState#force_update_data.: bool,
133 }
134
135 impl CpuWidgetStaterust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState# {
136 pub(craterust-analyzer cargo bottom 0.14.9 crate/) fn newrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/impl#[CpuWidgetState]new().(
137 config: &AppConfigFieldsrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#, default_selection: CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#, autohide_timer: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Instantrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/Instant#>,
138 colours: &Stylesrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#,
139 ) -> Selfrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/impl#[CpuWidgetState] {
140 let ts_config = TimeseriesConfigrust-analyzer cargo bottom 0.14.9 components/time_series/TimeseriesConfig# {
141 time_intervalrust-analyzer cargo bottom 0.14.9 components/time_series/TimeseriesConfig#time_interval.: config.time_intervalrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#time_interval.,
142 retention_msrust-analyzer cargo bottom 0.14.9 components/time_series/TimeseriesConfig#retention_ms.: config.retention_msrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#retention_ms.,
143 autohide_timerust-analyzer cargo bottom 0.14.9 components/time_series/TimeseriesConfig#autohide_time.: config.autohide_timerust-analyzer cargo bottom 0.14.9 app/AppConfigFields#autohide_time.,
144 default_time_valuerust-analyzer cargo bottom 0.14.9 components/time_series/TimeseriesConfig#default_time_value.: config.default_time_valuerust-analyzer cargo bottom 0.14.9 app/AppConfigFields#default_time_value.,
145 };
146 let columns = [
147 Columnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/Column#::softrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/impl#[`Column<H>`]soft().(CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#::Cpurust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#Cpu#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0.5)),
148 Columnrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/Column#::softrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/column/impl#[`Column<H>`]soft().(
149 CpuWidgetColumnrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#::Userust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#Use# {
150 show_decimalrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetColumn#Use#show_decimal.: config.show_cpu_decimalrust-analyzer cargo bottom 0.14.9 app/AppConfigFields#show_cpu_decimal.,
151 },
152 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0.5),
153 ),
154 ];
155
156 let props = DataTablePropsrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps# {
157 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#,
158 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.,
159 left_to_rightrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#left_to_right.: false,
160 is_basicrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#is_basic.: false,
161 show_table_scroll_positionrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#show_table_scroll_position.: false, // TODO: Should this be possible?
162 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.,
163 show_current_entry_when_unfocusedrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/props/DataTableProps#show_current_entry_when_unfocused.: true,
164 };
165
166 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);
167 let mut table = 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().(columns, props, styling);
168 match default_selection {
169 CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#::Allrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#All# => {}
170 CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#::Averagerust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#Average# if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().config.show_average_cpurust-analyzer cargo bottom 0.14.9 app/AppConfigFields#show_average_cpu. => {}
171 CpuDefaultrust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#::Averagerust-analyzer cargo bottom 0.14.9 options/config/cpu/CpuDefault#Average# => {
172 table = table.first_draw_indexrust-analyzer cargo bottom 0.14.9 canvas/components/data_table/impl#[`DataTable<DataType, H, S, C>`]first_draw_index().(1);
173 }
174 }
175
176 CpuWidgetStaterust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState# {
177 graphrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState#graph.: PercentTimeGraphrust-analyzer cargo bottom 0.14.9 components/time_series/percent/PercentTimeGraph#::newrust-analyzer cargo bottom 0.14.9 components/time_series/percent/impl#[PercentTimeGraph]new().(ts_config, autohide_timer),
178 is_legend_hiddenrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState#is_legend_hidden.: false,
179 tablerust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState#table.,
180 force_update_datarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState#force_update_data.: false,
181 }
182 }
183
184 /// Forces an update of the data stored.
185 #[inline]
186 pub fn force_data_updaterust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/impl#[CpuWidgetState]force_data_update().(&mut self) {
187 self.force_update_datarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState#force_update_data. = true;
188 }
189
190 pub fn set_legend_datarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/impl#[CpuWidgetState]set_legend_data().(&mut self, data: &[CpuDatarust-analyzer cargo bottom 0.14.9 collection/cpu/CpuData#]) {
191 self.tablerust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState#table..set_datarust-analyzer cargo bottom 0.14.9 canvas/components/data_table/impl#[`DataTable<DataType, H, S, C>`]set_data().(
192 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once().(CpuWidgetTableDatarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#::Allrust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#All#)
193 .chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(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().(CpuWidgetTableDatarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetTableData#::from_cpu_datarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/impl#[CpuWidgetTableData]from_cpu_data().))
194 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(),
195 );
196 self.force_update_datarust-analyzer cargo bottom 0.14.9 widgets/cpu_graph/CpuWidgetState#force_update_data. = false;
197 }
198 }