diff --git a/changelog/2459.changed.md b/changelog/2459.changed.md new file mode 100644 index 0000000000..32ba83690e --- /dev/null +++ b/changelog/2459.changed.md @@ -0,0 +1 @@ +Change generics on `recvmmsg` and `sendmmsg` to support memory reuse. \ No newline at end of file diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index cb7618a932..7375bae6bc 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -1506,7 +1506,7 @@ pub fn sendmmsg<'a, XS, AS, C, I, S>( flags: MsgFlags ) -> crate::Result> where - XS: IntoIterator, + XS: IntoIterator, AS: AsRef<[Option]>, I: AsRef<[IoSlice<'a>]> + 'a, C: AsRef<[ControlMessage<'a>]> + 'a, @@ -1657,11 +1657,11 @@ pub fn recvmmsg<'a, XS, S, I>( mut timeout: Option, ) -> crate::Result> where - XS: IntoIterator, + XS: IntoIterator, I: AsMut<[IoSliceMut<'a>]> + 'a, { let mut count = 0; - for (i, (slice, mmsghdr)) in slices.into_iter().zip(data.items.iter_mut()).enumerate() { + for (i, (mut slice, mmsghdr)) in slices.into_iter().zip(data.items.iter_mut()).enumerate() { let p = &mut mmsghdr.msg_hdr; p.msg_iov = slice.as_mut().as_mut_ptr().cast(); p.msg_iovlen = slice.as_mut().len() as _;