pub trait ReceiverBackend: Sized {
// Required methods
fn new() -> Self;
fn handle_data(
&mut self,
seq: SequenceCount,
flags: SequenceFlag,
payload: &[u8],
) -> Result<DataOutcome, ReceiverError>;
fn skip_gap(&mut self) -> Result<GapOutcome, ReceiverError>;
fn take_message(&mut self) -> Option<&[u8]>;
fn reassembly_data(&self, len: usize) -> &[u8] ⓘ;
fn has_message(&self) -> bool;
fn message_len(&self) -> Option<usize>;
fn consume_message<Ret>(
&mut self,
f: impl FnOnce(&[u8]) -> Ret,
) -> Option<Ret>;
fn expected_seq(&self) -> SequenceCount;
fn recv_bitmap(&self) -> u16;
}Expand description
Trait abstracting over receiver backends (buffering and delivery only).
Required Methods§
Sourcefn 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.
Sourcefn skip_gap(&mut self) -> Result<GapOutcome, ReceiverError>
fn skip_gap(&mut self) -> Result<GapOutcome, ReceiverError>
Skip the current gap (advance past missing packets).
Sourcefn take_message(&mut self) -> Option<&[u8]>
fn take_message(&mut self) -> Option<&[u8]>
Take the complete message.
Sourcefn reassembly_data(&self, len: usize) -> &[u8] ⓘ
fn reassembly_data(&self, len: usize) -> &[u8] ⓘ
Returns a slice of the reassembly buffer.
Sourcefn has_message(&self) -> bool
fn has_message(&self) -> bool
Check if there’s a complete message ready.
Sourcefn message_len(&self) -> Option<usize>
fn message_len(&self) -> Option<usize>
Returns the length of the pending message, if any.
Sourcefn 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.
Sourcefn expected_seq(&self) -> SequenceCount
fn expected_seq(&self) -> SequenceCount
Get the current expected sequence number.
Sourcefn recv_bitmap(&self) -> u16
fn recv_bitmap(&self) -> u16
Get the selective ACK bitmap.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.