rama_unix/unix/
address.rs1use crate::TokioSocketAddress;
2use std::path::Path;
3
4#[derive(Clone)]
5pub struct UnixSocketAddress(pub(crate) std::os::unix::net::SocketAddr);
11
12impl UnixSocketAddress {
13 #[must_use]
19 pub fn is_unnamed(&self) -> bool {
20 self.0.is_unnamed()
21 }
22
23 #[must_use]
29 pub fn as_pathname(&self) -> Option<&Path> {
30 self.0.as_pathname()
31 }
32}
33
34impl std::fmt::Debug for UnixSocketAddress {
35 fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
36 self.0.fmt(fmt)
37 }
38}
39
40impl From<std::os::unix::net::SocketAddr> for UnixSocketAddress {
41 fn from(value: std::os::unix::net::SocketAddr) -> Self {
42 Self(value)
43 }
44}
45
46impl From<UnixSocketAddress> for std::os::unix::net::SocketAddr {
47 fn from(value: UnixSocketAddress) -> Self {
48 value.0
49 }
50}
51
52impl From<TokioSocketAddress> for UnixSocketAddress {
53 fn from(value: TokioSocketAddress) -> Self {
54 Self(value.into())
55 }
56}
57
58impl From<UnixSocketAddress> for TokioSocketAddress {
59 fn from(value: UnixSocketAddress) -> Self {
60 value.0.into()
61 }
62}