On Sun Jun 14, 2020 at 11:43 AM, Alyssa Ross wrote:
Occasionally, it is useful to be able to use UnixSeqpacket as a type that can represent any kind of MsgSocket. For example, to keep some MsgSockets of different types in a Vec. In this case, it may be known what type of messages should be sent over a socket, even though that may not be represantable in the type system.
To accomodate this situation, this patch introduces send_msg_on_socket and recv_msg_on_socket methods on UnixSeqpacket, that can be used to send or receive any kind of MsgOnSocket. The caller is obviously responsible for ensuring that the messages being sent are of the type expected by the socket.
This lack of type safety for message types is not ideal, and so MsgSender and MsgReceiver should still be preferred wherever possible.
Is there anyway this can or will be rectified?
--- msg_socket/src/lib.rs | 52 ++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 20 deletions(-)
Otherwise, I don't see anything obviously wrong, but I'm also not very familiar with sockets. Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>