Debian Codegraph @

src/utils/formatting/borders.rs

raw symbols SCIP
1 use craterust-analyzer cargo comfy-table 7.2.2 crate/::{stylerust-analyzer cargo comfy-table 7.2.2 style/::TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#, tablerust-analyzer cargo comfy-table 7.2.2 table/::Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#, utilsrust-analyzer cargo comfy-table 7.2.2 utils/::ColumnDisplayInforust-analyzer cargo comfy-table 7.2.2 utils/ColumnDisplayInfo#};
2
3 pub(craterust-analyzer cargo comfy-table 7.2.2 crate/) fn draw_bordersrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/draw_borders().(
4 table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#,
5 rows: &[Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>],
6 display_info: &[ColumnDisplayInforust-analyzer cargo comfy-table 7.2.2 utils/ColumnDisplayInfo#],
7 ) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
8 // We know how many lines there should be. Initialize the vector with the rough correct amount.
9 // We might over allocate a bit, but that's better than under allocating.
10 let mut lines = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(capacity) = rows.firstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|lines| lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()) {
11 // Lines * 2 -> Lines + delimiters
12 // + 5 -> header delimiters + header + bottom/top borders
13 Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(capacity rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().5)
14 } else {
15 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().()
16 };
17
18 if should_draw_top_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_top_border().(table) {
19 lines.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(draw_top_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/draw_top_border().(table, display_info));
20 }
21
22 draw_rowsrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/draw_rows().(&mut lines, rows, table, display_info);
23
24 if should_draw_bottom_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_bottom_border().(table) {
25 lines.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(draw_bottom_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/draw_bottom_border().(table, display_info));
26 }
27
28 lines
29 }
30
31 fn draw_top_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/draw_top_border().(table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#, display_info: &[ColumnDisplayInforust-analyzer cargo comfy-table 7.2.2 utils/ColumnDisplayInfo#]) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
32 let left_corner = table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::TopLeftCornerrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#TopLeftCorner#);
33 let top_border = table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::TopBorderrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#TopBorder#);
34 let intersection = table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::TopBorderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#TopBorderIntersections#);
35 let right_corner = table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::TopRightCornerrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#TopRightCorner#);
36
37 let mut 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().();
38 // We only need the top left corner, if we need to draw a left border
39 if should_draw_left_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_left_border().(table) {
40 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&left_corner;
41 }
42
43 // Build the top border line depending on the columns' width.
44 // Also add the border intersections.
45 let mut first = true;
46 for info in display_info.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() {
47 // Only add something, if the column isn't hidden
48 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().info.is_hiddenrust-analyzer cargo comfy-table 7.2.2 utils/ColumnDisplayInfo#is_hidden. {
49 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().first {
50 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&intersection;
51 }
52 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&top_border.repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(info.widthrust-analyzer cargo comfy-table 7.2.2 utils/impl#[ColumnDisplayInfo]width().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
53 first = false;
54 }
55 }
56
57 // We only need the top right corner, if we need to draw a right border
58 if should_draw_right_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_right_border().(table) {
59 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&right_corner;
60 }
61
62 line
63 }
64
65 fn draw_rowsrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/draw_rows().(
66 lines: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
67 rows: &[Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>],
68 table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#,
69 display_info: &[ColumnDisplayInforust-analyzer cargo comfy-table 7.2.2 utils/ColumnDisplayInfo#],
70 ) {
71 // Iterate over all rows
72 let mut row_iter = rows.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().().peekablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#peekable().();
73 while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((row_index, row)) = row_iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().() {
74 // Concatenate the line parts and insert the vertical borders if needed
75 for line_parts in row.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() {
76 lines.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(embed_linerust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/embed_line().(line_parts, table));
77 }
78
79 // Draw the horizontal header line if desired, otherwise continue to the next iteration
80 if row_index 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 && table.headerrust-analyzer cargo comfy-table 7.2.2 table/Table#header..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
81 if should_draw_headerrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_header().(table) {
82 lines.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(draw_horizontal_linesrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/draw_horizontal_lines().(table, display_info, true));
83 }
84 continue;
85 }
86
87 // Draw a horizontal line, if we desired and if we aren't in the last row of the table.
88 if row_iter.peekrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`]peek().().is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() && should_draw_horizontal_linesrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_horizontal_lines().(table) {
89 lines.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(draw_horizontal_linesrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/draw_horizontal_lines().(table, display_info, false));
90 }
91 }
92 }
93
94 // Takes the parts of a single line, surrounds them with borders and adds vertical lines.
95 fn embed_linerust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/embed_line().(line_parts: &[Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#], table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
96 let vertical_lines = table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::VerticalLinesrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#VerticalLines#);
97 let left_border = table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::LeftBorderrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#LeftBorder#);
98 let right_border = table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::RightBorderrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#RightBorder#);
99
100 let mut 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().();
101 if should_draw_left_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_left_border().(table) {
102 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&left_border;
103 }
104
105 let mut part_iter = line_parts.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().peekablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#peekable().();
106 while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(part) = part_iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`][Iterator]next().() {
107 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().part;
108 if part_iter.peekrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`]peek().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() && should_draw_right_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_right_border().(table) {
109 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&right_border;
110 } else if part_iter.peekrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/peekable/impl#[`Peekable<I>`]peek().().is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() && should_draw_vertical_linesrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_vertical_lines().(table) {
111 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&vertical_lines;
112 }
113 }
114
115 line
116 }
117
118 // The horizontal line that separates between rows.
119 fn draw_horizontal_linesrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/draw_horizontal_lines().(
120 table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#,
121 display_info: &[ColumnDisplayInforust-analyzer cargo comfy-table 7.2.2 utils/ColumnDisplayInfo#],
122 header: bool,
123 ) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
124 // Styling depends on whether we're currently on the header line or not.
125 let (left_intersection, horizontal_lines, middle_intersection, right_intersection) = if header {
126 (
127 table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::LeftHeaderIntersectionrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#LeftHeaderIntersection#),
128 table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::HeaderLinesrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#HeaderLines#),
129 table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::MiddleHeaderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#MiddleHeaderIntersections#),
130 table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::RightHeaderIntersectionrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#RightHeaderIntersection#),
131 )
132 } else {
133 (
134 table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::LeftBorderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#LeftBorderIntersections#),
135 table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::HorizontalLinesrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#HorizontalLines#),
136 table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::MiddleIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#MiddleIntersections#),
137 table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::RightBorderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#RightBorderIntersections#),
138 )
139 };
140
141 let mut 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().();
142 // We only need the bottom left corner, if we need to draw a left border
143 if should_draw_left_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_left_border().(table) {
144 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&left_intersection;
145 }
146
147 let draw_vertical_lines = should_draw_vertical_linesrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_vertical_lines().(table);
148
149 // Append the middle lines depending on the columns' widths.
150 // Also add the middle intersections.
151 let mut first = true;
152 for info in display_info.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() {
153 // Only add something, if the column isn't hidden
154 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().info.is_hiddenrust-analyzer cargo comfy-table 7.2.2 utils/ColumnDisplayInfo#is_hidden. {
155 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().first && draw_vertical_lines {
156 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&middle_intersection;
157 }
158 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&horizontal_lines.repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(info.widthrust-analyzer cargo comfy-table 7.2.2 utils/impl#[ColumnDisplayInfo]width().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
159 first = false;
160 }
161 }
162
163 // We only need the bottom right corner, if we need to draw a right border
164 if should_draw_right_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_right_border().(table) {
165 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&right_intersection;
166 }
167
168 line
169 }
170
171 fn draw_bottom_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/draw_bottom_border().(table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#, display_info: &[ColumnDisplayInforust-analyzer cargo comfy-table 7.2.2 utils/ColumnDisplayInfo#]) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
172 let left_corner = table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::BottomLeftCornerrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#BottomLeftCorner#);
173 let bottom_border = table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::BottomBorderrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#BottomBorder#);
174 let middle_intersection = table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::BottomBorderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#BottomBorderIntersections#);
175 let right_corner = table.style_or_defaultrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_or_default().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::BottomRightCornerrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#BottomRightCorner#);
176
177 let mut 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().();
178 // We only need the bottom left corner, if we need to draw a left border
179 if should_draw_left_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_left_border().(table) {
180 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&left_corner;
181 }
182
183 // Add the bottom border lines depending on column width
184 // Also add the border intersections.
185 let mut first = true;
186 for info in display_info.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() {
187 // Only add something, if the column isn't hidden
188 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().info.is_hiddenrust-analyzer cargo comfy-table 7.2.2 utils/ColumnDisplayInfo#is_hidden. {
189 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().first {
190 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&middle_intersection;
191 }
192 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&bottom_border.repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(info.widthrust-analyzer cargo comfy-table 7.2.2 utils/impl#[ColumnDisplayInfo]width().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
193 first = false;
194 }
195 }
196
197 // We only need the bottom right corner, if we need to draw a right border
198 if should_draw_right_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_right_border().(table) {
199 line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&right_corner;
200 }
201
202 line
203 }
204
205 fn should_draw_top_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_top_border().(table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#) -> bool {
206 if table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::TopLeftCornerrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#TopLeftCorner#)
207 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::TopBorderrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#TopBorder#)
208 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::TopBorderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#TopBorderIntersections#)
209 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::TopRightCornerrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#TopRightCorner#)
210 {
211 return true;
212 }
213
214 false
215 }
216
217 fn should_draw_bottom_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_bottom_border().(table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#) -> bool {
218 if table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::BottomLeftCornerrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#BottomLeftCorner#)
219 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::BottomBorderrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#BottomBorder#)
220 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::BottomBorderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#BottomBorderIntersections#)
221 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::BottomRightCornerrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#BottomRightCorner#)
222 {
223 return true;
224 }
225
226 false
227 }
228
229 pub fn should_draw_left_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_left_border().(table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#) -> bool {
230 if table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::TopLeftCornerrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#TopLeftCorner#)
231 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::LeftBorderrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#LeftBorder#)
232 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::LeftBorderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#LeftBorderIntersections#)
233 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::LeftHeaderIntersectionrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#LeftHeaderIntersection#)
234 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::BottomLeftCornerrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#BottomLeftCorner#)
235 {
236 return true;
237 }
238
239 false
240 }
241
242 pub fn should_draw_right_borderrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_right_border().(table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#) -> bool {
243 if table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::TopRightCornerrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#TopRightCorner#)
244 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::RightBorderrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#RightBorder#)
245 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::RightBorderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#RightBorderIntersections#)
246 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::RightHeaderIntersectionrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#RightHeaderIntersection#)
247 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::BottomRightCornerrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#BottomRightCorner#)
248 {
249 return true;
250 }
251
252 false
253 }
254
255 fn should_draw_horizontal_linesrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_horizontal_lines().(table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#) -> bool {
256 if table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::LeftBorderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#LeftBorderIntersections#)
257 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::HorizontalLinesrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#HorizontalLines#)
258 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::MiddleIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#MiddleIntersections#)
259 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::RightBorderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#RightBorderIntersections#)
260 {
261 return true;
262 }
263
264 false
265 }
266
267 pub fn should_draw_vertical_linesrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_vertical_lines().(table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#) -> bool {
268 if table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::TopBorderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#TopBorderIntersections#)
269 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::MiddleHeaderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#MiddleHeaderIntersections#)
270 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::VerticalLinesrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#VerticalLines#)
271 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::MiddleIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#MiddleIntersections#)
272 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::BottomBorderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#BottomBorderIntersections#)
273 {
274 return true;
275 }
276
277 false
278 }
279
280 fn should_draw_headerrust-analyzer cargo comfy-table 7.2.2 utils/formatting/borders/should_draw_header().(table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#) -> bool {
281 if table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::LeftHeaderIntersectionrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#LeftHeaderIntersection#)
282 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::HeaderLinesrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#HeaderLines#)
283 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::MiddleHeaderIntersectionsrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#MiddleHeaderIntersections#)
284 || table.style_existsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_exists().(TableComponentrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#::RightHeaderIntersectionrust-analyzer cargo comfy-table 7.2.2 style/table/TableComponent#RightHeaderIntersection#)
285 {
286 return true;
287 }
288
289 false
290 }