Struct non_std::dependencies::strs_tools::string::number::WriteFloatOptionsBuilder
[−]pub struct WriteFloatOptionsBuilder { /* private fields */ }
Expand description
Builder for Options
.
Implementations
impl OptionsBuilder
impl OptionsBuilder
pub const fn new() -> OptionsBuilder
pub const fn get_max_significant_digits(&self) -> Option<NonZeroUsize>
pub const fn get_max_significant_digits(&self) -> Option<NonZeroUsize>
Get the maximum number of significant digits to write.
pub const fn get_min_significant_digits(&self) -> Option<NonZeroUsize>
pub const fn get_min_significant_digits(&self) -> Option<NonZeroUsize>
Get the minimum number of significant digits to write.
pub const fn get_positive_exponent_break(&self) -> Option<NonZeroI32>
pub const fn get_positive_exponent_break(&self) -> Option<NonZeroI32>
Get the maximum exponent prior to using scientific notation.
pub const fn get_negative_exponent_break(&self) -> Option<NonZeroI32>
pub const fn get_negative_exponent_break(&self) -> Option<NonZeroI32>
Get the minimum exponent prior to using scientific notation.
pub 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.
pub 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.
pub const fn get_exponent(&self) -> u8
pub const fn get_exponent(&self) -> u8
Get the character to designate the exponent component of a float.
pub 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.
pub 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
.
pub 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
.
pub const fn max_significant_digits(
self,
max_significant_digits: Option<NonZeroUsize>
) -> OptionsBuilder
pub const fn max_significant_digits(
self,
max_significant_digits: Option<NonZeroUsize>
) -> OptionsBuilder
Set the maximum number of significant digits to write.
pub const fn min_significant_digits(
self,
min_significant_digits: Option<NonZeroUsize>
) -> OptionsBuilder
pub const fn min_significant_digits(
self,
min_significant_digits: Option<NonZeroUsize>
) -> OptionsBuilder
Set the minimum number of significant digits to write.
pub const fn positive_exponent_break(
self,
positive_exponent_break: Option<NonZeroI32>
) -> OptionsBuilder
pub const fn positive_exponent_break(
self,
positive_exponent_break: Option<NonZeroI32>
) -> OptionsBuilder
Set the maximum exponent prior to using scientific notation.
pub const fn negative_exponent_break(
self,
negative_exponent_break: Option<NonZeroI32>
) -> OptionsBuilder
pub const fn negative_exponent_break(
self,
negative_exponent_break: Option<NonZeroI32>
) -> OptionsBuilder
Set the minimum exponent prior to using scientific notation.
pub const fn round_mode(self, round_mode: RoundMode) -> OptionsBuilder
pub const fn round_mode(self, round_mode: RoundMode) -> OptionsBuilder
Set the rounding mode for writing digits with precision control.
pub const fn trim_floats(self, trim_floats: bool) -> OptionsBuilder
pub const fn trim_floats(self, trim_floats: bool) -> OptionsBuilder
Set if we should trim a trailing ".0"
from floats.
pub const fn exponent(self, exponent: u8) -> OptionsBuilder
pub const fn exponent(self, exponent: u8) -> OptionsBuilder
Set the character to designate the exponent component of a float.
pub const fn decimal_point(self, decimal_point: u8) -> OptionsBuilder
pub const fn decimal_point(self, decimal_point: u8) -> OptionsBuilder
Set the character to separate the integer from the fraction components.
pub const fn nan_string(
self,
nan_string: Option<&'static [u8]>
) -> OptionsBuilder
pub const fn nan_string(
self,
nan_string: Option<&'static [u8]>
) -> OptionsBuilder
Set the string representation for NaN
.
pub const fn inf_string(
self,
inf_string: Option<&'static [u8]>
) -> OptionsBuilder
pub const fn inf_string(
self,
inf_string: Option<&'static [u8]>
) -> OptionsBuilder
Set the string representation for Infinity
.
pub const fn nan_str_is_valid(&self) -> bool
pub const fn nan_str_is_valid(&self) -> bool
Determine if nan_str
is valid.
pub const fn inf_str_is_valid(&self) -> bool
pub const fn inf_str_is_valid(&self) -> bool
Determine if inf_str
is valid.
pub const unsafe fn build_unchecked(&self) -> Options
pub const unsafe fn build_unchecked(&self) -> Options
Build the Options struct with bounds validation.
Safety
Safe as long as is_valid
is true. If nan_string
or inf_string
are too long, writing special floats may lead to buffer overflows,
and therefore severe security vulnerabilities.
Trait Implementations
impl Clone for OptionsBuilder
impl Clone for OptionsBuilder
fn clone(&self) -> OptionsBuilder
fn clone(&self) -> OptionsBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for OptionsBuilder
impl Debug for OptionsBuilder
impl Default for OptionsBuilder
impl Default for OptionsBuilder
fn default() -> OptionsBuilder
fn default() -> OptionsBuilder
Returns the “default value” for a type. Read more
impl PartialEq<OptionsBuilder> for OptionsBuilder
impl PartialEq<OptionsBuilder> for OptionsBuilder
fn eq(&self, other: &OptionsBuilder) -> bool
fn eq(&self, other: &OptionsBuilder) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &OptionsBuilder) -> bool
fn ne(&self, other: &OptionsBuilder) -> bool
This method tests for !=
.
impl Eq for OptionsBuilder
impl StructuralEq for OptionsBuilder
impl StructuralPartialEq for OptionsBuilder
Auto Trait Implementations
impl RefUnwindSafe for OptionsBuilder
impl Send for OptionsBuilder
impl Sync for OptionsBuilder
impl Unpin for OptionsBuilder
impl UnwindSafe for OptionsBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
sourceimpl<Target, Original> VectorizedInto<Target> for Original where
Target: VectorizedFrom<Original>,
impl<Target, Original> VectorizedInto<Target> for Original where
Target: VectorizedFrom<Original>,
sourcefn vectorized_into(self) -> Target
fn vectorized_into(self) -> Target
Performs the conversion.