Skip to content

Commit 49b844f

Browse files
committed
Don't use MsgHdr for recvmsg
Instead we'll create a separate MsgHdrMut for recvmsg, similar to IoSlice and IoSliceMut.
1 parent 457d326 commit 49b844f

File tree

1 file changed

+4
-30
lines changed

1 file changed

+4
-30
lines changed

src/lib.rs

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -569,14 +569,15 @@ impl TcpKeepalive {
569569
}
570570
}
571571

572-
/// Configuration of a `{send,recv}msg` system call.
572+
/// Configuration of a `sendmsg(2)` system call.
573573
///
574-
/// This wraps `msghdr` on Unix and `WSAMSG` on Windows.
574+
/// This wraps `msghdr` on Unix and `WSAMSG` on Windows. Also see [`MsgHdrMut`]
575+
/// for the variant used by `recvmsg(2)`.
575576
#[cfg(not(target_os = "redox"))]
576577
pub struct MsgHdr<'addr, 'bufs, 'control> {
577578
inner: sys::msghdr,
578579
#[allow(clippy::type_complexity)]
579-
_lifetimes: PhantomData<(&'addr SockAddr, &'bufs [&'bufs [u8]], &'control [u8])>,
580+
_lifetimes: PhantomData<(&'addr SockAddr, &'bufs IoSlice<'bufs>, &'control [u8])>,
580581
}
581582

582583
#[cfg(not(target_os = "redox"))]
@@ -600,15 +601,6 @@ impl<'addr, 'bufs, 'control> MsgHdr<'addr, 'bufs, 'control> {
600601
self
601602
}
602603

603-
/// Set the mutable address (name) of the message. Same as [`with_addr`],
604-
/// but with a mutable address.
605-
///
606-
/// [`with_addr`]: MsgHdr::with_addr
607-
pub fn with_addr_mut(mut self, addr: &'addr mut SockAddr) -> Self {
608-
sys::set_msghdr_name(&mut self.inner, addr);
609-
self
610-
}
611-
612604
/// Set the buffer(s) of the message.
613605
///
614606
/// Corresponds to setting `msg_iov` and `msg_iovlen` on Unix and `lpBuffers`
@@ -619,15 +611,6 @@ impl<'addr, 'bufs, 'control> MsgHdr<'addr, 'bufs, 'control> {
619611
self
620612
}
621613

622-
/// Set the mutable buffer(s) of the message. Same as [`with_buffers`], but
623-
/// with mutable buffers.
624-
///
625-
/// [`with_buffers`]: MsgHdr::with_buffers
626-
pub fn with_buffers_mut(mut self, bufs: &'bufs mut [MaybeUninitSlice<'bufs>]) -> Self {
627-
sys::set_msghdr_iov(&mut self.inner, bufs.as_mut_ptr().cast(), bufs.len());
628-
self
629-
}
630-
631614
/// Set the control buffer of the message.
632615
///
633616
/// Corresponds to setting `msg_control` and `msg_controllen` on Unix and
@@ -638,15 +621,6 @@ impl<'addr, 'bufs, 'control> MsgHdr<'addr, 'bufs, 'control> {
638621
self
639622
}
640623

641-
/// Set the mutable control buffer of the message. Same as [`with_control`],
642-
/// but with a mutable buffers.
643-
///
644-
/// [`with_control`]: MsgHdr::with_control
645-
pub fn with_control_mut(mut self, buf: &'control mut [u8]) -> Self {
646-
sys::set_msghdr_control(&mut self.inner, buf.as_mut_ptr().cast(), buf.len());
647-
self
648-
}
649-
650624
/// Set the flags of the message.
651625
///
652626
/// Corresponds to setting `msg_flags` on Unix and `dwFlags` on Windows.

0 commit comments

Comments
 (0)