Skip to content

Commit

Permalink
Make RecvMsgReturn's Debug impl not break no_std.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Jan 24, 2025
1 parent dadb095 commit 8f0c912
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/net/send_recv/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,6 @@ pub fn recvmsg(
}

/// The result of a successful [`recvmsg`] call.
#[derive(Debug)]
pub struct RecvMsgReturn {
/// The number of bytes received.
///
Expand All @@ -833,6 +832,17 @@ pub struct RecvMsgReturn {
pub address: Option<SocketAddrAny>,
}

#[cfg(feature = "std")]
impl fmt::Debug for RecvMsgReturn {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RecvMsgReturn")
.field("bytes", &self.bytes)
.field("flags", &self.flags)
.field("address", &self.address)
.finish()
}
}

/// An iterator over data in an ancillary buffer.
pub struct AncillaryIter<'data, T> {
/// The data we're iterating over.
Expand Down

0 comments on commit 8f0c912

Please sign in to comment.