I want to make write!
work on my own struct implementing fmt::Write
, and I don't have any heap allocation. To do so, I'd need to implement fmt::Write::write_fmt(&mut self, args: fmt::Arguments<'_>) -> fmt::Result
However, this means that I need to access the data in a fmt::Arguments<'_>
without using &args.to_string()
, as .to_string()
does not exist without heap allocation.
There is Arguments::as_str
, however it doesn't work as soon as I need to format elements as i32
.
Is there a way to get the arguments' strings without using .to_string()
?