pub trait FloatFormat {
// Required methods
fn write_f64(f: &mut impl Write, value: f64) -> Result;
fn write_f32(f: &mut impl Write, value: f32) -> Result;
}Expand description
This trait allows customization of how json-streaming formats floating point numbers.
There are many valid string representations of a given number. The number 10.0 can e.g.
be represented as 10.0, 10, 1e2, 1.0e2, or 1.0e+2 and many others. There is no
technical reason to customize this, it is entirely about human readability.
See the ‘float_format’ example for details.
Required Methods§
fn write_f64(f: &mut impl Write, value: f64) -> Result
fn write_f32(f: &mut impl Write, value: f32) -> Result
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.