Encode an address into a `SocketAddrStorage`. Returns the number of bytes that were written. For a safe interface to this functionality, use [`as_any`]. [`as_any`]: Self::as_any # Safety `storage` must be valid to write up to `size_of ()` bytes to.
(&self, storage: *mut SocketAddrStorage)
| 91 | /// `storage` must be valid to write up to `size_of<SocketAddrStorage>()` |
| 92 | /// bytes to. |
| 93 | unsafe fn write_sockaddr(&self, storage: *mut SocketAddrStorage) -> SocketAddrLen { |
| 94 | // The closure dereferences exactly `len` bytes at `ptr`. |
| 95 | self.with_sockaddr(|ptr, len| { |
| 96 | ptr::copy_nonoverlapping(ptr.cast::<u8>(), storage.cast::<u8>(), len as usize); |
| 97 | len |
| 98 | }) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | /// Helper for implementing `SocketAddrArg::with_sockaddr`. |
no test coverage detected