| 1 | use ratatuirust-analyzer cargo ratatui 0.30.2 crate/::{ |
| 2 | bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/::Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#, |
| 3 | layoutrust-analyzer cargo ratatui-core 0.1.2 layout/::Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#, |
| 4 | stylerust-analyzer cargo ratatui-core 0.1.2 style/::Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 5 | textrust-analyzer cargo ratatui-core 0.1.2 text/::Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#, |
| 6 | widgetsrust-analyzer cargo ratatui 0.30.2 widgets/::{Blockrust-analyzer cargo ratatui-widgets 0.3.2 block/Block#, Widgetrust-analyzer cargo ratatui-core 0.1.2 widgets/widget/Widget#}, |
| 7 | }; |
| 8 | |
| 9 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, 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:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 10 | pub enum LabelLimitrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit# { |
| 11 | #[defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/default:] |
| 12 | Nonerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#None#, |
| 13 | #[expect(dead_code)] |
| 14 | Autorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#Auto#(u16), |
| 15 | Barsrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#Bars#, |
| 16 | StartLabelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#StartLabel#, |
| 17 | } |
| 18 | |
| 19 | /// A widget to measure something, using pipe characters ('|') as a unit. |
| 20 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 21 | pub struct PipeGaugerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#<'a> { |
| 22 | blockrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#block.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Blockrust-analyzer cargo ratatui-widgets 0.3.2 block/Block#<'a>>, |
| 23 | ratiorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#ratio.: f64, |
| 24 | start_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#start_label.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#<'a>>, |
| 25 | inner_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#inner_label.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#<'a>>, |
| 26 | label_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#label_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 27 | gauge_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#gauge_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#, |
| 28 | hide_partsrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#hide_parts.: LabelLimitrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#, |
| 29 | } |
| 30 | |
| 31 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for PipeGaugerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#<'_> { |
| 32 | fn defaultrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'_>`][Default]default().() -> Selfrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'_>`][Default] { |
| 33 | Selfrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'_>`][Default] { |
| 34 | blockrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#block.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 35 | ratiorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#ratio.: 0.0, |
| 36 | start_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#start_label.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 37 | inner_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#inner_label.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 38 | label_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#label_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#::defaultrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style][Default]default().(), |
| 39 | gauge_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#gauge_style.: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#::defaultrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style][Default]default().(), |
| 40 | hide_partsrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#hide_parts.: LabelLimitrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#::defaultrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[LabelLimit][Default]default().(), |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | impl<'a> PipeGaugerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#<'a> { |
| 46 | /// The ratio, a value from 0.0 to 1.0 (any other greater or less will be |
| 47 | /// clamped) represents the portion of the pipe gauge to fill. |
| 48 | /// |
| 49 | /// Note: passing in NaN will potentially cause problems. |
| 50 | pub fn ratiorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]ratio().(mut self, ratio: f64) -> Selfrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`] { |
| 51 | self.ratiorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#ratio. = ratio.clamprust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]clamp().(0.0, 1.0); |
| 52 | |
| 53 | self |
| 54 | } |
| 55 | |
| 56 | /// The label displayed before the bar. |
| 57 | pub fn start_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]start_label().<T>(mut self, start_label: T) -> Selfrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`] |
| 58 | where |
| 59 | T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#<'a>>, |
| 60 | { |
| 61 | self.start_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#start_label. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(start_label.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().()); |
| 62 | self |
| 63 | } |
| 64 | |
| 65 | /// The label displayed inside the bar. |
| 66 | pub fn inner_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]inner_label().<T>(mut self, inner_label: T) -> Selfrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`] |
| 67 | where |
| 68 | T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#<'a>>, |
| 69 | { |
| 70 | self.inner_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#inner_label. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(inner_label.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().()); |
| 71 | self |
| 72 | } |
| 73 | |
| 74 | /// The style of the labels. |
| 75 | pub fn label_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]label_style().(mut self, label_style: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#) -> Selfrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`] { |
| 76 | self.label_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#label_style. = label_style; |
| 77 | self |
| 78 | } |
| 79 | |
| 80 | /// The style of the gauge itself. |
| 81 | pub fn gauge_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]gauge_style().(mut self, style: Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#) -> Selfrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`] { |
| 82 | self.gauge_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#gauge_style. = style; |
| 83 | self |
| 84 | } |
| 85 | |
| 86 | /// Whether to hide parts of the gauge/label if the inner label wouldn't |
| 87 | /// fit. |
| 88 | pub fn hide_partsrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`]hide_parts().(mut self, hide_parts: LabelLimitrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#) -> Selfrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'a>`] { |
| 89 | self.hide_partsrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#hide_parts. = hide_parts; |
| 90 | self |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | impl Widgetrust-analyzer cargo ratatui-core 0.1.2 widgets/widget/Widget# for PipeGaugerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#<'_> { |
| 95 | fn renderrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/impl#[`PipeGauge<'_>`][Widget]render().(mut self, area: Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#, buf: &mut Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#) { |
| 96 | buf.set_stylerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_style().(area, self.label_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#label_style.); |
| 97 | let gauge_area = match self.blockrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#block..takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]take().() { |
| 98 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b) => { |
| 99 | let inner_area = b.innerrust-analyzer cargo ratatui-widgets 0.3.2 block/impl#[`Block<'a>`]inner().(area); |
| 100 | b.renderrust-analyzer cargo ratatui-widgets 0.3.2 block/impl#[`Block<'_>`][Widget]render().(area, buf); |
| 101 | inner_area |
| 102 | } |
| 103 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => area, |
| 104 | }; |
| 105 | |
| 106 | if gauge_area.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height. 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().1 { |
| 107 | return; |
| 108 | } |
| 109 | |
| 110 | let (col, row) = { |
| 111 | let inner_label_width = self |
| 112 | .inner_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#inner_label. |
| 113 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 114 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|l| l.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().()) |
| 115 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); |
| 116 | |
| 117 | let start_label_width = self |
| 118 | .start_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#start_label. |
| 119 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 120 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|l| l.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().()) |
| 121 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().(); |
| 122 | |
| 123 | match self.hide_partsrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#hide_parts. { |
| 124 | LabelLimitrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#::StartLabelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#StartLabel# => { |
| 125 | let inner_label = self.inner_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#inner_label..unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#::fromrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`][`From<&'a str>`]from().("")); |
| 126 | let _ = buf.set_linerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_line().( |
| 127 | gauge_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(), |
| 128 | gauge_area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().(), |
| 129 | &inner_label, |
| 130 | inner_label.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16, |
| 131 | ); |
| 132 | |
| 133 | // Short circuit. |
| 134 | return; |
| 135 | } |
| 136 | LabelLimitrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#::Autorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#Auto#(_) |
| 137 | if gauge_area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#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().(inner_label_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().start_label_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1) as u16 => |
| 138 | { |
| 139 | let inner_label = self.inner_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#inner_label..unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#::fromrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`][`From<&'a str>`]from().("")); |
| 140 | let _ = buf.set_linerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_line().( |
| 141 | gauge_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(), |
| 142 | gauge_area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().(), |
| 143 | &inner_label, |
| 144 | inner_label.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16, |
| 145 | ); |
| 146 | |
| 147 | // Short circuit. |
| 148 | return; |
| 149 | } |
| 150 | _ => { |
| 151 | let start_label = self.start_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#start_label..unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#::fromrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`][`From<&'a str>`]from().("")); |
| 152 | buf.set_linerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_line().( |
| 153 | gauge_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(), |
| 154 | gauge_area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().(), |
| 155 | &start_label, |
| 156 | start_label.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16, |
| 157 | ) |
| 158 | } |
| 159 | } |
| 160 | }; |
| 161 | |
| 162 | let end_label = self.inner_labelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#inner_label..unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#::fromrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`][`From<&'a str>`]from().("")); |
| 163 | match self.hide_partsrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#hide_parts. { |
| 164 | LabelLimitrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#::Barsrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#Bars# => { |
| 165 | let _ = buf.set_linerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_line().( |
| 166 | gauge_area |
| 167 | .rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() |
| 168 | .saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(end_label.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16 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().1), |
| 169 | row, |
| 170 | &end_label, |
| 171 | end_label.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16, |
| 172 | ); |
| 173 | } |
| 174 | LabelLimitrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#::Autorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#Auto#(width_limit) |
| 175 | if gauge_area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().().saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(col) 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().width_limit => |
| 176 | { |
| 177 | let _ = buf.set_linerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_line().( |
| 178 | gauge_area |
| 179 | .rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() |
| 180 | .saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(end_label.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16 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().1), |
| 181 | row, |
| 182 | &end_label, |
| 183 | 1, |
| 184 | ); |
| 185 | } |
| 186 | LabelLimitrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#::Autorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#Auto#(_) | LabelLimitrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#::Nonerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#None# => { |
| 187 | let (start, _) = buf.set_linerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_line().(col, row, &Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#::fromrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`][`From<&'a str>`]from().("["), gauge_area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width.); |
| 188 | if start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]ge().gauge_area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() { |
| 189 | return; |
| 190 | } |
| 191 | |
| 192 | let (end, _) = buf.set_linerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_line().( |
| 193 | (gauge_area.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().gauge_area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width.).saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(1), |
| 194 | row, |
| 195 | &Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#::fromrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`][`From<&'a str>`]from().("]"), |
| 196 | gauge_area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width., |
| 197 | ); |
| 198 | |
| 199 | let pipe_end = end.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(1).minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#min().( |
| 200 | start 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().(f64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[f64][`From<u16>`]from().(end.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(start)) 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().self.ratiorust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#ratio.).floorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]floor().() as u16, |
| 201 | ); |
| 202 | |
| 203 | for col in start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#pipe_end { |
| 204 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cell) = buf.cell_mutrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]cell_mut().((col, row)) { |
| 205 | cell.set_symbolrust-analyzer cargo ratatui-core 0.1.2 buffer/cell/impl#[Cell]set_symbol().("|").set_stylerust-analyzer cargo ratatui-core 0.1.2 buffer/cell/impl#[Cell]set_style().(Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style# { |
| 206 | fgrust-analyzer cargo ratatui-core 0.1.2 style/Style#fg.: self.gauge_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#gauge_style..fgrust-analyzer cargo ratatui-core 0.1.2 style/Style#fg., |
| 207 | bgrust-analyzer cargo ratatui-core 0.1.2 style/Style#bg.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 208 | add_modifierrust-analyzer cargo ratatui-core 0.1.2 style/Style#add_modifier.: self.gauge_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#gauge_style..add_modifierrust-analyzer cargo ratatui-core 0.1.2 style/Style#add_modifier., |
| 209 | sub_modifierrust-analyzer cargo ratatui-core 0.1.2 style/Style#sub_modifier.: self.gauge_stylerust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/PipeGauge#gauge_style..sub_modifierrust-analyzer cargo ratatui-core 0.1.2 style/Style#sub_modifier., |
| 210 | underline_colorrust-analyzer cargo ratatui-core 0.1.2 style/Style#underline_color.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 211 | }); |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | if (end_label.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16) 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().end.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(start) { |
| 216 | let gauge_end = gauge_area |
| 217 | .rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() |
| 218 | .saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]saturating_sub().(end_label.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16 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().1); |
| 219 | buf.set_linerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_line().(gauge_end, row, &end_label, end_label.widthrust-analyzer cargo ratatui-core 0.1.2 text/line/impl#[`Line<'a>`]width().() as u16); |
| 220 | } |
| 221 | } |
| 222 | LabelLimitrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#::StartLabelrust-analyzer cargo bottom 0.14.9 canvas/components/pipe_gauge/LabelLimit#StartLabel# => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(), |
| 223 | } |
| 224 | } |
| 225 | } |