Skip to main content

render_number

Function render_number 

Source
pub fn render_number(
    number: Decimal,
    currency: &str,
    config: &FormatConfig,
) -> String
Expand description

Render one number for ledger text.

Through the config’s crate::DisplayContext when present, or the value’s own scale otherwise. The single chokepoint every formatter amount/cost/price number emission goes through — keep it that way so the two behaviors cannot drift per call site (#1766).

Context semantics come from crate::DisplayContext::format_plain: a TRACKED currency pads to the tracked precision (never rounding an over-precise value away); an UNTRACKED currency stays byte-faithful to its own scale; thousands separators are never emitted (canonical ledger text carries none — render_commas stays a report/query display concern).