Function nix::sys::socket::sockaddr_storage_to_addr

source ยท
pub fn sockaddr_storage_to_addr(
    addr: &sockaddr_storage,
    len: usize,
) -> Result<SockAddr>
๐Ÿ‘ŽDeprecated since 0.24.0: use SockaddrLike or SockaddrStorage instead
Expand description

Return the appropriate SockAddr type from a sockaddr_storage of a certain size.

In C this would usually be done by casting. The len argument should be the number of bytes in the sockaddr_storage that are actually allocated and valid. It must be at least as large as all the useful parts of the structure. Note that in the case of a sockaddr_un, len need not include the terminating null.