Skip to content

Commit

Permalink
Right align numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkAndshark committed Nov 11, 2023
1 parent b45285f commit 9d5e950
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
10 changes: 7 additions & 3 deletions mbtiles/src/mbtiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl Display for Statistics {

writeln!(
f,
"|{:^9}|{:^9}|{:^9}|{:^9}|{:^9}|{:^9}|",
"|{:>9}|{:>9}|{:>9}|{:>9}|{:>9}|{:>9}|",
l.zoom,
l.count,
format!("{smallest:.2}B"),
Expand All @@ -105,8 +105,12 @@ impl Display for Statistics {
let average = SizeFormatterBinary::new(self.average as u64);
writeln!(
f,
"|{:^9}|{:^9}|{:^9}B|{:^9}B|{:^9}B|",
"all", self.count, smallest, largest, average
"|{:>9}|{:>9}|{:>9}|{:>9}|{:>9}|",
"all",
self.count,
format!("{smallest}B"),
format!("{largest}B"),
format!("{average}B")
)
.unwrap();
}
Expand Down
16 changes: 8 additions & 8 deletions tests/expected/mbtiles/stats.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ FileSize: 48.00KiB
Schema: flat
Page size: 4.00KiB
| zoom | count |smallest | largest | average | bbox |
| 0 | 1 | 1.08KiB | 1.08KiB | 1.08KiB |-179.99999997494382,-85.05112877764508,180.00000015460688,85.05112879314403|
| 1 | 4 | 160B | 650B | 366B |-179.99999997494382,-85.05112877764508,180.00000015460688,85.05112879314403|
| 2 | 7 | 137B | 495B | 239B |-179.99999997494382,-66.51326042021836,180.00000015460688,66.51326049182072|
| 3 | 17 | 67B | 246B | 134B |-134.99999995874995,-40.9798980140281,180.00000015460688,66.51326049182072|
| 4 | 38 | 64B | 175B | 86B |-134.99999995874995,-40.9798980140281,180.00000015460688,66.51326049182072|
| 5 | 57 | 64B | 107B | 72B |-123.74999995470151,-40.9798980140281,180.00000015460688,61.60639642757953|
| 6 | 72 | 64B | 97B | 68B |-123.74999995470151,-40.9798980140281,180.00000015460688,61.60639642757953|
| all | 196 |64B|1.0KiB|96B|
| 0| 1| 1.08KiB| 1.08KiB| 1.08KiB|-179.99999997494382,-85.05112877764508,180.00000015460688,85.05112879314403|
| 1| 4| 160B| 650B| 366B|-179.99999997494382,-85.05112877764508,180.00000015460688,85.05112879314403|
| 2| 7| 137B| 495B| 239B|-179.99999997494382,-66.51326042021836,180.00000015460688,66.51326049182072|
| 3| 17| 67B| 246B| 134B|-134.99999995874995,-40.9798980140281,180.00000015460688,66.51326049182072|
| 4| 38| 64B| 175B| 86B|-134.99999995874995,-40.9798980140281,180.00000015460688,66.51326049182072|
| 5| 57| 64B| 107B| 72B|-123.74999995470151,-40.9798980140281,180.00000015460688,61.60639642757953|
| 6| 72| 64B| 97B| 68B|-123.74999995470151,-40.9798980140281,180.00000015460688,61.60639642757953|
| all| 196| 64B| 1.0KiB| 96B|

0 comments on commit 9d5e950

Please sign in to comment.