lexical_util::constants

Trait FormattedSize

Source
pub trait FormattedSize {
    const FORMATTED_SIZE: usize;
    const FORMATTED_SIZE_DECIMAL: usize;
}
Expand description

The size, in bytes, of formatted values.

Required Associated Constants§

Source

const FORMATTED_SIZE: usize

Maximum number of bytes required to serialize a number to string.

Note that this value may be insufficient if digit precision control, exponent break points, or disabling exponent notation is used. If you are changing the number significant digits written, the exponent break points, or disabling scientific notation, you will need a larger buffer than the one provided. An upper limit on the buffer size can then be determined using WriteOptions::buffer_size.

Source

const FORMATTED_SIZE_DECIMAL: usize

Maximum number of bytes required to serialize a number to a decimal string.

Note that this value may be insufficient if digit precision control, exponent break points, or disabling exponent notation is used. If you are changing the number significant digits written, the exponent break points, or disabling scientific notation, you will need a larger buffer than the one provided. An upper limit on the buffer size can then be determined using WriteOptions::buffer_size.

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.

Implementations on Foreign Types§

Source§

impl FormattedSize for f32

Source§

impl FormattedSize for f64

Source§

impl FormattedSize for i8

Source§

impl FormattedSize for i16

Source§

impl FormattedSize for i32

Source§

impl FormattedSize for i64

Source§

impl FormattedSize for i128

Source§

impl FormattedSize for isize

Source§

impl FormattedSize for u8

Source§

impl FormattedSize for u16

Source§

impl FormattedSize for u32

Source§

impl FormattedSize for u64

Source§

impl FormattedSize for u128

Source§

impl FormattedSize for usize

Implementors§