pub enum NumberFormat {
Auto,
Decimal,
Scientific,
Fraction,
Word,
}Expand description
The different ways to format a number.
Variants§
Auto
Chooses between decimal and scientific notation based on the magnitude of the number.
Numbers that are in the ranges [-1e-6, 1e-6] U [-inf, -1e+12] U [1e+12, inf] will be
represented in scientific notation, while all other numbers are formatted in decimal
notation.
This is the default option.
Decimal
Formats the number as a decimal.
The number is expressed in decimal notation with no regard to the magnitude of the number.
Scientific
Formats the number in scientific notation.
The formatting of this option can be further customized using the scientific option in
the FormatOptions struct.
Fraction
Formats the number as a fraction.
When using this option, the numerator and denominator are each formatted individually as if
NumberFormat::Auto was used.
Word
Formats the number in word form (e.g. “one”, “two”, “three”).
Implementations§
Source§impl NumberFormat
impl NumberFormat
Sourcepub fn inside(self, options: FormatOptions) -> FormatOptions
pub fn inside(self, options: FormatOptions) -> FormatOptions
Utility function to create a new FormatOptions with the same formating options as the
given FormatOptions, but with the number format set to this value.
Trait Implementations§
Source§impl Clone for NumberFormat
impl Clone for NumberFormat
Source§fn clone(&self) -> NumberFormat
fn clone(&self) -> NumberFormat
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more