Skip to content

Commit

Permalink
feat(primitives): implement Display for SegmentRangeInclusive (#6488
Browse files Browse the repository at this point in the history
)
  • Loading branch information
shekhirin authored Feb 8, 2024
1 parent d9e0634 commit ad56b98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/reth/src/commands/db/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ impl Command {

let mut row = Row::new();
row.add_cell(Cell::new(segment))
.add_cell(Cell::new(format!("{block_range:?}")))
.add_cell(Cell::new(format!("{block_range}")))
.add_cell(Cell::new(
tx_range.map_or("N/A".to_string(), |tx_range| format!("{tx_range:?}")),
tx_range.map_or("N/A".to_string(), |tx_range| format!("{tx_range}")),
))
.add_cell(Cell::new(format!("{columns} x {rows}")));
if !only_total_size {
Expand Down
6 changes: 6 additions & 0 deletions crates/primitives/src/snapshot/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,12 @@ impl SegmentRangeInclusive {
}
}

impl std::fmt::Display for SegmentRangeInclusive {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}..={}", self.start, self.end)
}
}

impl From<RangeInclusive<u64>> for SegmentRangeInclusive {
fn from(value: RangeInclusive<u64>) -> Self {
SegmentRangeInclusive { start: *value.start(), end: *value.end() }
Expand Down

0 comments on commit ad56b98

Please sign in to comment.