#[non_exhaustive]pub enum SockAddr {
Inet(InetAddr),
Unix(UnixAddr),
}
👎Deprecated since 0.24.0: use SockaddrLike or SockaddrStorage instead
Expand description
Represents a socket address
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Inet(InetAddr)
👎Deprecated since 0.24.0: use SockaddrLike or SockaddrStorage instead
Unix(UnixAddr)
👎Deprecated since 0.24.0: use SockaddrLike or SockaddrStorage instead
Implementations§
Source§impl SockAddr
impl SockAddr
pub fn new_inet(addr: InetAddr) -> SockAddr
pub fn new_unix<P: ?Sized + NixPath>(path: &P) -> Result<SockAddr>
pub fn family(&self) -> AddressFamily
pub fn to_str(&self) -> String
👎Deprecated since 0.23.0: use .to_string() instead
Sourcepub fn as_ffi_pair(&self) -> (&sockaddr, socklen_t)
pub fn as_ffi_pair(&self) -> (&sockaddr, socklen_t)
Conversion from nix’s SockAddr type to the underlying libc sockaddr type.
This is useful for interfacing with other libc functions that don’t yet have nix wrappers. Returns a reference to the underlying data type (as a sockaddr reference) along with the size of the actual data type. sockaddr is commonly used as a proxy for a superclass as C doesn’t support inheritance, so many functions that take a sockaddr * need to take the size of the underlying type as well and then internally cast it back.
Trait Implementations§
impl Copy for SockAddr
impl Eq for SockAddr
impl StructuralPartialEq for SockAddr
Auto Trait Implementations§
impl Freeze for SockAddr
impl RefUnwindSafe for SockAddr
impl Send for SockAddr
impl Sync for SockAddr
impl Unpin for SockAddr
impl UnwindSafe for SockAddr
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)