| 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#; |
| 2 | |
| 3 | use ratatuirust-analyzer cargo ratatui 0.30.2 crate/::{ |
| 4 | Framerust-analyzer cargo ratatui-core 0.1.2 terminal/frame/Frame#, |
| 5 | layoutrust-analyzer cargo ratatui-core 0.1.2 layout/::{Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#, Directionrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#, Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#, Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#}, |
| 6 | }; |
| 7 | |
| 8 | use craterust-analyzer cargo bottom 0.14.9 crate/::{ |
| 9 | apprust-analyzer cargo bottom 0.14.9 app/::Apprust-analyzer cargo bottom 0.14.9 app/App#, |
| 10 | canvasrust-analyzer cargo bottom 0.14.9 canvas/::{Painterrust-analyzer cargo bottom 0.14.9 canvas/Painter#, componentsrust-analyzer cargo bottom 0.14.9 canvas/components/::pipe_gaugerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/::PipeGaugerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#, drawing_utilsrust-analyzer cargo bottom 0.14.9 canvas/drawing_utils/::widget_blockrust-analyzer cargo bottom 0.14.9 canvas/drawing_utils/widget_block().}, |
| 11 | collectionrust-analyzer cargo bottom 0.14.9 collection/::memoryrust-analyzer cargo bottom 0.14.9 collection/memory/::MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData#, |
| 12 | get_binary_unit_and_denominatorrust-analyzer cargo bottom 0.14.9 utils/conversion/get_binary_unit_and_denominator()., |
| 13 | }; |
| 14 | |
| 15 | /// Convert memory info into a string representing a fraction. |
| 16 | #[inline] |
| 17 | fn memory_fraction_labelrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_basic/memory_fraction_label().(data: &MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData#) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str> { |
| 18 | let total_bytes = data.total_bytesrust-analyzer cargo bottom 0.14.9 collection/memory/MemData#total_bytes..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]get().(); |
| 19 | let (unit, denominator) = get_binary_unit_and_denominatorrust-analyzer cargo bottom 0.14.9 utils/conversion/get_binary_unit_and_denominator().(total_bytes); |
| 20 | let used = data.used_bytesrust-analyzer cargo bottom 0.14.9 collection/memory/MemData#used_bytes. as f64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().denominator; |
| 21 | let total = total_bytes as f64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().denominator; |
| 22 | |
| 23 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{used:.1}{unit}/{total:.1}{unit}").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 24 | } |
| 25 | |
| 26 | /// Convert memory info into a string representing a percentage. |
| 27 | #[inline] |
| 28 | fn memory_percentage_labelrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_basic/memory_percentage_label().(data: &MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData#) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str> { |
| 29 | let total_bytes = data.total_bytesrust-analyzer cargo bottom 0.14.9 collection/memory/MemData#total_bytes..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<T>`]get().(); |
| 30 | let percentage = data.used_bytesrust-analyzer cargo bottom 0.14.9 collection/memory/MemData#used_bytes. as f64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().total_bytes as f64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().100.0; |
| 31 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{percentage:3.0}%").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 32 | } |
| 33 | |
| 34 | #[inline] |
| 35 | fn memory_labelrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_basic/memory_label().(data: &MemDatarust-analyzer cargo bottom 0.14.9 collection/memory/MemData#, is_percentage: bool) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str> { |
| 36 | if is_percentage { |
| 37 | memory_percentage_labelrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_basic/memory_percentage_label().(data) |
| 38 | } else { |
| 39 | memory_fraction_labelrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_basic/memory_fraction_label().(data) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | impl Painterrust-analyzer cargo bottom 0.14.9 canvas/Painter# { |
| 44 | pub fn draw_basic_memoryrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_basic/impl#[Painter]draw_basic_memory().( |
| 45 | &self, f: &mut Framerust-analyzer cargo ratatui-core 0.1.2 terminal/frame/Frame#<'_>, app_state: &mut Apprust-analyzer cargo bottom 0.14.9 app/App#, draw_loc: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#, widget_id: u64, |
| 46 | ) { |
| 47 | let mut draw_widgets: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<PipeGaugerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#<'_>> = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 48 | |
| 49 | f.render_widgetrust-analyzer cargo ratatui-core 0.1.2 terminal/frame/impl#[`Frame<'_>`]render_widget().( |
| 50 | widget_blockrust-analyzer cargo bottom 0.14.9 canvas/drawing_utils/widget_block().( |
| 51 | true, |
| 52 | app_state.current_widgetrust-analyzer cargo bottom 0.14.9 app/App#current_widget..widget_idrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#widget_id. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().widget_id, |
| 53 | self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..border_typerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#border_type., |
| 54 | self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..general_widget_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#general_widget_style., |
| 55 | ) |
| 56 | .border_stylerust-analyzer cargo ratatui-widgets 0.3.2 block/impl#[`Block<'a>`]border_style().(self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..highlighted_border_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#highlighted_border_style.), |
| 57 | draw_loc, |
| 58 | ); |
| 59 | |
| 60 | let data = app_state.data_storerust-analyzer cargo bottom 0.14.9 app/App#data_store..get_datarust-analyzer cargo bottom 0.14.9 app/data/store/impl#[DataStore]get_data().(); |
| 61 | |
| 62 | let (ram_percentage, ram_label) = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ram_harvest) = &data.ram_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#ram_harvest. { |
| 63 | ( |
| 64 | ram_harvest.percentagerust-analyzer cargo bottom 0.14.9 collection/memory/impl#[MemData]percentage().(), |
| 65 | memory_labelrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_basic/memory_label().(ram_harvest, app_state.basic_mode_use_percentrust-analyzer cargo bottom 0.14.9 app/App#basic_mode_use_percent.), |
| 66 | ) |
| 67 | } else { |
| 68 | ( |
| 69 | 0.0, |
| 70 | if app_state.basic_mode_use_percentrust-analyzer cargo bottom 0.14.9 app/App#basic_mode_use_percent. { |
| 71 | " 0%".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 72 | } else { |
| 73 | "0.0B/0.0B".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 74 | }, |
| 75 | ) |
| 76 | }; |
| 77 | |
| 78 | draw_widgets.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().( |
| 79 | PipeGaugerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'_>`][Default]default().() |
| 80 | .ratiorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]ratio().(ram_percentage rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().100.0) |
| 81 | .start_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]start_label().("RAM") |
| 82 | .inner_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]inner_label().(ram_label) |
| 83 | .label_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]label_style().(self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..ram_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#ram_style.) |
| 84 | .gauge_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]gauge_style().(self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..ram_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#ram_style.), |
| 85 | ); |
| 86 | |
| 87 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(swap_harvest) = &data.swap_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#swap_harvest. { |
| 88 | let swap_percentage = swap_harvest.percentagerust-analyzer cargo bottom 0.14.9 collection/memory/impl#[MemData]percentage().(); |
| 89 | let swap_label = memory_labelrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_basic/memory_label().(swap_harvest, app_state.basic_mode_use_percentrust-analyzer cargo bottom 0.14.9 app/App#basic_mode_use_percent.); |
| 90 | |
| 91 | draw_widgets.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().( |
| 92 | PipeGaugerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'_>`][Default]default().() |
| 93 | .ratiorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]ratio().(swap_percentage rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().100.0) |
| 94 | .start_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]start_label().("SWP") |
| 95 | .inner_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]inner_label().(swap_label) |
| 96 | .label_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]label_style().(self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..swap_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#swap_style.) |
| 97 | .gauge_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]gauge_style().(self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..swap_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#swap_style.), |
| 98 | ); |
| 99 | } |
| 100 | |
| 101 | #[cfg(not(target_os = "windows"))] |
| 102 | { |
| 103 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cache_harvest) = &data.cache_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#cache_harvest. { |
| 104 | let cache_percentage = cache_harvest.percentagerust-analyzer cargo bottom 0.14.9 collection/memory/impl#[MemData]percentage().(); |
| 105 | let cache_fraction_label = |
| 106 | memory_labelrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_basic/memory_label().(cache_harvest, app_state.basic_mode_use_percentrust-analyzer cargo bottom 0.14.9 app/App#basic_mode_use_percent.); |
| 107 | |
| 108 | draw_widgets.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().( |
| 109 | PipeGaugerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'_>`][Default]default().() |
| 110 | .ratiorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]ratio().(cache_percentage rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().100.0) |
| 111 | .start_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]start_label().("CHE") |
| 112 | .inner_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]inner_label().(cache_fraction_label) |
| 113 | .label_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]label_style().(self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..cache_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#cache_style.) |
| 114 | .gauge_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]gauge_style().(self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..cache_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#cache_style.), |
| 115 | ); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | #[cfg(feature = "zfs")] |
| 120 | { |
| 121 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(arc_harvest) = &data.arc_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#arc_harvest. { |
| 122 | let arc_percentage = arc_harvest.percentagerust-analyzer cargo bottom 0.14.9 collection/memory/impl#[MemData]percentage().(); |
| 123 | let arc_fraction_label = |
| 124 | memory_labelrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_basic/memory_label().(arc_harvest, app_state.basic_mode_use_percentrust-analyzer cargo bottom 0.14.9 app/App#basic_mode_use_percent.); |
| 125 | |
| 126 | draw_widgets.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().( |
| 127 | PipeGaugerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'_>`][Default]default().() |
| 128 | .ratiorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]ratio().(arc_percentage rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().100.0) |
| 129 | .start_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]start_label().("ARC") |
| 130 | .inner_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]inner_label().(arc_fraction_label) |
| 131 | .label_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]label_style().(self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..arc_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#arc_style.) |
| 132 | .gauge_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]gauge_style().(self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..arc_stylerust-analyzer cargo bottom 0.14.9 options/config/style/Styles#arc_style.), |
| 133 | ); |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | #[cfg(feature = "gpu")] |
| 138 | { |
| 139 | let gpu_styles = &self.stylesrust-analyzer cargo bottom 0.14.9 canvas/Painter#styles..gpu_coloursrust-analyzer cargo bottom 0.14.9 options/config/style/Styles#gpu_colours.; |
| 140 | let mut colour_index = 0; |
| 141 | |
| 142 | for (_, harvest) in data.gpu_harvestrust-analyzer cargo bottom 0.14.9 app/data/store/InnerData#gpu_harvest..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 143 | let percentage = harvest.percentagerust-analyzer cargo bottom 0.14.9 collection/memory/impl#[MemData]percentage().(); |
| 144 | let label = memory_labelrust-analyzer cargo bottom 0.14.9 canvas/widgets/mem_basic/memory_label().(harvest, app_state.basic_mode_use_percentrust-analyzer cargo bottom 0.14.9 app/App#basic_mode_use_percent.); |
| 145 | |
| 146 | let style = { |
| 147 | if gpu_styles.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() { |
| 148 | ratatuirust-analyzer cargo ratatui 0.30.2 crate/::stylerust-analyzer cargo ratatui-core 0.1.2 style/::Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#::defaultrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style][Default]default().() |
| 149 | } else { |
| 150 | let colour = gpu_styles[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().colour_index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().gpu_styles.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 151 | colour_index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 152 | |
| 153 | colour |
| 154 | } |
| 155 | }; |
| 156 | |
| 157 | draw_widgets.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().( |
| 158 | PipeGaugerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'_>`][Default]default().() |
| 159 | .ratiorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]ratio().(percentage rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().100.0) |
| 160 | .start_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]start_label().("GPU") |
| 161 | .inner_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]inner_label().(label) |
| 162 | .label_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]label_style().(style) |
| 163 | .gauge_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]gauge_style().(style), |
| 164 | ); |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | let margined_loc = Layoutrust-analyzer cargo ratatui-core 0.1.2 layout/layout/Layout#::defaultrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout][Default]default().() |
| 169 | .constraintsrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]constraints().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Constraintrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#::Lengthrust-analyzer cargo ratatui-core 0.1.2 layout/constraint/Constraint#Length#(1); draw_widgets.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()]) |
| 170 | .directionrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]direction().(Directionrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#::Verticalrust-analyzer cargo ratatui-core 0.1.2 layout/direction/Direction#Vertical#) |
| 171 | .horizontal_marginrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]horizontal_margin().(1) |
| 172 | .splitrust-analyzer cargo ratatui-core 0.1.2 layout/layout/impl#[Layout]split().(draw_loc); |
| 173 | |
| 174 | draw_widgets |
| 175 | .into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().() |
| 176 | .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() |
| 177 | .for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|(index, widget)| { |
| 178 | f.render_widgetrust-analyzer cargo ratatui-core 0.1.2 terminal/frame/impl#[`Frame<'_>`]render_widget().(widget, margined_loc[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().index]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 179 | }); |
| 180 | |
| 181 | // Update draw loc in widget map |
| 182 | if app_state.should_get_widget_boundsrust-analyzer cargo bottom 0.14.9 app/impl#[App]should_get_widget_bounds().() |
| 183 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(widget) = app_state.widget_maprust-analyzer cargo bottom 0.14.9 app/App#widget_map..get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get_mut().(&widget_id) |
| 184 | { |
| 185 | widget.top_left_cornerrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#top_left_corner. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((draw_loc.xrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#x., draw_loc.yrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#y.)); |
| 186 | widget.bottom_right_cornerrust-analyzer cargo bottom 0.14.9 app/layout_manager/BottomWidget#bottom_right_corner. = |
| 187 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((draw_loc.xrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#x. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().draw_loc.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width., draw_loc.yrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#y. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Add<Self>`]add().draw_loc.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height.)); |
| 188 | } |
| 189 | } |
| 190 | } |