pub(crate) unsafe fn with_msghdr<R>(
addr: &impl SocketAddrArg,
iov: &[IoSlice<'_>],
control: &mut SendAncillaryBuffer<'_, '_, '_>,
f: impl FnOnce(&msghdr) -> R,
) -> R
Expand description
Create a message header intended to send with the specified address.
This creates a c::msghdr
and calls a function f
on it. The msghdr
’s
raw pointers may point to temporaries, so this function should avoid
storing the pointers anywhere that would outlive the function call.
§Safety
If f
dereferences the pointers in the msghdr
, it must do so only within
the bounds indicated by the associated lengths in the msghdr
.