pub struct Options { /* private fields */ }
Expand description

Options to customize writing floats.

Examples

use lexical_write_float::Options;

let options = Options::builder()
    .trim_floats(true)
    .nan_string(Some(b"NaN"))
    .inf_string(Some(b"Inf"))
    .build()
    .unwrap();

Implementations

Create options with default values.

Create the default options for a given radix.

Check if the options state is valid.

Get the maximum number of significant digits to write.

Get the minimum number of significant digits to write.

Get the maximum exponent prior to using scientific notation.

Get the minimum exponent prior to using scientific notation.

Get the rounding mode for writing digits with precision control.

Get if we should trim a trailing ".0" from floats.

Get the character to designate the exponent component of a float.

Get the character to separate the integer from the fraction components.

Get the string representation for NaN.

Get the short string representation for Infinity.

Set the maximum number of significant digits to write. Unsafe, use the builder API for option validation.

Safety

Always safe, just marked as unsafe for API compatibility.

Set the minimum number of significant digits to write. Unsafe, use the builder API for option validation.

Safety

Always safe, just marked as unsafe for API compatibility.

Set the maximum exponent prior to using scientific notation.

Safety

Always safe, just marked as unsafe for API compatibility.

Set the minimum exponent prior to using scientific notation.

Safety

Always safe, just marked as unsafe for API compatibility.

Set the rounding mode for writing digits with precision control.

Safety

Always safe, just marked as unsafe for API compatibility.

Set if we should trim a trailing ".0" from floats. Unsafe, use the builder API for option validation.

Safety

Always safe, just marked as unsafe for API compatibility.

Set the character to designate the exponent component of a float.

Safety

Always safe, but may produce invalid output if the exponent is not a valid ASCII character.

Set the character to separate the integer from the fraction components.

Safety

Always safe, but may produce invalid output if the decimal point is not a valid ASCII character.

Set the string representation for NaN. Unsafe, use the builder API for option validation.

Safety

Unsafe if nan_string.len() > MAX_SPECIAL_STRING_LENGTH. This might cause a special string larger than the buffer length to be written, causing a buffer overflow, potentially a severe security vulnerability.

Set the short string representation for Infinity Unsafe, use the builder API for option validation.

Safety

Unsafe if nan_string.len() > MAX_SPECIAL_STRING_LENGTH. This might cause a special string larger than the buffer length to be written, causing a buffer overflow, potentially a severe security vulnerability.

Get WriteFloatOptionsBuilder as a static function.

Create OptionsBuilder using existing values.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Determine if the options are valid.

Get an upper bound on the buffer size.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.