#[cfg(not(unix))]
use std::path::Path;
#[cfg(unix)]
pub use std::os::unix::net::SocketAddr;
#[cfg(not(unix))]
#[derive(Debug, Clone)]
pub struct SocketAddr(void::Void);
#[cfg(not(unix))]
impl SocketAddr {
pub fn is_unnamed(&self) -> bool {
void::unreachable(self.0)
}
pub fn as_pathname(&self) -> Option<&Path> {
void::unreachable(self.0)
}
pub fn from_pathname<P: AsRef<Path>>(path: P) -> std::io::Result<Self> {
let _ = path;
Err(NoAfUnixSocketSupport.into())
}
}
#[derive(Clone, Debug, Default, thiserror::Error)]
#[error("No support for unix domain sockets on this platform")]
#[non_exhaustive]
pub struct NoAfUnixSocketSupport;
#[deprecated]
pub type NoUnixAddressSupport = NoAfUnixSocketSupport;
impl From<NoAfUnixSocketSupport> for std::io::Error {
fn from(value: NoAfUnixSocketSupport) -> Self {
std::io::Error::new(std::io::ErrorKind::Unsupported, value)
}
}