[][src]Function nix::sys::socket::sockaddr_storage_to_addr

pub unsafe fn sockaddr_storage_to_addr(
    addr: &sockaddr_storage,
    len: usize
) -> Result<SockAddr>

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.