Enum nix::sys::socket::SockAddr
#[non_exhaustive]
pub enum SockAddr {
Inet(InetAddr),
Unix(UnixAddr),
Netlink(NetlinkAddr),
Alg(AlgAddr),
Link(LinkAddr),
Vsock(VsockAddr),
}
Documentation
Represents a socket address
Variants
Netlink(NetlinkAddr)
Implementations
impl SockAddr
pub fn new_netlink(pid: u32, groups: u32) -> SockAddr
pub fn family(&Self) -> AddressFamily
pub fn as_ffi_pair(&Self) -> (&libc::sockaddr, libc::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 Debug for SockAddr
fn fmt(&Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl Display for SockAddr
fn fmt(&Self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Hash for SockAddr
fn hash<__H: $crate::hash::Hasher>(&Self, state: &mut __H) -> ()
impl StructuralEq for SockAddr
impl StructuralPartialEq for SockAddr
Auto Trait Implementations
impl RefUnwindSafe for SockAddr
impl UnwindSafe for SockAddr
Blanket Implementations
impl<T> BorrowMut<T> for T
where
T: ?Sized,
where
T: ?Sized,
fn borrow_mut(&mut Self) -> &mut T