3 ms·
... that's because it is a duplicate. If you have a SocketAddr, and you want to access the SocketAddrV6 variant, remembering that you may also have a SocketAddr
by nmilo 4y ago
... that's because it is a duplicate. If you have a SocketAddr, and you want to access the SocketAddrV6 variant, remembering that you may also have a SocketAddrV4, you need an if let:
if let V6(sock6) = addr {
// use sock6: SocketAddrV6
}
The first-linked duplicate answer will answer your question: https://stackoverflow.com/questions/9109872/how-do-you-access-enum-values-in-rust https://stackoverflow.com/questions/9109872/how-do-you-acces...