Struct UnixSocketAddress

Source
#[repr(C)]
pub struct UnixSocketAddress { /* private fields */ }
Expand description

Unix socket address.

A Unix socket address can be unnamed or a filesystem path. On Linux it can also be an abstract socket path, although this is not portable.

Implementations§

Source§

impl UnixSocketAddress

Source

pub fn new<P: AsRef<Path>>(path: P) -> Result<Self>

Create a Unix socket address from a path.

Source

pub fn new_unnamed() -> Self

Create a new unnamed unix socket address.

Source

pub fn from_raw(inner: sockaddr_un, len: socklen_t) -> Self

Create a Unix socket address from a libc::sockaddr_un and a length.

Source

pub fn into_raw(self) -> (sockaddr_un, socklen_t)

Convert the [SocketAddress] into raw libc parts.

Source

pub fn as_path(&self) -> Option<&Path>

Get the path associated with the socket address, if there is one.

Returns None if the socket address is unnamed or abstract,

Source

pub fn is_unnamed(&self) -> bool

Check if the address is unnamed.

Source

pub fn as_abstract(&self) -> Option<&CStr>

Get the abstract path associated with the socket address.

Returns None if the socket address is not abstract.

Abstract Unix socket addresses are a non-portable Linux extension.

Trait Implementations§

Source§

impl AsSocketAddress for UnixSocketAddress

Source§

fn as_sockaddr(&self) -> *const sockaddr

Get a pointer to the socket address. Read more
Source§

fn as_sockaddr_mut(address: &mut MaybeUninit<Self>) -> *mut sockaddr

Get a mutable pointer to the socket address. Read more
Source§

fn len(&self) -> socklen_t

Get the lengths of the socket address. Read more
Source§

fn finalize(address: MaybeUninit<Self>, len: socklen_t) -> Result<Self>

Finalize a socket address that has been written into by the kernel. Read more
Source§

fn max_len() -> socklen_t

Get the maximum size of for the socket address. Read more
Source§

fn family(&self) -> sa_family_t

Get the address family of the socket address.
Source§

impl Clone for UnixSocketAddress

Source§

fn clone(&self) -> UnixSocketAddress

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl From<&SocketAddr> for UnixSocketAddress

Source§

fn from(other: &SocketAddr) -> Self

Converts to this type from the input type.
Source§

impl From<&UnixSocketAddress> for SocketAddress

Source§

fn from(other: &UnixSocketAddress) -> Self

Converts to this type from the input type.
Source§

impl From<SocketAddr> for UnixSocketAddress

Source§

fn from(other: SocketAddr) -> Self

Converts to this type from the input type.
Source§

impl From<UnixSocketAddress> for SocketAddress

Source§

fn from(other: UnixSocketAddress) -> Self

Converts to this type from the input type.
Source§

impl SpecificSocketAddress for UnixSocketAddress

Source§

fn static_family() -> sa_family_t

The address family supported by this socket address.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.