pub struct FormatOptions {
pub number: NumberFormat,
pub scientific: Scientific,
pub precision: Option<usize>,
pub separators: Separator,
pub show_refs: ShowRefs,
}Expand description
Formatting options for values.
Fields§
§number: NumberFormatHow to format a number.
scientific: ScientificWhich suffix notation to use for scientific notation.
This option is ignored if number is not NumberFormat::Scientific.
precision: Option<usize>The maximum number of digits to show. If None, the number is formatted with full
precision.
This option might be useful when rendering floating-point numbers. Floating-point numbers
in cas-rs have significantly higher precision than 32-bit / 64-bit floats; however, they
are still subject to the same issues that can occur when performing floating-point
arithmetic. The common solution to this is to trim off a small number of digits from the
result.
Also, integers have arbitrary precision and are usually formatted completely. If this option is set and the integer has too many digits, it will be formatted in scientific notation as if it were a float.
This option does not control the precision of the number during calculation, only the number of digits to display during formatting.
separators: SeparatorWhether to display separators for large numbers.
show_refs: ShowRefsWhether to print addresses of reference types, such as lists.
This is useful for debugging, but can be confusing to an uninitiated user.
Implementations§
Source§impl FormatOptions
impl FormatOptions
Sourcepub fn into_builder(self) -> FormatOptionsBuilder
pub fn into_builder(self) -> FormatOptionsBuilder
Wraps the given FormatOptions into a builder for further customization.
Trait Implementations§
Source§impl Clone for FormatOptions
impl Clone for FormatOptions
Source§fn clone(&self) -> FormatOptions
fn clone(&self) -> FormatOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more