base_scheduler/socket_domain.rs
1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4use crate::SocketAddress;
5
6/// The address family of an IP socket.
7#[derive(Clone, Copy, Debug, Eq, PartialEq)]
8pub enum SocketDomain {
9 /// Internet Protocol version 4.
10 Ipv4,
11 /// Internet Protocol version 6.
12 Ipv6,
13}
14
15impl From<SocketAddress> for SocketDomain {
16 fn from(address: SocketAddress) -> Self {
17 match address {
18 SocketAddress::V4(_) => Self::Ipv4,
19 SocketAddress::V6(_) => Self::Ipv6,
20 }
21 }
22}