Struct nix::sys::socket::UnixAddr

pub struct UnixAddr { /* fields hidden */ }
Documentation

A wrapper around sockaddr_un.

Implementations

impl UnixAddr
pub fn new<P: ?Sized + NixPath>(path: &P) -> Result<UnixAddr>

Create a new sockaddr_un representing a filesystem path.

pub fn new_abstract(path: &[u8]) -> Result<UnixAddr>

Create a new sockaddr_un representing an address in the “abstract namespace”.

The leading null byte for the abstract namespace is automatically added; thus the input path is expected to be the bare name, not null-prefixed. This is a Linux-specific extension, primarily used to allow chrooted processes to communicate with processes having a different filesystem view.

pub fn path(&Self) -> Option<&Path>

If this address represents a filesystem path, return that path.

pub fn as_abstract(&Self) -> Option<&[u8]>

If this address represents an abstract socket, return its name.

For abstract sockets only the bare name is returned, without the leading null byte. None is returned for unnamed or path-backed sockets.

pub fn path_len(&Self) -> usize

Returns the addrlen of this socket - offsetof(struct sockaddr_un, sun_path)

pub fn as_ptr(&Self) -> *const libc::sockaddr_un

Returns a pointer to the raw sockaddr_un struct

pub fn as_mut_ptr(&mut Self) -> *mut libc::sockaddr_un

Returns a mutable pointer to the raw sockaddr_un struct

Trait Implementations

impl Clone for UnixAddr
fn clone(&Self) -> UnixAddr
impl Copy for UnixAddr
impl Debug for UnixAddr
fn fmt(&Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl Display for UnixAddr
fn fmt(&Self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Eq for UnixAddr
impl Hash for UnixAddr
fn hash<H: Hasher>(&Self, s: &mut H)
impl PartialEq<UnixAddr> for UnixAddr
fn eq(&Self, other: &UnixAddr) -> bool

Auto Trait Implementations

impl Send for UnixAddr
impl Sync for UnixAddr
impl Unpin for UnixAddr
impl UnwindSafe for UnixAddr

Blanket Implementations

impl<T> Any for T
where
    T: 'static + ?Sized,
fn type_id(&Self) -> TypeId
impl<T> Borrow<T> for T
where
    T: ?Sized,
fn borrow(&Self) -> &T
impl<T> BorrowMut<T> for T
where
    T: ?Sized,
fn borrow_mut(&mut Self) -> &mut T
impl<T> From<T> for T
fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for T
where
    U: From<T>,
fn into(Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

impl<T> ToOwned for T
where
    T: Clone,
type Owned = T
fn to_owned(&Self) -> T
fn clone_into(&Self, target: &mut T)
impl<T> ToString for T
where
    T: Display + ?Sized,
fn to_string(&Self) -> String
impl<T, U> TryFrom<U> for T
where
    U: Into<T>,
type Error = Infallible
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for T
where
    U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn try_into(Self) -> Result<U, <U as TryFrom<T>>::Error>