Skip to content

Commit 4c55898

Browse files
committed
Add SockAddr::as_storage
Returns the underlying storage.
1 parent 26ad768 commit 4c55898

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/sockaddr.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ impl SockAddr {
173173
ptr::addr_of!(self.storage).cast()
174174
}
175175

176+
/// Retuns the address as the storage.
177+
pub const fn as_storage(self) -> sockaddr_storage {
178+
self.storage
179+
}
180+
176181
/// Returns true if this address is in the `AF_INET` (IPv4) family, false otherwise.
177182
pub const fn is_ipv4(&self) -> bool {
178183
self.storage.ss_family == AF_INET as sa_family_t

0 commit comments

Comments
 (0)