21.05.2021 16:45, newbie пишет:
I am following https://wiki.dlang.org/Defining_custom_print_format_specifiers, why sink and formatValue are not @safe? What are the best practice for toString in safe code? Thank you

sink is obsolete now, use W(riter)

```D
import std.range : isOutputRange;

void toString(W)(ref W writer) const
        if (isOutputRange!(W, char))
{
        // your stuff
}
```
writer can be @safe, @nogc, nothrow etc like you want

Reply via email to