Why no `impl io::Write for UnixDatagram`?

I have a simple question. Why is io::Write not implemented for UnixDatagram?
it seems to satisfy the contract of a writer.

I guess it's because io::Write is for streams, not messages. A wrapper like BufWriter doesn't change what data is written when it writes to streams, but it would mess up a message-oriented protocol.


Yea ok, so io::Write doesn't make any guarantees about preserving a message's boundaries whereas UnixDatagram expects that the bytes given to UnixDatagram::send represent a discrete message.

Well in that case I'll remove the UnixDatagramWriter wrapper and rethink my design :laughing:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.