Need help implementing custom write_fmt and buffered write_fmt

As mentioned in this previous thread, you can use the write! macro to format into your own buffer, without extra allocations.

If you want to use it directly on your own File-like objects, you can implement core::fmt::Write for them. You don't need to implement write_fmt yourself. You can rely on the default implementation.