rust-lang / socket2

Advanced configuration options for sockets.
https://docs.rs/socket2
Apache License 2.0
683 stars 227 forks source link

Add suffix to protocol specific Socket methods #519

Open Thomasdezeeuw opened 4 months ago

Thomasdezeeuw commented 4 months ago

We currently split all methods in different impl blocks with documentation to indicate what kind of socket level the method operates on, e.g. SOL_SOCKET or IPPROTO_IP.

However in some cases a socket option can be used with multiple protocols, e.g. IP_HDRINCL, this can lead to confusing error as seen in #517.

I propose we add a suffix to all not SOL_SOCKET methods. For example:

The methods will be a bit more annoying to call, but at least it will result in less errors.