WriteOptions

Trait WriteOptions 

Source
pub trait WriteOptions: Default {
    // Required methods
    fn is_valid(&self) -> bool;
    fn buffer_size<T, const FORMAT: u128>(&self) -> usize
       where T: FormattedSize;
}
Available on crate features write-floats or write-integers only.
Expand description

Shared trait for all writer options.

Required Methods§

Source

fn is_valid(&self) -> bool

Determine if the options are valid.

Source

fn buffer_size<T, const FORMAT: u128>(&self) -> usize
where T: FormattedSize,

👎Deprecated: Use buffer_size_const instead. Will be removed in 2.0.

Get an upper bound on the required buffer size.

This method is soft-deprecated and meant for internal use. You should always use buffer_size_const for either integer or float writer so you can get the required buffer size at compile time to determine the buffer size required.

This is used when custom formatting options, such as significant digits specifiers or custom exponent breaks, are used, which can lead to more or less significant digits being written than expected. If using the default formatting options, then this will always be FORMATTED_SIZE or FORMATTED_SIZE_DECIMAL, depending on the radix.

Using buffer_size_const lets you create static arrays at compile time, rather than dynamically-allocate memory or know the value ahead of time.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§