Expand description
An enum representation of an unix socket address.
Useful for pattern matching an UnixSocketAddr
via UnixSocketAddr.name()
.
It cannot be used to bind or connect a socket directly as it
doesn’t contain a sockaddr_un
, but a UnixSocketAddr
can be created
from it.
Examples
Cleaning up pathname socket files after ourselves:
let addr = UnixSocketAddr::from_path("/var/run/socket.sock").unwrap();
if let AddrName::Path(path) = addr.name() {
let _ = std::fs::remove_file(path);
}
Variants
Unnamed
Unnamed / anonymous address.
Path(&'a Path)
Regular file path based address.
Can be both relative and absolute.
Abstract(&'a [u8])
Address in the abstract namespace.
Trait Implementations
sourceimpl<'a> From<&'a UnixSocketAddr> for AddrName<'a>
impl<'a> From<&'a UnixSocketAddr> for AddrName<'a>
sourcefn from(addr: &'a UnixSocketAddr) -> AddrName<'a>
fn from(addr: &'a UnixSocketAddr) -> AddrName<'a>
Converts to this type from the input type.
sourceimpl<'a> PartialEq<AddrName<'a>> for AddrName<'a>
impl<'a> PartialEq<AddrName<'a>> for AddrName<'a>
impl<'a> Copy for AddrName<'a>
impl<'a> Eq for AddrName<'a>
impl<'a> StructuralEq for AddrName<'a>
impl<'a> StructuralPartialEq for AddrName<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for AddrName<'a>
impl<'a> Send for AddrName<'a>
impl<'a> Sync for AddrName<'a>
impl<'a> Unpin for AddrName<'a>
impl<'a> UnwindSafe for AddrName<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more