1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! A token count as a row spells it.
//!
//! One function, in the seam and not in a dialect, because the same number
//! appears on a record's row, on the group row over a folded run and in the
//! status bar — and two spellings of it would drift, which is the argument that
//! put `jsonrow` under both JSON sources. Its own module so
//! [`super`] stays under the size limit.
/// The scales a token count is spelled at, largest first. `u64::MAX` is about
/// 1.8×10¹⁹, so `E` is the last rung there can be and the widest answer this
/// can give is four columns.
const SCALES: = ;
/// A token count in at most **four display columns**: `380`, `1.2k`, `18k`,
/// `1.8M`. A number column is only a column if every number in it is the same
/// width, so the four is a promise and not an estimate.
///
/// # Floored, never rounded
///
/// `999` is `999` and not `1.0k`; `1999` is `1.9k` and not `2.0k`. A row that
/// says `18k` is therefore a promise of *at least* 18,000, which is the reading
/// a person makes of a truncated number and the only one that never overstates
/// what a session spent. The cost is that a bucket hides its magnitude — `18k`
/// is anything up to 18,999, and floored numbers will not add up by eye. The
/// exact integers are one `Enter` away in `detail()`, and the group row and the
/// status bar spell the *exact* sum through this function rather than summing
/// what the rows show.
///
/// It lives in the seam and not in a dialect because a group row spells the
/// same number a record row does, and two spellings would drift — the argument
/// that put `jsonrow` under both JSON sources.