pub struct FastReceiver<const WIN: usize, const MTU: usize, const REASM: usize, const TOTAL: usize> { /* private fields */ }Expand description
Fastest backend — O(1) insert and O(1) delivery.
Use when CPU budget is tight and you can afford the extra memory: both buffering an out-of-order segment and delivering a run of consecutive segments are constant-time per packet.
Stores out-of-order segments in WIN fixed MTU-sized slots
indexed by seq % WIN. Each slot reserves a full MTU even
for shorter payloads.
Static memory: WIN × MTU (reorder) + REASM (reassembly).
WIN— receive window (number of slots)MTU— maximum segment payload sizeREASM— reassembly buffer sizeTOTAL— total slot storage (WIN * MTU)
Trait Implementations§
Source§impl<const WIN: usize, const MTU: usize, const REASM: usize, const TOTAL: usize> ReceiverBackend for FastReceiver<WIN, MTU, REASM, TOTAL>
impl<const WIN: usize, const MTU: usize, const REASM: usize, const TOTAL: usize> ReceiverBackend for FastReceiver<WIN, MTU, REASM, TOTAL>
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 MTU: usize, const REASM: usize, const TOTAL: usize> Freeze for FastReceiver<WIN, MTU, REASM, TOTAL>
impl<const WIN: usize, const MTU: usize, const REASM: usize, const TOTAL: usize> RefUnwindSafe for FastReceiver<WIN, MTU, REASM, TOTAL>
impl<const WIN: usize, const MTU: usize, const REASM: usize, const TOTAL: usize> Send for FastReceiver<WIN, MTU, REASM, TOTAL>
impl<const WIN: usize, const MTU: usize, const REASM: usize, const TOTAL: usize> Sync for FastReceiver<WIN, MTU, REASM, TOTAL>
impl<const WIN: usize, const MTU: usize, const REASM: usize, const TOTAL: usize> Unpin for FastReceiver<WIN, MTU, REASM, TOTAL>
impl<const WIN: usize, const MTU: usize, const REASM: usize, const TOTAL: usize> UnsafeUnpin for FastReceiver<WIN, MTU, REASM, TOTAL>
impl<const WIN: usize, const MTU: usize, const REASM: usize, const TOTAL: usize> UnwindSafe for FastReceiver<WIN, MTU, REASM, TOTAL>
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