On Sunday, 7 July 2019 at 20:12:30 UTC, drug wrote:
07.07.2019 17:49, Joseph Rushton Wakeling пишет:
it's possible to do something like
`writefln!"%s"(now.toISOExtString)` and have it automatically
use the output range overload rather than allocating a new
string instance.
This is exactly how it is intended to work:
https://run.dlang.io/is/ATjAkx
Thanks for taking the time to answer, but I don't think this
really addresses my question.
Your example shows a struct with `toString` overloads. However,
SysTime.toISOExtString does not work like this: it is a method
with two explicit overloads, one of which just returns a newly
allocated `string`, the other of which returns nothing but
accepts an output range as input:
https://dlang.org/phobos/std_datetime_systime.html#.SysTime.toISOExtString
I want to know if there's an easy way to work with that in
`format` and `writefln` statements.
Note that while SysTime does also have `toString` methods, these
give no control over the kind of datetime string that results:
https://dlang.org/phobos/std_datetime_systime.html#.SysTime.toString
Since I explicitly need the extended ISO format, I need to use
`toISOExtString` directly.