Skip to main content

ResendReceiver

Struct ResendReceiver 

Source
pub struct ResendReceiver { /* private fields */ }
Expand description

Go-Back-N receiver state machine.

In Go-Back-N ARQ, frames arriving out of order are not queued or reordered; they are immediately dropped and prompt a cumulative ACK of the latest contiguous in-order frame.

This state machine provides two-phase sequence progression (inspect and advance_in_order) to allow transport drivers to apply backpressure.

Implementations§

Source§

impl ResendReceiver

Source

pub fn new() -> Self

Creates a new receiver state machine with expected_seq = 0.

Source

pub fn expected_seq(&self) -> u8

Returns the sequence number currently expected by the receiver.

Source

pub fn inspect(&self, seq: u8) -> FrameStatus

Evaluates an incoming frame sequence number without advancing state.

Returns FrameStatus::InOrder if seq == expected_seq. Otherwise, returns FrameStatus::OutOfOrder with the cumulative ACK sequence to transmit.

Source

pub fn advance_in_order(&mut self, seq: u8) -> Result<u8, UnexpectedSeqError>

Advances expected_seq by 1 and returns the cumulative ACK sequence to transmit.

§Errors

Returns UnexpectedSeqError if seq != expected_seq.

Source

pub fn accept_seq(&mut self, seq: u8) -> FrameStatus

Processes an incoming frame sequence number in a single step.

If seq == expected_seq, advances the sequence and returns FrameStatus::InOrder. Otherwise, returns FrameStatus::OutOfOrder with the cumulative ACK to send in response.

Callers implementing two-phase flow control (e.g. attempting non-blocking writes to bounded channels before committing sequence progression) should use inspect followed by advance_in_order instead.

Source

pub fn current_ack_seq(&self) -> Option<u8>

Returns the current cumulative ACK sequence for out-of-order/duplicate frames.

If no frames have been received yet, returns None to suppress spurious ACK 255 emission on startup packet loss (BUG-PROT-02).

Source

pub fn reset(&mut self)

Resets the receiver to expect sequence number 0.

Trait Implementations§

Source§

impl Clone for ResendReceiver

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ResendReceiver

Source§

impl Debug for ResendReceiver

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ResendReceiver

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for ResendReceiver

Source§

impl PartialEq for ResendReceiver

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ResendReceiver

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.