I have 2 areas in my code dealing with Tcp and Domain sockets, and processing is almost the same. Because both of these are dealing with streams, I can't find a worthwhile way to implement some kind of genericity without resorting to macros.
I can for sure factor the part with streams, because they implement Write or Read traits. But I can't see how to move any further. TcpStream and UnixStream are 2 different structures, using the same connect() or set_write_timeout() methods, but I didn't find any way to factor these, other than using macros.
If you've got some hints, I'll be happy