Skip to main content

PackedReceiver

Struct PackedReceiver 

Source
pub struct PackedReceiver<const WIN: usize, const BUF: usize, const REASM: usize> { /* private fields */ }
Expand description

Packed backend — efficient when payloads are small.

Use when segments are typically much smaller than the MTU: out-of-order payloads are bump-allocated at their actual size, so BUF can be much smaller than WIN × MTU.

OOO insert is O(1) (bump append). Delivery copies each buffered segment into the reassembly buffer — O(MSG) total.

Static memory: BUF (reorder slab) + REASM (reassembly).

  • WIN — receive window (number of indexed slots)
  • BUF — bump slab capacity in bytes
  • REASM — reassembly buffer size

Trait Implementations§

Source§

impl<const WIN: usize, const BUF: usize, const REASM: usize> ReceiverBackend for PackedReceiver<WIN, BUF, REASM>

Source§

fn new() -> Self

Create a new backend with empty buffers.
Source§

fn handle_data( &mut self, seq: SequenceCount, flags: SequenceFlag, payload: &[u8], ) -> Result<DataOutcome, ReceiverError>

Process a received data packet.
Source§

fn skip_gap(&mut self) -> Result<GapOutcome, ReceiverError>

Skip the current gap (advance past missing packets).
Source§

fn take_message(&mut self) -> Option<&[u8]>

Take the complete message.
Source§

fn reassembly_data(&self, len: usize) -> &[u8]

Returns a slice of the reassembly buffer.
Source§

fn has_message(&self) -> bool

Check if there’s a complete message ready.
Source§

fn message_len(&self) -> Option<usize>

Returns the length of the pending message, if any.
Source§

fn consume_message<Ret>(&mut self, f: impl FnOnce(&[u8]) -> Ret) -> Option<Ret>

Pass the pending message to f and mark it consumed.
Source§

fn expected_seq(&self) -> SequenceCount

Get the current expected sequence number.
Source§

fn recv_bitmap(&self) -> u16

Get the selective ACK bitmap.

Auto Trait Implementations§

§

impl<const WIN: usize, const BUF: usize, const REASM: usize> Freeze for PackedReceiver<WIN, BUF, REASM>

§

impl<const WIN: usize, const BUF: usize, const REASM: usize> RefUnwindSafe for PackedReceiver<WIN, BUF, REASM>

§

impl<const WIN: usize, const BUF: usize, const REASM: usize> Send for PackedReceiver<WIN, BUF, REASM>

§

impl<const WIN: usize, const BUF: usize, const REASM: usize> Sync for PackedReceiver<WIN, BUF, REASM>

§

impl<const WIN: usize, const BUF: usize, const REASM: usize> Unpin for PackedReceiver<WIN, BUF, REASM>

§

impl<const WIN: usize, const BUF: usize, const REASM: usize> UnsafeUnpin for PackedReceiver<WIN, BUF, REASM>

§

impl<const WIN: usize, const BUF: usize, const REASM: usize> UnwindSafe for PackedReceiver<WIN, BUF, REASM>

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> Same for T

Source§

type Output = T

Should always be Self
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.