Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From qpprint-0.3.1 To trunk
2025-05-30
| ||
14:43 | Begin brainstorming a redesign using a trait for renderer instead of closures. Leaf check-in: bb24ce375f user: jan tags: renderer-trait | |
14:26 | Pass colmeta to callbacks. Leaf check-in: 6db8cf1b39 user: jan tags: trunk | |
13:28 | Up version and changelog update. check-in: edbbe960cd user: jan tags: trunk | |
12:54 | Merge meta. check-in: 7e55bb9041 user: jan tags: trunk | |
12:09 | Merge from trunk to get latest unicode width updates. check-in: 8551ed53a3 user: jan tags: meta | |
11:13 | Release maintenance. check-in: c838aa0bea user: jan tags: qpprint-0.3.1, trunk | |
11:07 | Merge. check-in: be1d708848 user: jan tags: trunk | |
Changes to Cargo.toml.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | [package] name = "qpprint" |
︙ |
Changes to examples/newtbl.rs.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | - + + + - - + + |
|
︙ | |||
48 49 50 51 52 53 54 | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | renderer.print(); } /// Print `Id` as blue if it is greater than `20`. Print `Name` as red if it /// is equal to `world`. fn table2() { |
Changes to src/tbl.rs.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | - + - - + + + - + + - + - + - + + | use yansi::Painted; pub use super::Align; #[allow(clippy::type_complexity)] |
︙ | |||
89 90 91 92 93 94 95 | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | - + | self.trunc_ch = ch; self } #[must_use] pub fn stylize( mut self, |
︙ | |||
116 117 118 119 120 121 122 123 124 125 126 127 128 129 | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | + + + + + + + + + + + | self } pub const fn cell_align_ref(&mut self, align: Align) -> &mut Self { self.cell_align = align; self } #[must_use] pub fn meta(mut self, m: CM) -> Self { self.colmeta = Some(m); self } pub fn meta_r(&mut self, m: CM) -> &mut Self { self.colmeta = Some(m); self } } pub enum CellValue { Str(String), U64(u64) } |
︙ | |||
152 153 154 155 156 157 158 | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - + + - + - + | Self::Str(s) => write!(f, "{s}"), Self::U64(v) => write!(f, "{v}") } } } pub struct CellData<CDM> { pub val: CellValue, pub meta: Option<CDM> } impl<CDM> CellData<CDM> { #[must_use] pub fn str(val: impl Into<String>) -> Self { Self { val: CellValue::Str(val.into()), meta: None } } #[must_use] pub const fn u64(val: u64) -> Self { Self { val: CellValue::U64(val), meta: None } } #[must_use] pub fn meta(mut self, md: CDM) -> Self { self.meta = Some(md); self } } impl<CDM> From<String> for CellData<CDM> { fn from(val: String) -> Self { Self { val: CellValue::from(val), meta: None } } } impl<CDM> From<&str> for CellData<CDM> { fn from(val: &str) -> Self { Self { val: CellValue::from(val), meta: None } } } impl<CDM> From<u64> for CellData<CDM> { fn from(val: u64) -> Self { Self { val: CellValue::from(val), meta: None } } } impl<CDM> fmt::Display for CellData<CDM> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match &self.val { CellValue::Str(s) => write!(f, "{s}"), CellValue::U64(v) => write!(f, "{v}") } } } // Rename to TableData? |
︙ | |||
240 241 242 243 244 245 246 | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | - + | /// long as no one tries to be too creative. #[inline] fn strlen(s: &str) -> usize { //c.title.chars().count() s.width() } |
︙ | |||
286 287 288 289 290 291 292 | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | - + | rrow.push(cell_str); } */ for (cw, (col, cell)) in col_widths.iter_mut().zip(iter::zip(self.cols, row)) { |
︙ | |||
351 352 353 354 355 356 357 | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | - + - | for ((col, cw), (cv, cell)) in iter::zip(iter::zip(self.cols, &col_widths), iter::zip(cvs, row)) { let cell = trunc_str(&cell, *cw, col.trunc_len, col.trunc_ch); if let Some(ref stylize) = col.stylize { |
︙ |
Changes to tests/expect.rs.
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | - + + + - - + + - + - + - + + - - + + - + | use qpprint::tbl::{Align, Column, Data, Renderer}; // With no explicit width constraints, a long title should set the column // witdth: // // A long title // ~~~~~~~~~~~~ // short #[test] fn title_constrains_width() { |
︙ |
Changes to www/changelog.md.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | + + + | # Change Log ⚠️ indicates a breaking change. ## [Unreleased] [Details](/vdiff?from=qpprint-0.3.1&to=trunk) ### Added ### Changed - ⚠️ Add generic types that applications can use to add metadata to columns and cells. ### Removed --- ## [0.3.1] - 2025-05-30 |
︙ |