Skip to main content

OwnedSocketRecvMessage

Struct OwnedSocketRecvMessage 

Source
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>

Source

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>

Source§

type Payload = B

Source§

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] ⓘ

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

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

Whether the receive discarded ancillary data. This interface does not expose a control buffer.
Source§

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>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.