Skip to main content

base_scheduler/
socket_recv_result.rs

1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4use crate::SocketAddress;
5
6/// Metadata from one receive. Only `bytes` bytes, spread across the buffers in order, were written; their initialized lengths remain unchanged.
7#[derive(Clone, Copy, Debug, Eq, PartialEq)]
8pub struct SocketRecvResult {
9    /// The number of bytes written into the supplied buffers.
10    pub bytes: usize,
11    /// The sender when supplied by the OS, usually for datagrams. Stream receives may return `None`; use `socket_peer_address` for the connected peer.
12    pub address: Option<SocketAddress>,
13    /// A datagram exceeded the total buffer length. With nonzero capacity, remaining bytes were discarded unless this was a peek. Zero-capacity receive behavior is OS-specific. `bytes` is the copied length, not the original datagram length.
14    pub truncated: bool,
15    /// The OS reported discarded ancillary data. This initial interface supplies no control buffer; ancillary data requires a separate capability.
16    pub control_truncated: bool,
17}