pub(crate) struct SocketAddrBuf {
pub(crate) len: socklen_t,
pub(crate) storage: MaybeUninit<SocketAddrStorage>,
}
Expand description
Temporary buffer for creating a SocketAddrAny
from a syscall that writes
to a sockaddr_t
and socklen_t
Unlike SocketAddrAny
, this does not maintain the invariant that len
bytes are initialized.
Fields§
§len: socklen_t
§storage: MaybeUninit<SocketAddrStorage>
Implementations§
Source§impl SocketAddrBuf
impl SocketAddrBuf
pub(crate) const fn new() -> Self
Sourcepub(crate) unsafe fn into_any(self) -> SocketAddrAny
pub(crate) unsafe fn into_any(self) -> SocketAddrAny
Convert the buffer into SocketAddrAny
.
§Safety
A valid address must have been written into self.storage
and its
length written into self.len
.
Sourcepub(crate) unsafe fn into_any_option(self) -> Option<SocketAddrAny>
pub(crate) unsafe fn into_any_option(self) -> Option<SocketAddrAny>
Convert the buffer into Option<SocketAddrAny>
.
This returns None
if len
is zero or other platform-specific
conditions define the address as empty.
§Safety
Either valid address must have been written into self.storage
and its
length written into self.len
, or self.len
must have been set to 0.
Auto Trait Implementations§
impl Freeze for SocketAddrBuf
impl RefUnwindSafe for SocketAddrBuf
impl Send for SocketAddrBuf
impl Sync for SocketAddrBuf
impl Unpin for SocketAddrBuf
impl UnwindSafe for SocketAddrBuf
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more