| 1 | //! Vendored from <https://github.com/fdehau/tui-rs/blob/fafad6c96109610825aad89c4bba5253e01101ed/src/widgets/canvas/mod.rs> |
| 2 | //! and <https://github.com/ratatui/ratatui/blob/65c520245aa20e99e64d9ffcb2062a4502a699ea/ratatui-widgets/src/canvas.rs>. |
| 3 | //! |
| 4 | //! The main thing this is pulled in for is overriding how `BrailleGrid`'s draw |
| 5 | //! logic works, as changing it is needed in order to draw all datasets in only |
| 6 | //! one layer back in [`super::TimeChart::render`]. More specifically, |
| 7 | //! the current implementation in ratatui `|=`s all the cells together if they |
| 8 | //! overlap, but since we are smashing all the layers together which may have |
| 9 | //! different colours, we instead just _replace_ whatever was in that cell |
| 10 | //! with the newer colour + character. |
| 11 | //! |
| 12 | //! See <https://github.com/ClementTsang/bottom/pull/918> and <https://github.com/ClementTsang/bottom/pull/937> for the |
| 13 | //! original motivation. |
| 14 | |
| 15 | use ratatuirust-analyzer cargo ratatui 0.30.2 crate/::{ |
| 16 | bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/::Bufferrust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/Buffer#, |
| 17 | layoutrust-analyzer cargo ratatui-core 0.1.2 layout/::Rectrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#, |
| 18 | preluderust-analyzer cargo ratatui 0.30.2 prelude/::BlockExtrust-analyzer cargo ratatui-widgets 0.3.2 block/BlockExt#, |
| 19 | stylerust-analyzer cargo ratatui-core 0.1.2 style/::{Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#, Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#}, |
| 20 | symbolsrust-analyzer cargo ratatui-core 0.1.2 symbols/::Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#, |
| 21 | textrust-analyzer cargo ratatui-core 0.1.2 text/::Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#, |
| 22 | widgetsrust-analyzer cargo ratatui 0.30.2 widgets/::{ |
| 23 | Blockrust-analyzer cargo ratatui-widgets 0.3.2 block/Block#, Widgetrust-analyzer cargo ratatui-core 0.1.2 widgets/widget/Widget#, |
| 24 | canvasrust-analyzer cargo ratatui-widgets 0.3.2 canvas/::{Linerust-analyzer cargo ratatui-widgets 0.3.2 canvas/line/Line# as CanvasLinerust-analyzer cargo ratatui-widgets 0.3.2 canvas/line/Line#, Pointsrust-analyzer cargo ratatui-widgets 0.3.2 canvas/points/Points#}, |
| 25 | }, |
| 26 | }; |
| 27 | use ratatui_corerust-analyzer cargo ratatui-core 0.1.2 crate/::symbolsrust-analyzer cargo ratatui-core 0.1.2 symbols/::{ |
| 28 | braillerust-analyzer cargo ratatui-core 0.1.2 symbols/braille/::BRAILLErust-analyzer cargo ratatui-core 0.1.2 symbols/braille/BRAILLE., |
| 29 | pixelrust-analyzer cargo ratatui-core 0.1.2 symbols/pixel/::{OCTANTSrust-analyzer cargo ratatui-core 0.1.2 symbols/pixel/OCTANTS., QUADRANTSrust-analyzer cargo ratatui-core 0.1.2 symbols/pixel/QUADRANTS., SEXTANTSrust-analyzer cargo ratatui-core 0.1.2 symbols/pixel/SEXTANTS.}, |
| 30 | }; |
| 31 | |
| 32 | use superrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/::gridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/::{CharGridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/CharGrid#, Gridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/Grid#, HalfBlockGridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/HalfBlockGrid#, PatternGridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/PatternGrid#}; |
| 33 | |
| 34 | /// Interface for all shapes that may be drawn on a Canvas widget. |
| 35 | pub trait Shaperust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Shape# { |
| 36 | fn drawrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Shape#draw().(&self, painter: &mut Painterrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#<'_, '_>); |
| 37 | } |
| 38 | |
| 39 | impl Shaperust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Shape# for CanvasLinerust-analyzer cargo ratatui-widgets 0.3.2 canvas/line/Line# { |
| 40 | fn drawrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[CanvasLine][Shape]draw().(&self, painter: &mut Painterrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#<'_, '_>) { |
| 41 | let (x1, y1) = match painter.get_pointrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Painter<'_, '_>`]get_point().(self.x1rust-analyzer cargo ratatui-widgets 0.3.2 canvas/line/Line#x1., self.y1rust-analyzer cargo ratatui-widgets 0.3.2 canvas/line/Line#y1.) { |
| 42 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c) => c, |
| 43 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return, |
| 44 | }; |
| 45 | let (x2, y2) = match painter.get_pointrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Painter<'_, '_>`]get_point().(self.x2rust-analyzer cargo ratatui-widgets 0.3.2 canvas/line/Line#x2., self.y2rust-analyzer cargo ratatui-widgets 0.3.2 canvas/line/Line#y2.) { |
| 46 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c) => c, |
| 47 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return, |
| 48 | }; |
| 49 | let (dx, x_range) = if x2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().x1 { |
| 50 | (x2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().x1, x1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#x2) |
| 51 | } else { |
| 52 | (x1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().x2, x2..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#x1) |
| 53 | }; |
| 54 | let (dy, y_range) = if y2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().y1 { |
| 55 | (y2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().y1, y1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#y2) |
| 56 | } else { |
| 57 | (y1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().y2, y2..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#y1) |
| 58 | }; |
| 59 | |
| 60 | if dx rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { |
| 61 | for y in y_range { |
| 62 | painter.paintrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Painter<'_, '_>`]paint().(x1, y, self.colorrust-analyzer cargo ratatui-widgets 0.3.2 canvas/line/Line#color.); |
| 63 | } |
| 64 | } else if dy rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { |
| 65 | for x in x_range { |
| 66 | painter.paintrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Painter<'_, '_>`]paint().(x, y1, self.colorrust-analyzer cargo ratatui-widgets 0.3.2 canvas/line/Line#color.); |
| 67 | } |
| 68 | } else if dy rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().dx { |
| 69 | if x1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().x2 { |
| 70 | draw_line_lowrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/draw_line_low().(painter, x2, y2, x1, y1, self.colorrust-analyzer cargo ratatui-widgets 0.3.2 canvas/line/Line#color.); |
| 71 | } else { |
| 72 | draw_line_lowrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/draw_line_low().(painter, x1, y1, x2, y2, self.colorrust-analyzer cargo ratatui-widgets 0.3.2 canvas/line/Line#color.); |
| 73 | } |
| 74 | } else if y1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().y2 { |
| 75 | draw_line_highrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/draw_line_high().(painter, x2, y2, x1, y1, self.colorrust-analyzer cargo ratatui-widgets 0.3.2 canvas/line/Line#color.); |
| 76 | } else { |
| 77 | draw_line_highrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/draw_line_high().(painter, x1, y1, x2, y2, self.colorrust-analyzer cargo ratatui-widgets 0.3.2 canvas/line/Line#color.); |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | fn draw_line_lowrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/draw_line_low().( |
| 83 | painter: &mut Painterrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#<'_, '_>, x1: usize, y1: usize, x2: usize, y2: usize, color: Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#, |
| 84 | ) { |
| 85 | let dx = (x2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().x1) as isize; |
| 86 | let dy = (y2 as isize rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Sub<Self>`]sub().y1 as isize).absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[isize]abs().(); |
| 87 | let mut d = 2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().dy rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Sub<Self>`]sub().dx; |
| 88 | let mut y = y1; |
| 89 | for x in x1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#x2 { |
| 90 | painter.paintrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Painter<'_, '_>`]paint().(x, y, color); |
| 91 | if d rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialOrd<Self>`]gt().0 { |
| 92 | y = if y1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().y2 { |
| 93 | y.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_sub().(1) |
| 94 | } else { |
| 95 | y.saturating_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_add().(1) |
| 96 | }; |
| 97 | d rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`SubAssign<Self>`]sub_assign().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().dx; |
| 98 | } |
| 99 | d rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`AddAssign<Self>`]add_assign().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().dy; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | fn draw_line_highrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/draw_line_high().( |
| 104 | painter: &mut Painterrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#<'_, '_>, x1: usize, y1: usize, x2: usize, y2: usize, color: Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#, |
| 105 | ) { |
| 106 | let dx = (x2 as isize rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Sub<Self>`]sub().x1 as isize).absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[isize]abs().(); |
| 107 | let dy = (y2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().y1) as isize; |
| 108 | let mut d = 2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().dx rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Sub<Self>`]sub().dy; |
| 109 | let mut x = x1; |
| 110 | for y in y1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#y2 { |
| 111 | painter.paintrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Painter<'_, '_>`]paint().(x, y, color); |
| 112 | if d rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialOrd<Self>`]gt().0 { |
| 113 | x = if x1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().x2 { |
| 114 | x.saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_sub().(1) |
| 115 | } else { |
| 116 | x.saturating_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_add().(1) |
| 117 | }; |
| 118 | d rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`SubAssign<Self>`]sub_assign().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().dy; |
| 119 | } |
| 120 | d rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`AddAssign<Self>`]add_assign().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().dx; |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | impl Shaperust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Shape# for Pointsrust-analyzer cargo ratatui-widgets 0.3.2 canvas/points/Points#<'_> { |
| 125 | fn drawrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Points<'_>`][Shape]draw().(&self, painter: &mut Painterrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#<'_, '_>) { |
| 126 | for (x, y) in self.coordsrust-analyzer cargo ratatui-widgets 0.3.2 canvas/points/Points#coords. { |
| 127 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((x, y)) = painter.get_pointrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Painter<'_, '_>`]get_point().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().x, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().y) { |
| 128 | painter.paintrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Painter<'_, '_>`]paint().(x, y, self.colorrust-analyzer cargo ratatui-widgets 0.3.2 canvas/points/Points#color.); |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | /// Label to draw some text on the canvas |
| 135 | #[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:)] |
| 136 | pub struct Labelrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Label#<'a> { |
| 137 | xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Label#x.: f64, |
| 138 | yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Label#y.: f64, |
| 139 | spansrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Label#spans.: Linerust-analyzer cargo ratatui-core 0.1.2 text/line/Line#<'a>, |
| 140 | } |
| 141 | |
| 142 | #[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:)] |
| 143 | pub struct Painterrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#<'a, 'b> { |
| 144 | contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#context.: &'a mut Contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#<'b>, |
| 145 | resolutionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#resolution.: (f64, f64), |
| 146 | } |
| 147 | |
| 148 | impl Painterrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#<'_, '_> { |
| 149 | /// Convert the (x, y) coordinates to location of a point on the grid. |
| 150 | pub fn get_pointrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Painter<'_, '_>`]get_point().(&self, x: f64, y: f64) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(usize, usize)> { |
| 151 | let [left, right] = self.contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#context..x_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#x_bounds.; |
| 152 | let [bottom, top] = self.contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#context..y_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#y_bounds.; |
| 153 | if x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]lt().left || x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]gt().right || y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]lt().bottom || y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]gt().top { |
| 154 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 155 | } |
| 156 | let width = right rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().left; |
| 157 | let height = top rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().bottom; |
| 158 | if width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le().0.0 || height rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le().0.0 { |
| 159 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 160 | } |
| 161 | let x = ((x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().left) 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.resolutionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#resolution..0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().1.0) 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().width).roundrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]round().() as usize; |
| 162 | let y = ((top rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().y) 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.resolutionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#resolution..1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().1.0) 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().height).roundrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]round().() as usize; |
| 163 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((x, y)) |
| 164 | } |
| 165 | |
| 166 | /// Paint a point of the grid. |
| 167 | pub fn paintrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Painter<'_, '_>`]paint().(&mut self, x: usize, y: usize, color: Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#) { |
| 168 | self.contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#context..gridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#grid..paintrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/Grid#paint().(x, y, color); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | impl<'a, 'b> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&'a mut Contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#<'b>> for Painterrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#<'a, 'b> { |
| 173 | fn fromrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Painter<'a, 'b>`][`From<&'a mut Context<'b>>`]from().(context: &'a mut Contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#<'b>) -> Painterrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#<'a, 'b> { |
| 174 | let resolution = context.gridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#grid..resolutionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/Grid#resolution().(); |
| 175 | Painterrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter# { |
| 176 | contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#context., |
| 177 | resolutionrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#resolution., |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | /// Holds the state of the Canvas when painting to it. |
| 183 | #[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:)] |
| 184 | pub struct Contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#<'a> { |
| 185 | x_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#x_bounds.: [f64; 2], |
| 186 | y_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#y_bounds.: [f64; 2], |
| 187 | gridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#grid.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Gridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/Grid#>, |
| 188 | dirtyrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#dirty.: bool, |
| 189 | labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#labels.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Labelrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Label#<'a>>, |
| 190 | } |
| 191 | |
| 192 | impl<'a> Contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#<'a> { |
| 193 | pub fn newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Context<'a>`]new().( |
| 194 | width: u16, height: u16, x_bounds: [f64; 2], y_bounds: [f64; 2], marker: Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#, |
| 195 | ) -> Contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#<'a> { |
| 196 | let grid = Selfrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Context<'a>`]::marker_to_gridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Context<'a>`]marker_to_grid().(width, height, marker); |
| 197 | |
| 198 | Contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context# { |
| 199 | x_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#x_bounds., |
| 200 | y_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#y_bounds., |
| 201 | gridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#grid., |
| 202 | dirtyrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#dirty.: false, |
| 203 | labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#labels.: 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().(), |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | fn marker_to_gridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Context<'a>`]marker_to_grid().(width: u16, height: u16, marker: Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Gridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/Grid#> { |
| 208 | match marker { |
| 209 | Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#::Dotrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#Dot# => Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(CharGridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/CharGrid#::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/impl#[CharGrid]new().(width, height, '•')), |
| 210 | Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#::Blockrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#Block# => Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(CharGridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/CharGrid#::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/impl#[CharGrid]new().(width, height, '█').apply_color_to_bgrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/impl#[CharGrid]apply_color_to_bg().()), |
| 211 | Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#::Barrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#Bar# => Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(CharGridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/CharGrid#::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/impl#[CharGrid]new().(width, height, '▄')), |
| 212 | Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#::Braillerust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#Braille# => Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(PatternGridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/PatternGrid#::<2, 4>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/impl#[`PatternGrid<W, H>`]new().(width, height, &BRAILLErust-analyzer cargo ratatui-core 0.1.2 symbols/braille/BRAILLE.)), |
| 213 | Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#::HalfBlockrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#HalfBlock# => Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(HalfBlockGridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/HalfBlockGrid#::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/impl#[HalfBlockGrid]new().(width, height)), |
| 214 | Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#::Quadrantrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#Quadrant# => Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(PatternGridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/PatternGrid#::<2, 2>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/impl#[`PatternGrid<W, H>`]new().(width, height, &QUADRANTSrust-analyzer cargo ratatui-core 0.1.2 symbols/pixel/QUADRANTS.)), |
| 215 | Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#::Sextantrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#Sextant# => Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(PatternGridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/PatternGrid#::<2, 3>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/impl#[`PatternGrid<W, H>`]new().(width, height, &SEXTANTSrust-analyzer cargo ratatui-core 0.1.2 symbols/pixel/SEXTANTS.)), |
| 216 | Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#::Octantrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#Octant# => Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(PatternGridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/PatternGrid#::<2, 4>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/impl#[`PatternGrid<W, H>`]new().(width, height, &OCTANTSrust-analyzer cargo ratatui-core 0.1.2 symbols/pixel/OCTANTS.)), |
| 217 | // Fall back to braille if not supported. |
| 218 | _ => Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(PatternGridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/PatternGrid#::<2, 4>::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/impl#[`PatternGrid<W, H>`]new().(width, height, &BRAILLErust-analyzer cargo ratatui-core 0.1.2 symbols/braille/BRAILLE.)), |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | /// Draw any object that may implement the Shape trait |
| 223 | pub fn drawrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Context<'a>`]draw().<S>(&mut self, shape: &S) |
| 224 | where |
| 225 | S: Shaperust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Shape#, |
| 226 | { |
| 227 | self.dirtyrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#dirty. = true; |
| 228 | let mut painter = Painterrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Painter#::fromrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Painter<'a, 'b>`][`From<&'a mut Context<'b>>`]from().(self); |
| 229 | shape.drawrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Shape#draw().(&mut painter); |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | /// The Canvas widget may be used to draw more detailed figures using braille |
| 234 | /// patterns (each cell can have a braille character in 8 different positions). |
| 235 | pub struct Canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#<'a, F> |
| 236 | where |
| 237 | F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&mut Contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#<'_>), |
| 238 | { |
| 239 | blockrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#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>>, |
| 240 | x_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#x_bounds.: [f64; 2], |
| 241 | y_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#y_bounds.: [f64; 2], |
| 242 | paint_funcrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#paint_func.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<F>, |
| 243 | background_colorrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#background_color.: Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#, |
| 244 | markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#marker.: Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#, |
| 245 | } |
| 246 | |
| 247 | impl<'a, F> Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#<'a, F> |
| 248 | where |
| 249 | F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&mut Contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#<'_>), |
| 250 | { |
| 251 | fn defaultrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'a, F>`][Default]default().() -> Canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#<'a, F> { |
| 252 | Canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas# { |
| 253 | blockrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#block.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 254 | x_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#x_bounds.: [0.0, 0.0], |
| 255 | y_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#y_bounds.: [0.0, 0.0], |
| 256 | paint_funcrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#paint_func.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 257 | background_colorrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#background_color.: Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#::Resetrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#Reset#, |
| 258 | markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#marker.: Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#::Braillerust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#Braille#, |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | impl<'a, F> Canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#<'a, F> |
| 264 | where |
| 265 | F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&mut Contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#<'_>), |
| 266 | { |
| 267 | pub fn x_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'a, F>`]x_bounds().(mut self, bounds: [f64; 2]) -> Canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#<'a, F> { |
| 268 | self.x_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#x_bounds. = bounds; |
| 269 | self |
| 270 | } |
| 271 | |
| 272 | pub fn y_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'a, F>`]y_bounds().(mut self, bounds: [f64; 2]) -> Canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#<'a, F> { |
| 273 | self.y_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#y_bounds. = bounds; |
| 274 | self |
| 275 | } |
| 276 | |
| 277 | /// Store the closure that will be used to draw to the Canvas |
| 278 | pub fn paintrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'a, F>`]paint().(mut self, f: F) -> Canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#<'a, F> { |
| 279 | self.paint_funcrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#paint_func. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(f); |
| 280 | self |
| 281 | } |
| 282 | |
| 283 | pub fn background_colorrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'a, F>`]background_color().(mut self, color: Colorrust-analyzer cargo ratatui-core 0.1.2 style/color/Color#) -> Canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#<'a, F> { |
| 284 | self.background_colorrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#background_color. = color; |
| 285 | self |
| 286 | } |
| 287 | |
| 288 | /// Change the type of points used to draw the shapes. By default, the |
| 289 | /// braille patterns are used as they provide a more fine-grained result, |
| 290 | /// but you might want to use the simple dot or block instead if the |
| 291 | /// targeted terminal does not support those symbols. |
| 292 | pub fn markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'a, F>`]marker().(mut self, marker: Markerrust-analyzer cargo ratatui-core 0.1.2 symbols/marker/Marker#) -> Canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#<'a, F> { |
| 293 | self.markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#marker. = marker; |
| 294 | self |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | impl<F> Widgetrust-analyzer cargo ratatui-core 0.1.2 widgets/widget/Widget# for Canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#<'_, F> |
| 299 | where |
| 300 | F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&mut Contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#<'_>), |
| 301 | { |
| 302 | fn renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Canvas<'_, F>`][Widget]render().(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#) { |
| 303 | Widgetrust-analyzer cargo ratatui-core 0.1.2 widgets/widget/Widget#::renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`&Canvas<'_, F>`][Widget]render().(&self, area, buf); |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | impl<F> Widgetrust-analyzer cargo ratatui-core 0.1.2 widgets/widget/Widget# for &Canvasrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#<'_, F> |
| 308 | where |
| 309 | F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&mut Contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#<'_>), |
| 310 | { |
| 311 | fn renderrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`&Canvas<'_, F>`][Widget]render().(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#) { |
| 312 | self.blockrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#block..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().renderrust-analyzer cargo ratatui-core 0.1.2 widgets/widget/impl#[`Option<W>`][Widget]render().(area, buf); |
| 313 | let canvas_area = self.blockrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#block..inner_if_somerust-analyzer cargo ratatui-widgets 0.3.2 block/impl#[`Option<Block<'_>>`][BlockExt]inner_if_some().(area); |
| 314 | if canvas_area.is_emptyrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]is_empty().() { |
| 315 | return; |
| 316 | } |
| 317 | |
| 318 | buf.set_stylerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_style().(canvas_area, Stylerust-analyzer cargo ratatui-core 0.1.2 style/Style#::defaultrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style][Default]default().().bgrust-analyzer cargo ratatui-core 0.1.2 style/impl#[Style]bg().(self.background_colorrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#background_color.)); |
| 319 | |
| 320 | let width = canvas_area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width. as usize; |
| 321 | |
| 322 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref painter) = self.paint_funcrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#paint_func. else { |
| 323 | return; |
| 324 | }; |
| 325 | |
| 326 | // Create a blank context that match the size of the canvas |
| 327 | let mut ctx = Contextrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#::newrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/impl#[`Context<'a>`]new().( |
| 328 | canvas_area.widthrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#width., |
| 329 | canvas_area.heightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/Rect#height., |
| 330 | self.x_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#x_bounds., |
| 331 | self.y_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#y_bounds., |
| 332 | self.markerrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#marker., |
| 333 | ); |
| 334 | // Paint to this context |
| 335 | painter(&mut ctx); |
| 336 | // ctx.finish(); // Not needed, we have no layers. |
| 337 | |
| 338 | // Instead, paint whatever is in the ctx. |
| 339 | let layer = ctx.gridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#grid..saverust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/Grid#save().(); |
| 340 | |
| 341 | for (index, layer_cell) in layer.contentsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/Layer#contents..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 342 | let (x, y) = ( |
| 343 | (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().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().canvas_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(), |
| 344 | (index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().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().canvas_area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().(), |
| 345 | ); |
| 346 | |
| 347 | 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().((x, y)) { |
| 348 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(symbol) = layer_cell.symbolrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/LayerCell#symbol. { |
| 349 | cell.set_charrust-analyzer cargo ratatui-core 0.1.2 buffer/cell/impl#[Cell]set_char().(symbol); |
| 350 | } |
| 351 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(fg) = layer_cell.fgrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/LayerCell#fg. { |
| 352 | cell.set_fgrust-analyzer cargo ratatui-core 0.1.2 buffer/cell/impl#[Cell]set_fg().(fg); |
| 353 | } |
| 354 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(bg) = layer_cell.bgrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/LayerCell#bg. { |
| 355 | cell.set_bgrust-analyzer cargo ratatui-core 0.1.2 buffer/cell/impl#[Cell]set_bg().(bg); |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | // Reset the grid and mark as non-dirty. |
| 361 | ctx.gridrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#grid..resetrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/grid/Grid#reset().(); |
| 362 | ctx.dirtyrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#dirty. = false; |
| 363 | |
| 364 | // Finally draw the labels |
| 365 | let left = self.x_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#x_bounds.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().; |
| 366 | let right = self.x_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#x_bounds.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().; |
| 367 | let top = self.y_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#y_bounds.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().; |
| 368 | let bottom = self.y_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#y_bounds.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().; |
| 369 | let width = (self.x_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#x_bounds.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().self.x_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#x_bounds.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().).absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]abs().(); |
| 370 | let height = (self.y_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#y_bounds.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().self.y_boundsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Canvas#y_bounds.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().).absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]abs().(); |
| 371 | let resolution = { |
| 372 | let width = f64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[f64][`From<u16>`]from().(canvas_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 ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().1); |
| 373 | let height = f64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[f64][`From<u16>`]from().(canvas_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 ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().1); |
| 374 | (width, height) |
| 375 | }; |
| 376 | for label in ctx |
| 377 | .labelsrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Context#labels. |
| 378 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 379 | .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|l| l.xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Label#x. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]ge().left && l.xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Label#x. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le().right && l.yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Label#y. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le().top && l.yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Label#y. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]ge().bottom) |
| 380 | { |
| 381 | let x = ((label.xrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Label#x. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().left) 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().resolution.0 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().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().canvas_area.leftrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]left().(); |
| 382 | let y = ((top rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub().label.yrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Label#y.) 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().resolution.1 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().height) 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().canvas_area.toprust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]top().(); |
| 383 | buf.set_linerust-analyzer cargo ratatui-core 0.1.2 buffer/buffer/impl#[Buffer]set_line().(x, y, &label.spansrust-analyzer cargo bottom 0.14.9 canvas/components/time_series/vendored/canvas/Label#spans., canvas_area.rightrust-analyzer cargo ratatui-core 0.1.2 layout/rect/impl#[Rect]right().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u16][`Sub<Self>`]sub().x); |
| 384 | } |
| 385 | } |
| 386 | } |