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 additionalunsafecode. Manual re-implementation might yield better performance.