This is a bit of a follow-up to a prior post, with the adjustment that
Sub are not included in the scope of the proposal.
According to the IETF RFCs defining the internet protocol, internet addresses (both v4 and v6) consist of unsigned (32- or 128-bit, respectively) integers. To implement the
traits would require minimal work, basically just taking the same operations down to the underlying inner types. So, those implementations would be added to the inner types and then exposed through the sys-independent API by just invoking the operation on the inner type from the main
Ipv6Addr types. I'd be happy to work through the process of landing these.
These implementations would be useful in networking code, specifically when performing operations like masking network addresses.
Is there anything controversial about this set of traits and what would go into implementing them? That is to say, does this need to go through the RFC process?
Would it be useful to add heterogeneous impls as well, e.g.
impl BitAnd<Ipv4Addr> for IpAddr(and vice versa?) For prior art on this idea, #72239 which added
SocketAddrdid a similar thing.