Commit 2d25d65
committed
feat: add hm-common crate with compact duration formatting
Introduce the hm-common crate, seeded with a formatting module: a
sealed CompactDuration extension trait on std::time::Duration returning
a StopwatchDurationDisplay (allocation-free Display wrapper). Rendering
follows humantime semantics — lossless, most-significant unit first,
zero units omitted — in compact notation (1s500ms, 1h1m1s, 2h, 1d2h).
Covered by rstest cases plus proptest round-trip/well-formedness.
Wire it into hm-render's progress output, replacing the hand-rolled
format_duration (which capped at minutes, so >=1h rendered as e.g.
"61m1s"). Machine-facing "duration={ms}ms" log lines stay integer ms.
Also adopt the human_units crate for byte-size rendering, collapsing
four hand-rolled formatters (human_mb, human_bytes, and an inline mb
closure) into `.format_size()`. Output shifts to correct IEC labels
(e.g. "6 MiB" instead of the mislabeled 1024-base "6.0 MB").1 parent 17e6964 commit 2d25d65
13 files changed
Lines changed: 428 additions & 63 deletions
File tree
- crates
- hm-common
- proptest-regressions
- src
- hm-exec
- src/cloud
- hm-render
- src
- hm
- src/commands
- cache
- run
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| 60 | + | |
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
| |||
0 commit comments