Is there a reason the standard library doesn't implement
io::Write? I was struggling to figure out how to treat
Stdout as a
fmt::Write until I saw this comment about using a wrapper struct.
If there's a good reason the standard library doesn't implement
io::Write, perhaps the standard library should at least provide a wrapper struct for this purpose?
It's backwards incompatible to add blanket definitions - someone might have already implemented both traits for their own types.
Why there was no initial blanket impl, and whether it was accidental or a deliberate separation of concerns / enabling of flexibility, I couldn't say offhand.
There is a problem with implementing both, because of how
write! just duck types between
fmt::Write by calling the methods shared by both. If you implement both traits, then
write! would be ambiguous when both are in scope.
Okay, those answers both make sense. Is there any good reason not to provide a wrapper type in the standard library for converting an
io::Write into a