Skip to main content

ReceiveItem

Struct ReceiveItem 

Source
pub struct ReceiveItem<'a> { /* private fields */ }
Expand description

A single inbound UDP datagram slot.

Create with ReceiveItem::new passing a buffer, then call FastUdpSocket::receive_many to fill it. After a successful receive, data / source / ecn / len return the received datagram’s metadata.

Implementations§

Source§

impl<'a> ReceiveItem<'a>

Source

pub fn new(buf: &'a mut [u8]) -> Self

Create an empty receive slot backed by buf.

Source

pub fn data(&self) -> &[u8]

The received payload (first len bytes of the internal buffer).

Source

pub fn source(&self) -> SocketAddr

The source address of the received datagram.

Source

pub fn ecn(&self) -> Option<Ecn>

The ECN codepoint received with the datagram, if any.

Source

pub fn len(&self) -> usize

Number of bytes received.

Source

pub fn is_empty(&self) -> bool

Whether zero bytes were received.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for ReceiveItem<'a>

§

impl<'a> Freeze for ReceiveItem<'a>

§

impl<'a> RefUnwindSafe for ReceiveItem<'a>

§

impl<'a> Send for ReceiveItem<'a>

§

impl<'a> Sync for ReceiveItem<'a>

§

impl<'a> Unpin for ReceiveItem<'a>

§

impl<'a> UnsafeUnpin for ReceiveItem<'a>

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.