Closed Jules-Bertholet closed 2 years ago
I would prefer not to build this into this crate. You can copy the strings to your own buffer or you can fork the crate.
Is there a particular reason why you'd rather not include this? It seems unnecessary to fork a crate for such a small addition, and copying the string seems suboptimal considering how this crate was designed with performance in mind.
I need to pass the string that
itoa
returns to C, which means I need to add a null byte at the end. But there's no way to do that with the&str
thatformat
returns, short of copying the string's contents to an entirely new buffer.If
itoa
exposed a method that accepted a pointer or reference to a user-createdMaybeUninit
buffer of the right size, I would be able to do this easily (just set the index one past the number of bytes that were written to 0).