pub struct OptionsBuilder { /* private fields */ }
Expand description
Builder for Options
.
Implementations§
Source§impl OptionsBuilder
impl OptionsBuilder
pub const fn new() -> Self
Sourcepub const fn get_max_significant_digits(&self) -> OptionUsize
pub const fn get_max_significant_digits(&self) -> OptionUsize
Get the maximum number of significant digits to write.
Sourcepub const fn get_min_significant_digits(&self) -> OptionUsize
pub const fn get_min_significant_digits(&self) -> OptionUsize
Get the minimum number of significant digits to write.
Sourcepub const fn get_positive_exponent_break(&self) -> OptionI32
pub const fn get_positive_exponent_break(&self) -> OptionI32
Get the maximum exponent prior to using scientific notation.
Sourcepub const fn get_negative_exponent_break(&self) -> OptionI32
pub const fn get_negative_exponent_break(&self) -> OptionI32
Get the minimum exponent prior to using scientific notation.
Sourcepub const fn get_round_mode(&self) -> RoundMode
pub const fn get_round_mode(&self) -> RoundMode
Get the rounding mode for writing digits with precision control.
Sourcepub const fn get_trim_floats(&self) -> bool
pub const fn get_trim_floats(&self) -> bool
Get if we should trim a trailing ".0"
from floats.
Sourcepub const fn get_exponent(&self) -> u8
pub const fn get_exponent(&self) -> u8
Get the character to designate the exponent component of a float.
Sourcepub const fn get_decimal_point(&self) -> u8
pub const fn get_decimal_point(&self) -> u8
Get the character to separate the integer from the fraction components.
Sourcepub const fn get_nan_string(&self) -> Option<&'static [u8]>
pub const fn get_nan_string(&self) -> Option<&'static [u8]>
Get the string representation for NaN
.
Sourcepub const fn get_inf_string(&self) -> Option<&'static [u8]>
pub const fn get_inf_string(&self) -> Option<&'static [u8]>
Get the short string representation for Infinity
.
Sourcepub const fn max_significant_digits(
self,
max_significant_digits: OptionUsize,
) -> Self
pub const fn max_significant_digits( self, max_significant_digits: OptionUsize, ) -> Self
Set the maximum number of significant digits to write.
Sourcepub const fn min_significant_digits(
self,
min_significant_digits: OptionUsize,
) -> Self
pub const fn min_significant_digits( self, min_significant_digits: OptionUsize, ) -> Self
Set the minimum number of significant digits to write.
Sourcepub const fn positive_exponent_break(
self,
positive_exponent_break: OptionI32,
) -> Self
pub const fn positive_exponent_break( self, positive_exponent_break: OptionI32, ) -> Self
Set the maximum exponent prior to using scientific notation.
Sourcepub const fn negative_exponent_break(
self,
negative_exponent_break: OptionI32,
) -> Self
pub const fn negative_exponent_break( self, negative_exponent_break: OptionI32, ) -> Self
Set the minimum exponent prior to using scientific notation.
Sourcepub const fn round_mode(self, round_mode: RoundMode) -> Self
pub const fn round_mode(self, round_mode: RoundMode) -> Self
Set the rounding mode for writing digits with precision control.
Sourcepub const fn trim_floats(self, trim_floats: bool) -> Self
pub const fn trim_floats(self, trim_floats: bool) -> Self
Set if we should trim a trailing ".0"
from floats.
Sourcepub const fn exponent(self, exponent: u8) -> Self
pub const fn exponent(self, exponent: u8) -> Self
Set the character to designate the exponent component of a float.
Sourcepub const fn decimal_point(self, decimal_point: u8) -> Self
pub const fn decimal_point(self, decimal_point: u8) -> Self
Set the character to separate the integer from the fraction components.
Sourcepub const fn nan_string(self, nan_string: Option<&'static [u8]>) -> Self
pub const fn nan_string(self, nan_string: Option<&'static [u8]>) -> Self
Set the string representation for NaN
.
Panics
Setting a value too large may cause a panic even if FORMATTED_SIZE
elements are provided.
Sourcepub const fn inf_string(self, inf_string: Option<&'static [u8]>) -> Self
pub const fn inf_string(self, inf_string: Option<&'static [u8]>) -> Self
Set the string representation for Infinity
.
Panics
Setting a value too large may cause a panic even if FORMATTED_SIZE
elements are provided.
Sourcepub const fn nan_str_is_valid(&self) -> bool
pub const fn nan_str_is_valid(&self) -> bool
Determine if nan_str
is valid.
Sourcepub const fn inf_str_is_valid(&self) -> bool
pub const fn inf_str_is_valid(&self) -> bool
Determine if inf_str
is valid.
Sourcepub const fn build_unchecked(&self) -> Options
pub const fn build_unchecked(&self) -> Options
Build the Options struct without validation.
§Panics
This is completely safe, however, misusing this, especially
the nan_string
and inf_string
representations could cause
panics at runtime. Always use [MAX_SPECIAL_STRING_LENGTH
] and
check if Self::is_valid
prior to using a created format string.
Trait Implementations§
Source§impl Clone for OptionsBuilder
impl Clone for OptionsBuilder
Source§fn clone(&self) -> OptionsBuilder
fn clone(&self) -> OptionsBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more