| 1 | /* |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | */ |
| 7 | |
| 8 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#; |
| 9 | |
| 10 | use itertoolsrust-analyzer cargo itertools 0.15.0 crate/::Itertoolsrust-analyzer cargo itertools 0.15.0 Itertools#; |
| 11 | |
| 12 | use superrust-analyzer cargo esl01-renderdag 0.3.0 crate/::outputrust-analyzer cargo esl01-renderdag 0.3.0 output/::OutputRendererOptionsrust-analyzer cargo esl01-renderdag 0.3.0 output/OutputRendererOptions#; |
| 13 | use superrust-analyzer cargo esl01-renderdag 0.3.0 crate/::renderrust-analyzer cargo esl01-renderdag 0.3.0 render/::Ancestorrust-analyzer cargo esl01-renderdag 0.3.0 render/Ancestor#; |
| 14 | use superrust-analyzer cargo esl01-renderdag 0.3.0 crate/::renderrust-analyzer cargo esl01-renderdag 0.3.0 render/::GraphRowrust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRow#; |
| 15 | use superrust-analyzer cargo esl01-renderdag 0.3.0 crate/::renderrust-analyzer cargo esl01-renderdag 0.3.0 render/::LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#; |
| 16 | use superrust-analyzer cargo esl01-renderdag 0.3.0 crate/::renderrust-analyzer cargo esl01-renderdag 0.3.0 render/::NodeLinerust-analyzer cargo esl01-renderdag 0.3.0 render/NodeLine#; |
| 17 | use superrust-analyzer cargo esl01-renderdag 0.3.0 crate/::renderrust-analyzer cargo esl01-renderdag 0.3.0 render/::PadLinerust-analyzer cargo esl01-renderdag 0.3.0 render/PadLine#; |
| 18 | use superrust-analyzer cargo esl01-renderdag 0.3.0 crate/::renderrust-analyzer cargo esl01-renderdag 0.3.0 render/::Rendererrust-analyzer cargo esl01-renderdag 0.3.0 render/Renderer#; |
| 19 | |
| 20 | mod glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/ { |
| 21 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const SPACErust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/SPACE.: usize = 0; |
| 22 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const HORIZONTALrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/HORIZONTAL.: usize = 1; |
| 23 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const PARENTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/PARENT.: usize = 2; |
| 24 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const ANCESTORrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/ANCESTOR.: usize = 3; |
| 25 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const MERGE_LEFTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/MERGE_LEFT.: usize = 4; |
| 26 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const MERGE_RIGHTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/MERGE_RIGHT.: usize = 5; |
| 27 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const MERGE_BOTHrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/MERGE_BOTH.: usize = 6; |
| 28 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const FORK_LEFTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/FORK_LEFT.: usize = 7; |
| 29 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const FORK_RIGHTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/FORK_RIGHT.: usize = 8; |
| 30 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const FORK_BOTHrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/FORK_BOTH.: usize = 9; |
| 31 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const JOIN_LEFTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_LEFT.: usize = 10; |
| 32 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const JOIN_RIGHTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_RIGHT.: usize = 11; |
| 33 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const JOIN_BOTHrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_BOTH.: usize = 12; |
| 34 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const TERMINATIONrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/TERMINATION.: usize = 13; |
| 35 | pub(superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/) const COUNTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/COUNT.: usize = 14; |
| 36 | } |
| 37 | |
| 38 | const SQUARE_GLYPHSrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/SQUARE_GLYPHS.: [&str; glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::COUNTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/COUNT.] = [ |
| 39 | " ", "──", "│ ", "· ", "┘ ", "└─", "┴─", "┐ ", "┌─", "┬─", "┤ ", "├─", "┼─", "~ ", |
| 40 | ]; |
| 41 | |
| 42 | const CURVED_GLYPHSrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/CURVED_GLYPHS.: [&str; glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::COUNTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/COUNT.] = [ |
| 43 | " ", "──", "│ ", "╷ ", "╯ ", "╰─", "┴─", "╮ ", "╭─", "┬─", "┤ ", "├─", "┼─", "~ ", |
| 44 | ]; |
| 45 | |
| 46 | const DEC_GLYPHSrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/DEC_GLYPHS.: [&str; glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::COUNTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/COUNT.] = [ |
| 47 | " ", |
| 48 | "\x1B(0qq\x1B(B", |
| 49 | "\x1B(0x \x1B(B", |
| 50 | "\x1B(0~ \x1B(B", |
| 51 | "\x1B(0j \x1B(B", |
| 52 | "\x1B(0mq\x1B(B", |
| 53 | "\x1B(0vq\x1B(B", |
| 54 | "\x1B(0k \x1B(B", |
| 55 | "\x1B(0lq\x1B(B", |
| 56 | "\x1B(0wq\x1B(B", |
| 57 | "\x1B(0u \x1B(B", |
| 58 | "\x1B(0tq\x1B(B", |
| 59 | "\x1B(0nq\x1B(B", |
| 60 | "~ ", |
| 61 | ]; |
| 62 | |
| 63 | impl PadLinerust-analyzer cargo esl01-renderdag 0.3.0 render/PadLine# { |
| 64 | fn to_glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/impl#[PadLine]to_glyph().(&self) -> usize { |
| 65 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 66 | PadLinerust-analyzer cargo esl01-renderdag 0.3.0 render/PadLine#::Parentrust-analyzer cargo esl01-renderdag 0.3.0 render/PadLine#Parent# => glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::PARENTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/PARENT., |
| 67 | PadLinerust-analyzer cargo esl01-renderdag 0.3.0 render/PadLine#::Ancestorrust-analyzer cargo esl01-renderdag 0.3.0 render/PadLine#Ancestor# => glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::ANCESTORrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/ANCESTOR., |
| 68 | PadLinerust-analyzer cargo esl01-renderdag 0.3.0 render/PadLine#::Blankrust-analyzer cargo esl01-renderdag 0.3.0 render/PadLine#Blank# => glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::SPACErust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/SPACE., |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | pub struct BoxDrawingRendererrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#<N, R> |
| 74 | where |
| 75 | R: Rendererrust-analyzer cargo esl01-renderdag 0.3.0 render/Renderer#<N, Outputrust-analyzer cargo esl01-renderdag 0.3.0 render/Renderer#Output# = GraphRowrust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRow#<N>> + Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 76 | { |
| 77 | innerrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#inner.: R, |
| 78 | optionsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#options.: OutputRendererOptionsrust-analyzer cargo esl01-renderdag 0.3.0 output/OutputRendererOptions#, |
| 79 | extra_pad_linerust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#extra_pad_line.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 80 | glyphsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#glyphs.: &'static [&'static str; glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::COUNTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/COUNT.], |
| 81 | _phantomrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#_phantom.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<N>, |
| 82 | } |
| 83 | |
| 84 | impl<N, R> BoxDrawingRendererrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#<N, R> |
| 85 | where |
| 86 | R: Rendererrust-analyzer cargo esl01-renderdag 0.3.0 render/Renderer#<N, Outputrust-analyzer cargo esl01-renderdag 0.3.0 render/Renderer#Output# = GraphRowrust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRow#<N>> + Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 87 | { |
| 88 | pub(craterust-analyzer cargo esl01-renderdag 0.3.0 crate/) fn newrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/impl#[`BoxDrawingRenderer<N, R>`]new().(inner: R, options: OutputRendererOptionsrust-analyzer cargo esl01-renderdag 0.3.0 output/OutputRendererOptions#) -> Selfrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/impl#[`BoxDrawingRenderer<N, R>`] { |
| 89 | BoxDrawingRendererrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer# { |
| 90 | innerrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#inner., |
| 91 | optionsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#options., |
| 92 | extra_pad_linerust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#extra_pad_line.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 93 | glyphsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#glyphs.: &CURVED_GLYPHSrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/CURVED_GLYPHS., |
| 94 | _phantomrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#_phantom.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | pub fn with_square_glyphsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/impl#[`BoxDrawingRenderer<N, R>`]with_square_glyphs().(mut self) -> Selfrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/impl#[`BoxDrawingRenderer<N, R>`] { |
| 99 | self.glyphsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#glyphs. = &SQUARE_GLYPHSrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/SQUARE_GLYPHS.; |
| 100 | self |
| 101 | } |
| 102 | |
| 103 | pub fn with_dec_graphics_glyphsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/impl#[`BoxDrawingRenderer<N, R>`]with_dec_graphics_glyphs().(mut self) -> Selfrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/impl#[`BoxDrawingRenderer<N, R>`] { |
| 104 | self.glyphsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#glyphs. = &DEC_GLYPHSrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/DEC_GLYPHS.; |
| 105 | self |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | impl<N, R> Rendererrust-analyzer cargo esl01-renderdag 0.3.0 render/Renderer#<N> for BoxDrawingRendererrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#<N, R> |
| 110 | where |
| 111 | N: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq#, |
| 112 | R: Rendererrust-analyzer cargo esl01-renderdag 0.3.0 render/Renderer#<N, Outputrust-analyzer cargo esl01-renderdag 0.3.0 render/Renderer#Output# = GraphRowrust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRow#<N>> + Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 113 | { |
| 114 | type Outputrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/impl#[`BoxDrawingRenderer<N, R>`][`Renderer<N>`]Output# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#; |
| 115 | |
| 116 | fn widthrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/impl#[`BoxDrawingRenderer<N, R>`][`Renderer<N>`]width().(&self, node: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&N>, parents: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Ancestorrust-analyzer cargo esl01-renderdag 0.3.0 render/Ancestor#<N>>>) -> u64 { |
| 117 | self.innerrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#inner. |
| 118 | .widthrust-analyzer cargo esl01-renderdag 0.3.0 render/Renderer#width().(node, parents) |
| 119 | .saturating_mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]saturating_mul().(2) |
| 120 | .saturating_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]saturating_add().(1) |
| 121 | } |
| 122 | |
| 123 | fn reserverust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/impl#[`BoxDrawingRenderer<N, R>`][`Renderer<N>`]reserve().(&mut self, node: N) { |
| 124 | self.innerrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#inner..reserverust-analyzer cargo esl01-renderdag 0.3.0 render/Renderer#reserve().(node); |
| 125 | } |
| 126 | |
| 127 | fn next_rowrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/impl#[`BoxDrawingRenderer<N, R>`][`Renderer<N>`]next_row().( |
| 128 | &mut self, |
| 129 | node: N, |
| 130 | parents: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Ancestorrust-analyzer cargo esl01-renderdag 0.3.0 render/Ancestor#<N>>, |
| 131 | glyph: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 132 | message: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 133 | ) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 134 | let glyphs = self.glyphsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#glyphs.; |
| 135 | let line = self.innerrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#inner..next_rowrust-analyzer cargo esl01-renderdag 0.3.0 render/Renderer#next_row().(node, parents, glyph, message); |
| 136 | let mut out = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 137 | let mut message_lines = line |
| 138 | .messagerust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRow#message. |
| 139 | .linesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]lines().() |
| 140 | .pad_usingrust-analyzer cargo itertools 0.15.0 Itertools#pad_using().(self.optionsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#options..min_row_heightrust-analyzer cargo esl01-renderdag 0.3.0 output/OutputRendererOptions#min_row_height., |_| ""); |
| 141 | let mut need_extra_pad_line = false; |
| 142 | |
| 143 | // Render the previous extra pad line |
| 144 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(extra_pad_line) = self.extra_pad_linerust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#extra_pad_line..takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]take().() { |
| 145 | out.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(extra_pad_line.trim_endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end().()); |
| 146 | out.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\n'); |
| 147 | } |
| 148 | |
| 149 | // Render the nodeline |
| 150 | let mut node_line = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 151 | for entry in line.node_linerust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRow#node_line..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 152 | match entry { |
| 153 | NodeLinerust-analyzer cargo esl01-renderdag 0.3.0 render/NodeLine#::Noderust-analyzer cargo esl01-renderdag 0.3.0 render/NodeLine#Node# => { |
| 154 | node_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(&line.glyphrust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRow#glyph.); |
| 155 | node_line.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(' '); |
| 156 | } |
| 157 | NodeLinerust-analyzer cargo esl01-renderdag 0.3.0 render/NodeLine#::Parentrust-analyzer cargo esl01-renderdag 0.3.0 render/NodeLine#Parent# => node_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::PARENTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/PARENT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 158 | NodeLinerust-analyzer cargo esl01-renderdag 0.3.0 render/NodeLine#::Ancestorrust-analyzer cargo esl01-renderdag 0.3.0 render/NodeLine#Ancestor# => node_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::ANCESTORrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/ANCESTOR.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 159 | NodeLinerust-analyzer cargo esl01-renderdag 0.3.0 render/NodeLine#::Blankrust-analyzer cargo esl01-renderdag 0.3.0 render/NodeLine#Blank# => node_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::SPACErust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/SPACE.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 160 | } |
| 161 | } |
| 162 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(msg) = message_lines.nextrust-analyzer cargo itertools 0.15.0 pad_tail/impl#[`PadUsing<I, F>`][Iterator]next().() { |
| 163 | node_line.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(' '); |
| 164 | node_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(msg); |
| 165 | } |
| 166 | out.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(node_line.trim_endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end().()); |
| 167 | out.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\n'); |
| 168 | |
| 169 | // Render the link line |
| 170 | #[allow(clippy::if_same_then_else)] |
| 171 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(link_row) = line.link_linerust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRow#link_line. { |
| 172 | let mut link_line = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 173 | for cur in link_row.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 174 | if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::HORIZONTALrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]HORIZONTAL.) { |
| 175 | if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::CHILDrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]CHILD.) { |
| 176 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::JOIN_BOTHrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_BOTH.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 177 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::ANY_FORKrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]ANY_FORK.) |
| 178 | && cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::ANY_MERGErust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]ANY_MERGE.) |
| 179 | { |
| 180 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::JOIN_BOTHrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_BOTH.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 181 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::ANY_FORKrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]ANY_FORK.) |
| 182 | && cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::VERT_PARENTrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]VERT_PARENT.) |
| 183 | && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().line.mergerust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRow#merge. |
| 184 | { |
| 185 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::JOIN_BOTHrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_BOTH.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 186 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::ANY_FORKrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]ANY_FORK.) { |
| 187 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::FORK_BOTHrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/FORK_BOTH.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 188 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::ANY_MERGErust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]ANY_MERGE.) { |
| 189 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::MERGE_BOTHrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/MERGE_BOTH.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 190 | } else { |
| 191 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::HORIZONTALrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/HORIZONTAL.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 192 | } |
| 193 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::VERT_PARENTrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]VERT_PARENT.) && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().line.mergerust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRow#merge. { |
| 194 | let left = cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::LEFT_MERGErust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]LEFT_MERGE. rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor().|rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor(). rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor().LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::LEFT_FORKrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]LEFT_FORK.); |
| 195 | let right = cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::RIGHT_MERGErust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]RIGHT_MERGE. rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor().|rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor(). rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor().LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::RIGHT_FORKrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]RIGHT_FORK.); |
| 196 | match (left, right) { |
| 197 | (true, true) => link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::JOIN_BOTHrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_BOTH.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 198 | (true, false) => link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::JOIN_LEFTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_LEFT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 199 | (false, true) => link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::JOIN_RIGHTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_RIGHT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 200 | (false, false) => link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::PARENTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/PARENT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 201 | } |
| 202 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::VERT_PARENTrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]VERT_PARENT. rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor().|rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor(). rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor().LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::VERT_ANCESTORrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]VERT_ANCESTOR.) |
| 203 | && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::LEFT_FORKrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]LEFT_FORK. rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor().|rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor(). rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor().LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::RIGHT_FORKrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]RIGHT_FORK.) |
| 204 | { |
| 205 | let left = cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::LEFT_MERGErust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]LEFT_MERGE.); |
| 206 | let right = cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::RIGHT_MERGErust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]RIGHT_MERGE.); |
| 207 | match (left, right) { |
| 208 | (true, true) => link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::JOIN_BOTHrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_BOTH.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 209 | (true, false) => link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::JOIN_LEFTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_LEFT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 210 | (false, true) => link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::JOIN_RIGHTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_RIGHT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 211 | (false, false) => { |
| 212 | if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::VERT_ANCESTORrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]VERT_ANCESTOR.) { |
| 213 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::ANCESTORrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/ANCESTOR.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 214 | } else { |
| 215 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::PARENTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/PARENT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::LEFT_FORKrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]LEFT_FORK.) |
| 220 | && cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::LEFT_MERGErust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]LEFT_MERGE. rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor().|rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor(). rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor().LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::CHILDrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]CHILD.) |
| 221 | { |
| 222 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::JOIN_LEFTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_LEFT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 223 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::RIGHT_FORKrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]RIGHT_FORK.) |
| 224 | && cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::RIGHT_MERGErust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]RIGHT_MERGE. rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor().|rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor(). rust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine][`BitOr<Self>`]bitor().LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::CHILDrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]CHILD.) |
| 225 | { |
| 226 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::JOIN_RIGHTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/JOIN_RIGHT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 227 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::LEFT_MERGErust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]LEFT_MERGE.) |
| 228 | && cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::RIGHT_MERGErust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]RIGHT_MERGE.) |
| 229 | { |
| 230 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::MERGE_BOTHrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/MERGE_BOTH.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 231 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::LEFT_FORKrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]LEFT_FORK.) |
| 232 | && cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::RIGHT_FORKrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]RIGHT_FORK.) |
| 233 | { |
| 234 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::FORK_BOTHrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/FORK_BOTH.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 235 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::LEFT_FORKrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]LEFT_FORK.) { |
| 236 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::FORK_LEFTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/FORK_LEFT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 237 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::LEFT_MERGErust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]LEFT_MERGE.) { |
| 238 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::MERGE_LEFTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/MERGE_LEFT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 239 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::RIGHT_FORKrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]RIGHT_FORK.) { |
| 240 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::FORK_RIGHTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/FORK_RIGHT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 241 | } else if cur.intersectsrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]intersects().(LinkLinerust-analyzer cargo esl01-renderdag 0.3.0 render/LinkLine#::RIGHT_MERGErust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[LinkLine]RIGHT_MERGE.) { |
| 242 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::MERGE_RIGHTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/MERGE_RIGHT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 243 | } else { |
| 244 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::SPACErust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/SPACE.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 245 | } |
| 246 | } |
| 247 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(msg) = message_lines.nextrust-analyzer cargo itertools 0.15.0 pad_tail/impl#[`PadUsing<I, F>`][Iterator]next().() { |
| 248 | link_line.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(' '); |
| 249 | link_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(msg); |
| 250 | } |
| 251 | out.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(link_line.trim_endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end().()); |
| 252 | out.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\n'); |
| 253 | } |
| 254 | |
| 255 | // Render the term line |
| 256 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(term_row) = line.term_linerust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRow#term_line. { |
| 257 | let term_strs = [glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::PARENTrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/PARENT.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/::TERMINATIONrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/glyph/TERMINATION.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().]; |
| 258 | for term_str in term_strs.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 259 | let mut term_line = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 260 | for (i, term) in term_row.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().() { |
| 261 | if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().term { |
| 262 | term_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(term_str); |
| 263 | } else { |
| 264 | term_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().line.pad_linesrust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRow#pad_lines.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..to_glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/impl#[PadLine]to_glyph().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 265 | } |
| 266 | } |
| 267 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(msg) = message_lines.nextrust-analyzer cargo itertools 0.15.0 pad_tail/impl#[`PadUsing<I, F>`][Iterator]next().() { |
| 268 | term_line.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(' '); |
| 269 | term_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(msg); |
| 270 | } |
| 271 | out.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(term_line.trim_endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end().()); |
| 272 | out.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\n'); |
| 273 | } |
| 274 | need_extra_pad_line = true; |
| 275 | } |
| 276 | |
| 277 | let mut base_pad_line = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 278 | for entry in line.pad_linesrust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRow#pad_lines..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 279 | base_pad_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(glyphs[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().entry.to_glyphrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/impl#[PadLine]to_glyph().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 280 | } |
| 281 | |
| 282 | // Render any pad lines |
| 283 | for msg in message_lines { |
| 284 | let mut pad_line = base_pad_line.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(); |
| 285 | pad_line.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(' '); |
| 286 | pad_line.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(msg); |
| 287 | out.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(pad_line.trim_endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end().()); |
| 288 | out.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\n'); |
| 289 | need_extra_pad_line = false; |
| 290 | } |
| 291 | |
| 292 | if need_extra_pad_line { |
| 293 | self.extra_pad_linerust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/BoxDrawingRenderer#extra_pad_line. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(base_pad_line); |
| 294 | } |
| 295 | |
| 296 | out |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | #[cfg(test)] |
| 301 | mod testsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/ { |
| 302 | use superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/::superrust-analyzer cargo esl01-renderdag 0.3.0 crate/::test_fixturesrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/; |
| 303 | use superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/::superrust-analyzer cargo esl01-renderdag 0.3.0 crate/::test_fixturesrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/::TestFixturerust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/TestFixture#; |
| 304 | use superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/::superrust-analyzer cargo esl01-renderdag 0.3.0 crate/::test_utilsrust-analyzer cargo esl01-renderdag 0.3.0 test_utils/::render_stringrust-analyzer cargo esl01-renderdag 0.3.0 test_utils/render_string().; |
| 305 | use superrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/::superrust-analyzer cargo esl01-renderdag 0.3.0 crate/::test_utilsrust-analyzer cargo esl01-renderdag 0.3.0 test_utils/::render_string_with_orderrust-analyzer cargo esl01-renderdag 0.3.0 test_utils/render_string_with_order().; |
| 306 | use craterust-analyzer cargo esl01-renderdag 0.3.0 crate/::GraphRowRendererrust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRowRenderer#; |
| 307 | |
| 308 | fn renderrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/render().(fixture: &TestFixturerust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/TestFixture#) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 309 | let mut renderer = GraphRowRendererrust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRowRenderer#::newrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[`GraphRowRenderer<N>`]new().().outputrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[`GraphRowRenderer<N>`]output().().build_box_drawingrust-analyzer cargo esl01-renderdag 0.3.0 output/impl#[`OutputRendererBuilder<N, R>`]build_box_drawing().(); |
| 310 | render_stringrust-analyzer cargo esl01-renderdag 0.3.0 test_utils/render_string().(fixture, &mut renderer) |
| 311 | } |
| 312 | |
| 313 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 314 | fn basicrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/basic().() { |
| 315 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 316 | renderrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/render().(&test_fixturesrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/::BASICrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/BASIC.), |
| 317 | r#" |
| 318 | o C |
| 319 | │ |
| 320 | o B |
| 321 | │ |
| 322 | o A"# |
| 323 | ); |
| 324 | } |
| 325 | |
| 326 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 327 | fn branches_and_mergesrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/branches_and_merges().() { |
| 328 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 329 | renderrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/render().(&test_fixturesrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/::BRANCHES_AND_MERGESrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/BRANCHES_AND_MERGES.), |
| 330 | r#" |
| 331 | o W |
| 332 | │ |
| 333 | o V |
| 334 | ├─╮ |
| 335 | │ o U |
| 336 | │ ├─╮ |
| 337 | │ │ o T |
| 338 | │ │ │ |
| 339 | │ o │ S |
| 340 | │ │ |
| 341 | o │ R |
| 342 | │ │ |
| 343 | o │ Q |
| 344 | ├─╮ │ |
| 345 | │ o │ P |
| 346 | │ ├───╮ |
| 347 | │ │ │ o O |
| 348 | │ │ │ │ |
| 349 | │ │ │ o N |
| 350 | │ │ │ ├─╮ |
| 351 | │ o │ │ │ M |
| 352 | │ │ │ │ │ |
| 353 | │ o │ │ │ L |
| 354 | │ │ │ │ │ |
| 355 | o │ │ │ │ K |
| 356 | ├───────╯ |
| 357 | o │ │ │ J |
| 358 | │ │ │ │ |
| 359 | o │ │ │ I |
| 360 | ├─╯ │ │ |
| 361 | o │ │ H |
| 362 | │ │ │ |
| 363 | o │ │ G |
| 364 | ├─────╮ |
| 365 | │ │ o F |
| 366 | │ ├─╯ |
| 367 | │ o E |
| 368 | │ │ |
| 369 | o │ D |
| 370 | │ │ |
| 371 | o │ C |
| 372 | ├───╯ |
| 373 | o B |
| 374 | │ |
| 375 | o A"# |
| 376 | ); |
| 377 | } |
| 378 | |
| 379 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 380 | fn octopus_branch_and_mergerust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/octopus_branch_and_merge().() { |
| 381 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 382 | renderrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/render().(&test_fixturesrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/::OCTOPUS_BRANCH_AND_MERGErust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/OCTOPUS_BRANCH_AND_MERGE.), |
| 383 | r#" |
| 384 | o J |
| 385 | ├─┬─╮ |
| 386 | │ │ o I |
| 387 | │ │ │ |
| 388 | │ o │ H |
| 389 | ╭─┼─┬─┬─╮ |
| 390 | │ │ │ │ o G |
| 391 | │ │ │ │ │ |
| 392 | │ │ │ o │ E |
| 393 | │ │ │ ├─╯ |
| 394 | │ │ o │ D |
| 395 | │ │ ├─╮ |
| 396 | │ o │ │ C |
| 397 | │ ├───╯ |
| 398 | o │ │ F |
| 399 | ├─╯ │ |
| 400 | o │ B |
| 401 | ├───╯ |
| 402 | o A"# |
| 403 | ); |
| 404 | } |
| 405 | |
| 406 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 407 | fn reserved_columnrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/reserved_column().() { |
| 408 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 409 | renderrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/render().(&test_fixturesrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/::RESERVED_COLUMNrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/RESERVED_COLUMN.), |
| 410 | r#" |
| 411 | o Z |
| 412 | │ |
| 413 | o Y |
| 414 | │ |
| 415 | o X |
| 416 | ╭─╯ |
| 417 | │ o W |
| 418 | ├─╯ |
| 419 | o G |
| 420 | │ |
| 421 | o F |
| 422 | ├─╮ |
| 423 | │ o E |
| 424 | │ │ |
| 425 | │ o D |
| 426 | │ |
| 427 | o C |
| 428 | │ |
| 429 | o B |
| 430 | │ |
| 431 | o A"# |
| 432 | ); |
| 433 | } |
| 434 | |
| 435 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 436 | fn ancestorsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/ancestors().() { |
| 437 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 438 | renderrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/render().(&test_fixturesrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/::ANCESTORSrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/ANCESTORS.), |
| 439 | r#" |
| 440 | o Z |
| 441 | │ |
| 442 | o Y |
| 443 | ╭─╯ |
| 444 | o F |
| 445 | ╷ |
| 446 | ╷ o X |
| 447 | ╭─╯ |
| 448 | │ o W |
| 449 | ├─╯ |
| 450 | o E |
| 451 | ╷ |
| 452 | o D |
| 453 | ├─╮ |
| 454 | │ o C |
| 455 | │ ╷ |
| 456 | o ╷ B |
| 457 | ├─╯ |
| 458 | o A"# |
| 459 | ); |
| 460 | } |
| 461 | |
| 462 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 463 | fn split_parentsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/split_parents().() { |
| 464 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 465 | renderrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/render().(&test_fixturesrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/::SPLIT_PARENTSrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/SPLIT_PARENTS.), |
| 466 | r#" |
| 467 | o E |
| 468 | ╭─┬─┬─┤ |
| 469 | ╷ o │ ╷ D |
| 470 | ╭─┴─╮ ╷ |
| 471 | │ o ╷ C |
| 472 | │ ├─╯ |
| 473 | o │ B |
| 474 | ├───╯ |
| 475 | o A"# |
| 476 | ); |
| 477 | } |
| 478 | |
| 479 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 480 | fn terminationsrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/terminations().() { |
| 481 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 482 | renderrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/render().(&test_fixturesrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/::TERMINATIONSrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/TERMINATIONS.), |
| 483 | r#" |
| 484 | o K |
| 485 | │ |
| 486 | │ o J |
| 487 | ├─╯ |
| 488 | o I |
| 489 | ╭─┼─╮ |
| 490 | │ │ │ |
| 491 | │ ~ │ |
| 492 | │ │ |
| 493 | o │ E |
| 494 | │ │ |
| 495 | │ o H |
| 496 | ├───╯ |
| 497 | o D |
| 498 | │ |
| 499 | ~ |
| 500 | |
| 501 | o C |
| 502 | │ |
| 503 | o B |
| 504 | │ |
| 505 | ~"# |
| 506 | ); |
| 507 | } |
| 508 | |
| 509 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 510 | fn long_messagesrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/long_messages().() { |
| 511 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 512 | renderrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/render().(&test_fixturesrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/::LONG_MESSAGESrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/LONG_MESSAGES.), |
| 513 | r#" |
| 514 | o F |
| 515 | ├─┬─╮ very long message 1 |
| 516 | │ │ │ very long message 2 |
| 517 | │ │ ~ very long message 3 |
| 518 | │ │ |
| 519 | │ │ very long message 4 |
| 520 | │ │ very long message 5 |
| 521 | │ │ very long message 6 |
| 522 | │ │ |
| 523 | │ o E |
| 524 | │ │ |
| 525 | │ o D |
| 526 | │ │ |
| 527 | o │ C |
| 528 | ├─╯ long message 1 |
| 529 | │ long message 2 |
| 530 | │ long message 3 |
| 531 | │ |
| 532 | o B |
| 533 | │ |
| 534 | o A |
| 535 | │ long message 1 |
| 536 | ~ long message 2 |
| 537 | long message 3"# |
| 538 | ); |
| 539 | } |
| 540 | |
| 541 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 542 | fn different_ordersrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/different_orders().() { |
| 543 | let order = |order: &str| { |
| 544 | let order = order.matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]matches().(|_: char| true).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(); |
| 545 | let mut renderer = GraphRowRendererrust-analyzer cargo esl01-renderdag 0.3.0 render/GraphRowRenderer#::newrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[`GraphRowRenderer<N>`]new().().outputrust-analyzer cargo esl01-renderdag 0.3.0 render/impl#[`GraphRowRenderer<N>`]output().().build_box_drawingrust-analyzer cargo esl01-renderdag 0.3.0 output/impl#[`OutputRendererBuilder<N, R>`]build_box_drawing().(); |
| 546 | render_string_with_orderrust-analyzer cargo esl01-renderdag 0.3.0 test_utils/render_string_with_order().(&test_fixturesrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/::ORDERS1rust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/ORDERS1., &mut renderer, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&order)) |
| 547 | }; |
| 548 | |
| 549 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 550 | order("KJIHGFEDCBZA"), |
| 551 | r#" |
| 552 | o K |
| 553 | ├─╮ |
| 554 | │ o J |
| 555 | │ ├─╮ |
| 556 | │ │ o I |
| 557 | │ │ ├─╮ |
| 558 | │ │ │ o H |
| 559 | │ │ │ ├─╮ |
| 560 | │ │ │ │ o G |
| 561 | │ │ │ │ ├─╮ |
| 562 | o │ │ │ │ │ F |
| 563 | │ │ │ │ │ │ |
| 564 | │ o │ │ │ │ E |
| 565 | ├─╯ │ │ │ │ |
| 566 | │ o │ │ │ D |
| 567 | ├───╯ │ │ │ |
| 568 | │ o │ │ C |
| 569 | ├─────╯ │ │ |
| 570 | │ o │ B |
| 571 | ├───────╯ │ |
| 572 | │ o Z |
| 573 | │ |
| 574 | o A"# |
| 575 | ); |
| 576 | |
| 577 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 578 | order("KJIHGZBCDEFA"), |
| 579 | r#" |
| 580 | o K |
| 581 | ├─╮ |
| 582 | │ o J |
| 583 | │ ├─╮ |
| 584 | │ │ o I |
| 585 | │ │ ├─╮ |
| 586 | │ │ │ o H |
| 587 | │ │ │ ├─╮ |
| 588 | │ │ │ │ o G |
| 589 | │ │ │ │ ├─╮ |
| 590 | │ │ │ │ │ o Z |
| 591 | │ │ │ │ │ |
| 592 | │ │ │ │ o B |
| 593 | │ │ │ │ │ |
| 594 | │ │ │ o │ C |
| 595 | │ │ │ ├─╯ |
| 596 | │ │ o │ D |
| 597 | │ │ ├─╯ |
| 598 | │ o │ E |
| 599 | │ ├─╯ |
| 600 | o │ F |
| 601 | ├─╯ |
| 602 | o A"# |
| 603 | ); |
| 604 | |
| 605 | // Keeping the p1 branch the longest path (KFEDCBA) is a reasonable |
| 606 | // optimization for a cleaner graph (less columns, more text space). |
| 607 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 608 | renderrust-analyzer cargo esl01-renderdag 0.3.0 box_drawing/tests/render().(&test_fixturesrust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/::ORDERS2rust-analyzer cargo esl01-renderdag 0.3.0 test_fixtures/ORDERS2.), |
| 609 | r#" |
| 610 | o K |
| 611 | ├─╮ |
| 612 | │ o J |
| 613 | │ │ |
| 614 | o │ F |
| 615 | ├───╮ |
| 616 | │ │ o I |
| 617 | │ ├─╯ |
| 618 | o │ E |
| 619 | ├───╮ |
| 620 | │ │ o H |
| 621 | │ ├─╯ |
| 622 | o │ D |
| 623 | ├───╮ |
| 624 | │ │ o G |
| 625 | │ ├─╯ |
| 626 | o │ C |
| 627 | ├───╮ |
| 628 | │ │ o Z |
| 629 | │ │ |
| 630 | o │ B |
| 631 | ├─╯ |
| 632 | o A"# |
| 633 | ); |
| 634 | |
| 635 | // Try to use the ORDERS2 order. However, the parent ordering in the |
| 636 | // graph is different, which makes the rendering different. |
| 637 | // |
| 638 | // Note: it's KJFIEHDGCZBA in the ORDERS2 graph. To map it to ORDERS1, |
| 639 | // follow: |
| 640 | // |
| 641 | // ORDERS1: KFJEIDHCGBZA |
| 642 | // ORDERS2: KJFIEHDGCBZA |
| 643 | // |
| 644 | // And we get KFJEIDHCGZBA. |
| 645 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 646 | order("KFJEIDHCGZBA"), |
| 647 | r#" |
| 648 | o K |
| 649 | ├─╮ |
| 650 | o │ F |
| 651 | │ │ |
| 652 | │ o J |
| 653 | │ ├─╮ |
| 654 | │ o │ E |
| 655 | ├─╯ │ |
| 656 | │ o I |
| 657 | │ ╭─┤ |
| 658 | │ │ o D |
| 659 | ├───╯ |
| 660 | │ o H |
| 661 | │ ├─╮ |
| 662 | │ o │ C |
| 663 | ├─╯ │ |
| 664 | │ o G |
| 665 | │ ╭─┤ |
| 666 | │ o │ Z |
| 667 | │ │ |
| 668 | │ o B |
| 669 | ├───╯ |
| 670 | o A"# |
| 671 | ); |
| 672 | } |
| 673 | } |