Skip to main content

write_decimal

Function write_decimal 

Source
fn write_decimal(n: i32, buf: &mut [u8])
Expand description

Write the decimal representation of n into buf, null-terminated.

Uses digit-reversal on a small stack scratch buffer : no heap allocation. Handles negative values with a leading -. Writes at most buf.len()-1 digits and always null-terminates buf[0] on empty / overflow.