pub struct OwnedSocketRecvMessage<Buffer: IoBuf> { /* private fields */ }Expand description
A received payload owner paired with portable receive metadata. Other message implementations may retain their backend’s native metadata instead.
Implementations§
Source§impl<B: IoBuf> OwnedSocketRecvMessage<B>
impl<B: IoBuf> OwnedSocketRecvMessage<B>
Sourcepub fn new(result: SocketRecvResult, payload: B) -> Self
pub fn new(result: SocketRecvResult, payload: B) -> Self
payload must expose exactly the received bytes reported by result.bytes.
Trait Implementations§
Source§impl<B: IoBuf> SocketRecvMessage for OwnedSocketRecvMessage<B>
impl<B: IoBuf> SocketRecvMessage for OwnedSocketRecvMessage<B>
type Payload = B
Source§fn address(&self) -> Option<impl SocketAddressView + '_>
fn address(&self) -> Option<impl SocketAddressView + '_>
The source endpoint when supplied by the receive operation. Stream chunks may have no address; use
socket_peer_address for the connected peer. The view’s lifetime is bounded by this message. Its representation and any conversion costs are implementation details.Source§fn payload(&self) -> &[u8] ⓘ
fn payload(&self) -> &[u8] ⓘ
Exactly the completed payload. Empty datagrams expose an empty slice. Headers, source-address storage, ancillary metadata, and unused capacity are outside this range.
Source§fn truncated(&self) -> bool
fn truncated(&self) -> bool
Whether a datagram exceeded the supplied payload capacity. The exposed bytes are the received prefix, not the original datagram length.
Source§fn control_truncated(&self) -> bool
fn control_truncated(&self) -> bool
Whether the receive discarded ancillary data. This interface does not expose a control buffer.
Source§fn into_payload(self) -> B
fn into_payload(self) -> B
Consume the message and return independently owned storage exposing the same payload bytes and range as
payload(), including any modifications through SocketRecvMessageMut. The owner can be passed to owned I/O or retained after receiver shutdown. Address views cannot outlive this transfer.Source§impl<B: IoBufMut> SocketRecvMessageMut for OwnedSocketRecvMessage<B>
impl<B: IoBufMut> SocketRecvMessageMut for OwnedSocketRecvMessage<B>
Source§fn payload_mut(&mut self) -> &mut [u8] ⓘ
fn payload_mut(&mut self) -> &mut [u8] ⓘ
The same completed range as
payload(), with exclusive access for parsing or decryption. Changes are visible through subsequent payload access and ownership transfer; metadata is outside this range.Auto Trait Implementations§
impl<Buffer> Freeze for OwnedSocketRecvMessage<Buffer>where
Buffer: Freeze,
impl<Buffer> RefUnwindSafe for OwnedSocketRecvMessage<Buffer>where
Buffer: RefUnwindSafe,
impl<Buffer> Send for OwnedSocketRecvMessage<Buffer>
impl<Buffer> Sync for OwnedSocketRecvMessage<Buffer>where
Buffer: Sync,
impl<Buffer> Unpin for OwnedSocketRecvMessage<Buffer>where
Buffer: Unpin,
impl<Buffer> UnsafeUnpin for OwnedSocketRecvMessage<Buffer>where
Buffer: UnsafeUnpin,
impl<Buffer> UnwindSafe for OwnedSocketRecvMessage<Buffer>where
Buffer: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more