-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for std::net::{*Addr*}
#30
Conversation
core::net::{IpAddr, Ipv4Addr, Ipv6Addr}
std::net::{IpAddr, Ipv4Addr, Ipv6Addr}
What about |
Hmm; Edit:
poll: |
std::net::{IpAddr, Ipv4Addr, Ipv6Addr}
std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddrV4}
I agree with your logic that a binary non-human-readable format does not need to worry about being "pretty" and can use that to its advantage to be more complete/correct. Further, encoding the extra fields is strictly more useful than not encoding them. If I want to just store an IP address + port, I can just make them two separate fields in my struct ( However, if the encoding omits them, now I have no way of preserving them, if I happen to have a use case where they are actually important. There is no way to "opt in". Therefore, my opinion is that they should be encoded. |
std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddrV4}
std::net::{*Addr*}
Thank you, I personally agree! (this PR is now awaiting @caibear's review, although I already use it via a |
Works by converting them to/from existing implementations like
Result<Ipv4Addr, Ipv6Addr>
,u32
,u128
, and(Ipv4Addr, u16)
. This is to avoid additionalunsafe
code. Manual re-implementation might yield better performance.