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 bytesREASM— reassembly buffer size
Trait Implementations§
Source§impl<const WIN: usize, const BUF: usize, const REASM: usize> ReceiverBackend for PackedReceiver<WIN, BUF, REASM>
impl<const WIN: usize, const BUF: usize, const REASM: usize> ReceiverBackend for PackedReceiver<WIN, BUF, REASM>
Source§fn handle_data(
&mut self,
seq: SequenceCount,
flags: SequenceFlag,
payload: &[u8],
) -> Result<DataOutcome, ReceiverError>
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>
fn skip_gap(&mut self) -> Result<GapOutcome, ReceiverError>
Skip the current gap (advance past missing packets).
Source§fn take_message(&mut self) -> Option<&[u8]>
fn take_message(&mut self) -> Option<&[u8]>
Take the complete message.
Source§fn has_message(&self) -> bool
fn has_message(&self) -> bool
Check if there’s a complete message ready.
Source§fn message_len(&self) -> Option<usize>
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>
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
fn expected_seq(&self) -> SequenceCount
Get the current expected sequence number.
Source§fn recv_bitmap(&self) -> u16
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> 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