pub fn to_shortest_str<'a, T, F>(
    format_shortest: F,
    v: T,
    sign: Sign,
    frac_digits: usize,
    buf: &'a mut [MaybeUninit<u8>],
    parts: &'a mut [MaybeUninit<Part<'a>>]
) -> Formatted<'a>where
    T: DecodableFloat,
    F: FnMut(&Decoded, &'a mut [MaybeUninit<u8>]) -> (&'a [u8], i16),
🔬This is a nightly-only experimental API. (flt2dec)
Expand description

Formats the given floating point number into the decimal form with at least given number of fractional digits. The result is stored to the supplied parts array while utilizing given byte buffer as a scratch. upper is currently unused but left for the future decision to change the case of non-finite values, i.e., inf and nan. The first part to be rendered is always a Part::Sign (which can be an empty string if no sign is rendered).

format_shortest should be the underlying digit-generation function. It should return the part of the buffer that it initialized. You probably would want strategy::grisu::format_shortest for this.

frac_digits can be less than the number of actual fractional digits in v; it will be ignored and full digits will be printed. It is only used to print additional zeroes after rendered digits. Thus frac_digits of 0 means that it will only print given digits and nothing else.

The byte buffer should be at least MAX_SIG_DIGITS bytes long. There should be at least 4 parts available, due to the worst case like [+][0.][0000][2][0000] with frac_digits = 10.