From d22db5291ca69c00852b0827b42eb00a8fe4a46d Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Tue, 9 Dec 2025 15:03:20 +0200 Subject: [PATCH] refactor(quinn-udp): make `decode_recv` generic over `MsgHdr` Replace conditional compilation on the `hdr` parameter with a generic type bound `M: cmsg::MsgHdr`. This enables `decode_recv` to work with both `libc::msghdr` and `msghdr_x` message types. Broken out of #2463 as suggested by @djc. --- quinn-udp/src/unix.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/quinn-udp/src/unix.rs b/quinn-udp/src/unix.rs index a6cfff88a..5ac3fbf83 100644 --- a/quinn-udp/src/unix.rs +++ b/quinn-udp/src/unix.rs @@ -712,10 +712,9 @@ fn prepare_recv( hdr.msg_datalen = buf.len(); } -fn decode_recv( +fn decode_recv>( name: &MaybeUninit, - #[cfg(not(apple_fast))] hdr: &libc::msghdr, - #[cfg(apple_fast)] hdr: &msghdr_x, + hdr: &M, len: usize, ) -> io::Result { let name = unsafe { name.assume_init() };