(
f: &mut fmt::Formatter<'_>,
mut rows: I,
ctx: &mut Indent,
redacted: bool,
)
| 1460 | } |
| 1461 | |
| 1462 | pub fn fmt_text_constant_rows<'a, I>( |
| 1463 | f: &mut fmt::Formatter<'_>, |
| 1464 | mut rows: I, |
| 1465 | ctx: &mut Indent, |
| 1466 | redacted: bool, |
| 1467 | ) -> fmt::Result |
| 1468 | where |
| 1469 | I: Iterator<Item = (&'a Row, &'a Diff)>, |
| 1470 | { |
| 1471 | let mut row_count = Diff::ZERO; |
| 1472 | let mut first_rows = Vec::with_capacity(20); |
| 1473 | for _ in 0..20 { |
| 1474 | if let Some((row, diff)) = rows.next() { |
| 1475 | row_count += diff.abs(); |
| 1476 | first_rows.push((row, diff)); |
| 1477 | } |
| 1478 | } |
| 1479 | let rest_of_row_count = rows.map(|(_, diff)| diff.abs()).sum::<Diff>(); |
| 1480 | if !rest_of_row_count.is_zero() { |
| 1481 | writeln!( |
| 1482 | f, |
| 1483 | "{}total_rows (diffs absed): {}", |
| 1484 | ctx, |
| 1485 | row_count + rest_of_row_count |
| 1486 | )?; |
| 1487 | writeln!(f, "{}first_rows:", ctx)?; |
| 1488 | ctx.indented(move |ctx| write_first_rows(f, &first_rows, ctx, redacted))?; |
| 1489 | } else { |
| 1490 | write_first_rows(f, &first_rows, ctx, redacted)?; |
| 1491 | } |
| 1492 | Ok(()) |
| 1493 | } |
| 1494 | |
| 1495 | fn write_first_rows( |
| 1496 | f: &mut fmt::Formatter<'_>, |
no test coverage detected