Skip to main content

Module numfmt

Module numfmt 

Source
Expand description

Display-time number formatting: digit grouping, decimal separator, optional fixed float precision. Display only: exports, queries, filters, views and group-by keys use raw values. Runs per visible cell per frame, so it allocates nothing beyond the caller’s String: integers are written digit by digit with inline separators, NumberFormat::width_i64 measures arithmetically, and per-column decisions resolve to a CellFormatter once per column per frame.

Structs§

Glob
Minimal glob matcher: * (any run) and ? (one character), all column-name matching needs.
NumberFormat
How numbers are rendered. Resolved from config once at load time.
NumberFormatSettings
Fully resolved display-formatting settings, held in the render context.

Enums§

CellFormatter
Per-column formatting decision, resolved once per column per frame.
Grouping
Digit grouping style.

Functions§

bytes
A byte count in binary units: 512 B, 1.2 MiB, and whole from 100 up, 340 MiB.
clock
A wait’s clock, to the second while seconds matter: 12s, 3m 05s, 1h 02m.
display_width
A value’s on-screen cells without building its string where possible (integers); others are rendered and measured as the table measures them.
duration
A length of time in its largest unit, to a tenth past seconds so it fits a narrow column: 12s, 2.5m, 1.5h, -2.1d.
duration_or_dash
duration, or - for none.
format_any_value
Format one value for display; Cow::Borrowed when no formatting applies.
group_chrome
Comma-group a count for datui’s own chrome (footer count, info totals), regardless of display.number_format or ,: turning formatting off for exact data never makes the UI harder to read.
is_numeric_dtype
True for dtypes whose values are numbers we group.
is_right_aligned_dtype
Dtypes rendered flush right; temporals excluded (fixed-width already).
percent
A share as a percentage: a tenth of a percent, two places below 1% so a small share never reads as none, and <0.01% below that.
percent_of
percent of count in of, or a dash with nothing to take it over.
preset_for_locale_tag
Map a POSIX locale tag to its preset, only for an explicit grouping = "system". A small static table rather than megabytes of ICU/CLDR to pick a separator.
system_locale_tag
Read the environment’s numeric locale, honouring POSIX precedence. Returns None when unset or explicitly the C/POSIX locale.