There are two things that have
and three things that have
write_str method. The above two plus
I understand that the formatting macros don’t care, because they just expand to call to
write_fmt and don’t care about which trait provides the method.
However for functions that want to take “something to which I can format” this situation is bad, because streams implement
It would be much more useful if there was only one trait for writing string (
std::fmt::Write) and another for writing bytes (
std::io::Write). And the streams in
std::io would then define both. Or even only stdin/stdout/stderr would and files would require wrapping to be explicit about encoding.