diff options
Diffstat (limited to 'vendor/rustix/src/net/socket_addr_any.rs')
-rw-r--r-- | vendor/rustix/src/net/socket_addr_any.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/rustix/src/net/socket_addr_any.rs b/vendor/rustix/src/net/socket_addr_any.rs index 287c6c1ee..403ad11c2 100644 --- a/vendor/rustix/src/net/socket_addr_any.rs +++ b/vendor/rustix/src/net/socket_addr_any.rs @@ -32,6 +32,28 @@ pub enum SocketAddrAny { Unix(SocketAddrUnix), } +impl From<SocketAddrV4> for SocketAddrAny { + #[inline] + fn from(from: SocketAddrV4) -> Self { + Self::V4(from) + } +} + +impl From<SocketAddrV6> for SocketAddrAny { + #[inline] + fn from(from: SocketAddrV6) -> Self { + Self::V6(from) + } +} + +#[cfg(unix)] +impl From<SocketAddrUnix> for SocketAddrAny { + #[inline] + fn from(from: SocketAddrUnix) -> Self { + Self::Unix(from) + } +} + impl SocketAddrAny { /// Return the address family of this socket address. #[inline] |