Support for prefix/postfixed buffer
Closed this issue · 1 comments
adnan449 commented
Most of the times, the buffer has prefix/postfix strings and you need to append/prepend a number to it. An API comparable to this would be ideal:
fn demo_itoa_fmt() -> fmt::Result {
// Write to a string.
let mut s = String::from("Result is: ");
itoa::fmt_append(&mut s, 128u64)?;
println!("{}", s);
Ok(())
}
dtolnay commented
This is already supported and does not require a new API.
fn main() {
let mut s = String::from("Result is: ");
s.push_str(itoa::Buffer::new().format(128u64));
println!("{}", s);
}