From 293f1a9eda538d8ba63ebb2065a87b961d1c7e67 Mon Sep 17 00:00:00 2001 From: Aleksandr Date: Tue, 13 Jan 2026 08:13:11 +0300 Subject: [PATCH] make `MsgHdr` and `MsgHdrMut` `repr(transparent)` to allow legally obtaining `libc::msghdr` from those types --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 13154acd..81b36114 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -562,6 +562,7 @@ impl TcpKeepalive { /// This wraps `msghdr` on Unix and `WSAMSG` on Windows. Also see [`MsgHdrMut`] /// for the variant used by `recvmsg(2)`. #[cfg(not(target_os = "redox"))] +#[repr(transparent)] pub struct MsgHdr<'addr, 'bufs, 'control> { inner: sys::msghdr, #[allow(clippy::type_complexity)] @@ -630,6 +631,7 @@ impl<'name, 'bufs, 'control> fmt::Debug for MsgHdr<'name, 'bufs, 'control> { /// This wraps `msghdr` on Unix and `WSAMSG` on Windows. Also see [`MsgHdr`] for /// the variant used by `sendmsg(2)`. #[cfg(not(target_os = "redox"))] +#[repr(transparent)] pub struct MsgHdrMut<'addr, 'bufs, 'control> { inner: sys::msghdr, #[allow(clippy::type_complexity)]