You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Annoying. But no, it shouldn't be an enum of enums. That would require either making separate socket functions for each AddressFamily, or using tagged enums, which aren't zero-cost. Instead, we should either use libc_bitflags!, or if this is the only violator we can add a const CanBcm = SockProtocol::NetlinkUserSock alias.
Yeah, what I was imagining was a tagged outer enum, which, true, isn't zero cost, but seems to model the issue properly: Each protocol family has it's own enumeration of different protocols.
For that matter, though, we could probably infer both the family and protocol from the tagged outer enum! So one family/protocol parameter instead of two. That would even out the cost, but introduce some new issues.
It's just pretty funny that there wasn't an overlap with all the values that are already implemented.
But, anyway, I'm not looking to make this perfect here. I'm looking to solve an immediate couple of problems. The quick-fix to make CanBcm an external constant works well enough for me.
I wanted to send in a PR to add the CANbus socket protocols to
SockProtocol
, to includeCanRaw
(1) andCanBcm
(2).Like this:
The problem is that CAN_BCM = 2, which is already used by the discriminant,
NetlinkUserSock = libc::NETLINK_USERSOCK
.Should
SockProtocol
be converted into an enum of enum's for each protocol family?The text was updated successfully, but these errors were encountered: