The module std::net provides an API for TCP and Udp socket-IO. My feeling is that this API is too limiting, instead the module should define traits for Datagram and Stream oriented network transports.
- UDP would be just an incarnation of a datagram oriented transport
- TCP is just an incarnation of a stream oriented transport
AFAICS, the API of Rust should be extended, supporting these two types/traits of network IO using sockets:
- datagram-oriented and
Such abstraction would simplify the integration of other transports such as CAN or SCTP, and it would permit the implementation of generic message handlers, dealing with network failures and other events.
The network libraries of C# and erlang might be good examples for this kind of abstraction.
Maybe, has this been discussed in the past already?