pub struct Sockaddr { /* private fields */ }Implementations§
Source§impl Sockaddr
impl Sockaddr
pub fn family(&self) -> sa_family_t
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Return the size, in bytes, of the pointed-to Sockaddr. This byte count includes the
leading two bytes used to store the address family.
Sourcepub fn as_parts(&self) -> (&sockaddr, socklen_t)
pub fn as_parts(&self) -> (&sockaddr, socklen_t)
Return a reference to the underlying sockaddr and the length. This is useful for calling
underlying libc functions that take a constant sockaddr. For libc functions that take
mutable sockaddrs, see SockaddrStorage::as_mut_parts.
Sourcepub unsafe fn from_raw_parts<'a>(addr: *const sockaddr, len: usize) -> &'a Self
pub unsafe fn from_raw_parts<'a>(addr: *const sockaddr, len: usize) -> &'a Self
Create a Sockaddr reference from a sockaddr pointer and a size.
§Safety
The sockaddr pointer must point to a valid sockaddr of some sort, and len must be
less than or equal to the size of the underlying sockaddr object.