pub struct SockaddrUnix<T>where
    T: Borrow<sockaddr_un>,{ /* private fields */ }Expand description
A Unix socket address.
Typically will be used as an owned address SockaddrUnix<libc::sockaddr_un> or a borrowed
address SockaddrUnix<&libc::sockaddr_un>, and you can convert between them using methods such
as as_ref or into_owned.
Implementations§
Source§impl<T> SockaddrUnix<T>where
    T: Borrow<sockaddr_un>,
 
impl<T> SockaddrUnix<T>where
    T: Borrow<sockaddr_un>,
Sourcepub fn new(addr: T, len: socklen_t) -> Option<Self>
 
pub fn new(addr: T, len: socklen_t) -> Option<Self>
Get a new SockaddrUnix for a libc::sockaddr_un. The libc::sockaddr_un must be
properly initialized. Will return None if the length is too short, too long, or if
sun_family is not AF_UNIX.
Sourcepub fn as_path(&self) -> Option<&CStr>
 
pub fn as_path(&self) -> Option<&CStr>
If the socket address represents a pathname address, returns the C string representing the filesystem path.
Sourcepub fn as_abstract(&self) -> Option<&[u8]>
 
pub fn as_abstract(&self) -> Option<&[u8]>
If the socket address represents an abstract address, returns the bytes representing the
name of the abstract socket address. These bytes do not include the nul byte at
sun_path[0].
Sourcepub fn is_unnamed(&self) -> bool
 
pub fn is_unnamed(&self) -> bool
Is the unix socket address unnamed? On Linux, unnamed unix sockets are unnamed if their
length is size_of::<libc::sa_family_t>().
Sourcepub fn into_owned(self) -> SockaddrUnix<sockaddr_un>
 
pub fn into_owned(self) -> SockaddrUnix<sockaddr_un>
Get an owned unix socket address.
Sourcepub fn as_ref(&self) -> SockaddrUnix<&sockaddr_un>
 
pub fn as_ref(&self) -> SockaddrUnix<&sockaddr_un>
Get a borrowed unix socket address.
Sourcepub fn as_ptr(&self) -> (*const sockaddr_un, socklen_t)
 
pub fn as_ptr(&self) -> (*const sockaddr_un, socklen_t)
Get a pointer to the unix socket address. All fields of the libc::sockaddr_un will be
properly initialized.
Source§impl<T> SockaddrUnix<T>where
    T: BorrowMut<sockaddr_un>,
 
impl<T> SockaddrUnix<T>where
    T: BorrowMut<sockaddr_un>,
Sourcepub fn as_mut(&mut self) -> SockaddrUnix<&mut sockaddr_un>
 
pub fn as_mut(&mut self) -> SockaddrUnix<&mut sockaddr_un>
Get a mutably borrowed unix socket address.
Source§impl SockaddrUnix<sockaddr_un>
 
impl SockaddrUnix<sockaddr_un>
Sourcepub fn new_path(path: &CStr) -> Option<Self>
 
pub fn new_path(path: &CStr) -> Option<Self>
Get a new SockaddrUnix with the given path. Will return None if the path is empty or is
too large.
Sourcepub fn new_abstract(name: &[u8]) -> Option<Self>
 
pub fn new_abstract(name: &[u8]) -> Option<Self>
Get a new SockaddrUnix with the given abstract address name. The name does not include the
required nul byte at sun_path[0]. Will return None if the name is too large.
Sourcepub fn new_unnamed() -> SockaddrUnix<sockaddr_un>
 
pub fn new_unnamed() -> SockaddrUnix<sockaddr_un>
Get a new unnamed unix socket address.
Trait Implementations§
Source§impl<T> Clone for SockaddrUnix<T>
 
impl<T> Clone for SockaddrUnix<T>
Source§fn clone(&self) -> SockaddrUnix<T>
 
fn clone(&self) -> SockaddrUnix<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T> Debug for SockaddrUnix<T>where
    T: Borrow<sockaddr_un>,
 
impl<T> Debug for SockaddrUnix<T>where
    T: Borrow<sockaddr_un>,
Source§impl<T> Display for SockaddrUnix<T>where
    T: Borrow<sockaddr_un>,
 
impl<T> Display for SockaddrUnix<T>where
    T: Borrow<sockaddr_un>,
Source§impl<T> From<SockaddrUnix<T>> for SockaddrStoragewhere
    T: Borrow<sockaddr_un>,
 
impl<T> From<SockaddrUnix<T>> for SockaddrStoragewhere
    T: Borrow<sockaddr_un>,
Source§fn from(addr: SockaddrUnix<T>) -> Self
 
fn from(addr: SockaddrUnix<T>) -> Self
Source§impl<T> PartialEq for SockaddrUnix<T>where
    T: Borrow<sockaddr_un>,
 
impl<T> PartialEq for SockaddrUnix<T>where
    T: Borrow<sockaddr_un>,
impl<T> Copy for SockaddrUnix<T>
impl<T> Eq for SockaddrUnix<T>where
    T: Borrow<sockaddr_un>,
Auto Trait Implementations§
impl<T> Freeze for SockaddrUnix<T>where
    T: Freeze,
impl<T> RefUnwindSafe for SockaddrUnix<T>where
    T: RefUnwindSafe,
impl<T> Send for SockaddrUnix<T>where
    T: Send,
impl<T> Sync for SockaddrUnix<T>where
    T: Sync,
impl<T> Unpin for SockaddrUnix<T>where
    T: Unpin,
impl<T> UnwindSafe for SockaddrUnix<T>where
    T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more