pub struct PacketBuffer<'a, 'b, H: 'a> { /* private fields */ }
Expand description

An UDP packet ring buffer.

Implementations§

Create a new packet buffer with the provided metadata and payload storage.

Metadata storage limits the maximum number of packets in the buffer and payload storage limits the maximum total size of packets.

Query whether the buffer is empty.

Query whether the buffer is full.

Enqueue a single packet with the given header into the buffer, and return a reference to its payload, or return Err(Error::Exhausted) if the buffer is full, or return Err(Error::Truncated) if the buffer does not have enough spare payload space.

Call f with a single packet from the buffer, and dequeue the packet if f returns successfully, or return Err(Error::Exhausted) if the buffer is empty.

Dequeue a single packet from the buffer, and return a reference to its payload as well as its header, or return Err(Error::Exhausted) if the buffer is empty.

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.