grafbase_local_common/
types.rs

1use std::net::Ipv4Addr;
2
3#[derive(Clone, Copy)]
4pub enum LocalAddressType {
5    /// 127.0.0.1
6    Localhost,
7    /// 0.0.0.0
8    Unspecified,
9}
10
11#[derive(Clone, Copy, Debug, serde::Deserialize)]
12#[serde(rename_all = "snake_case")]
13pub enum ResolverMessageLevel {
14    Debug,
15    Error,
16    Info,
17    Warn,
18}
19
20impl LocalAddressType {
21    #[must_use]
22    pub const fn to_ip_v4(&self) -> Ipv4Addr {
23        match self {
24            Self::Localhost => Ipv4Addr::LOCALHOST,
25            Self::Unspecified => Ipv4Addr::UNSPECIFIED,
26        }
27    }
28}