(
lines: &mut Vec<Line<'static>>,
name: &str,
count: usize,
total: usize,
bar_max_width: usize,
color: Color,
)
| 728 | } |
| 729 | |
| 730 | fn push_layer_bar( |
| 731 | lines: &mut Vec<Line<'static>>, |
| 732 | name: &str, |
| 733 | count: usize, |
| 734 | total: usize, |
| 735 | bar_max_width: usize, |
| 736 | color: Color, |
| 737 | ) { |
| 738 | let pct = if total > 0 { |
| 739 | count as f64 / total as f64 |
| 740 | } else { |
| 741 | 0.0 |
| 742 | }; |
| 743 | let bar_filled = (pct * bar_max_width as f64) as usize; |
| 744 | let bar_filled = if count > 0 { bar_filled.max(1) } else { 0 }; |
| 745 | let bar_empty = bar_max_width.saturating_sub(bar_filled); |
| 746 | |
| 747 | lines.push(Line::from(vec![ |
| 748 | Span::styled( |
| 749 | format!(" {:>12} ", name), |
| 750 | Style::default().fg(Color::DarkGray), |
| 751 | ), |
| 752 | Span::styled( |
| 753 | "\u{2588}".repeat(bar_filled), |
| 754 | Style::default().fg(color), |
| 755 | ), |
| 756 | Span::styled( |
| 757 | "\u{2591}".repeat(bar_empty), |
| 758 | Style::default().fg(Color::DarkGray), |
| 759 | ), |
| 760 | Span::raw(" "), |
| 761 | Span::styled( |
| 762 | format!("{} ({:.0}%)", count, pct * 100.0), |
| 763 | Style::default().fg(Color::White), |
| 764 | ), |
| 765 | ])); |
| 766 | } |
| 767 | |
| 768 | // ── SSE streaming ────────────────────────────────────────────────────────── |
| 769 |
no test coverage detected