Skip to main content

Module formatter

Module formatter 

Source
Expand description

Value formatting implementation

This module provides basic/fallback formatting for wire values.

Important: Complex format implementations (Percent, Currency, Scientific, etc.) are now defined in Shape stdlib (stdlib/core/formats.shape) and executed via the Shape runtime. This Rust code provides only:

  1. Basic “Default” format for each type (simple display)
  2. Fallback for when Shape runtime is not available
  3. Wire protocol serialization helpers

For rich formatting with custom parameters, use Shape’s .format() method:

let value = 0.1234;
value.format("Percent")           // "12.34%"
value.format({ format: "Percent", decimals: 1 })  // "12.3%"

Functions§

format_value
Format a wire value to a string using the specified format
parse_value
Parse a string into a wire value (basic fallback)