Skip to main content

Decoder

Struct Decoder 

Source
pub struct Decoder<const MAX_SYMBOL_SIZE: usize, const MAX_WINDOW_SYMBOLS: usize, const MAX_EQUATIONS: usize> { /* private fields */ }
Expand description

A bounded RFC 8681 sliding-window decoder.

The decoder maintains a reduced linear system without allocation. Source symbols are addressable with symbol while they remain in the active window. Packet integrity must be checked before symbols are passed here because erasure coding cannot authenticate corrupted input.

Implementations§

Source§

impl<const MAX_SYMBOL_SIZE: usize, const MAX_WINDOW_SYMBOLS: usize, const MAX_EQUATIONS: usize> Decoder<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS, MAX_EQUATIONS>

Source

pub fn new(config: RlcConfig, equation_capacity: usize) -> Result<Self, Error>

Creates an empty decoder with a bounded active equation count.

Source

pub const fn config(&self) -> RlcConfig

Returns the active configuration.

Source

pub const fn rank(&self) -> usize

Returns the current rank of unresolved repair equations.

Source

pub const fn window(&self) -> Option<(EncodingSymbolId, usize)>

Returns the ESI and total span of the retained decoding window.

Source

pub fn discard_before( &mut self, first_retained_esi: EncodingSymbolId, ) -> Result<(), Error>

Discards decoder state older than first_retained_esi.

Equations that still depend on an unknown expired symbol are discarded. This lets an integrating real-time protocol enforce its latency budget even when no newer source symbol arrives.

Source

pub fn symbol(&self, esi: EncodingSymbolId) -> Option<&[u8]>

Returns a received or recovered symbol while it remains in the window.

Source

pub fn known_symbols( &self, ) -> KnownSymbols<'_, MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS, MAX_EQUATIONS> ⓘ

Iterates over all known symbols in ascending wrapping ESI order.

Source

pub fn receive_source( &mut self, esi: EncodingSymbolId, symbol: &[u8], ) -> Result<SourceReport, Error>

Submits a systematic source symbol.

Source

pub fn receive_repair( &mut self, id: RepairPayloadId, symbol: &[u8], ) -> Result<DecodeReport, Error>

Submits one repair symbol and returns its contribution to decoding.

Auto Trait Implementations§

§

impl<const MAX_SYMBOL_SIZE: usize, const MAX_WINDOW_SYMBOLS: usize, const MAX_EQUATIONS: usize> Freeze for Decoder<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS, MAX_EQUATIONS>
where [bool; MAX_WINDOW_SYMBOLS]: Freeze, [[u8; MAX_SYMBOL_SIZE]; MAX_WINDOW_SYMBOLS]: Freeze, [bool; MAX_EQUATIONS]: Freeze, [Row<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS>; MAX_EQUATIONS]: Freeze,

§

impl<const MAX_SYMBOL_SIZE: usize, const MAX_WINDOW_SYMBOLS: usize, const MAX_EQUATIONS: usize> RefUnwindSafe for Decoder<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS, MAX_EQUATIONS>

§

impl<const MAX_SYMBOL_SIZE: usize, const MAX_WINDOW_SYMBOLS: usize, const MAX_EQUATIONS: usize> Send for Decoder<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS, MAX_EQUATIONS>
where [bool; MAX_WINDOW_SYMBOLS]: Send, [[u8; MAX_SYMBOL_SIZE]; MAX_WINDOW_SYMBOLS]: Send, [bool; MAX_EQUATIONS]: Send, [Row<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS>; MAX_EQUATIONS]: Send,

§

impl<const MAX_SYMBOL_SIZE: usize, const MAX_WINDOW_SYMBOLS: usize, const MAX_EQUATIONS: usize> Sync for Decoder<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS, MAX_EQUATIONS>
where [bool; MAX_WINDOW_SYMBOLS]: Sync, [[u8; MAX_SYMBOL_SIZE]; MAX_WINDOW_SYMBOLS]: Sync, [bool; MAX_EQUATIONS]: Sync, [Row<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS>; MAX_EQUATIONS]: Sync,

§

impl<const MAX_SYMBOL_SIZE: usize, const MAX_WINDOW_SYMBOLS: usize, const MAX_EQUATIONS: usize> Unpin for Decoder<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS, MAX_EQUATIONS>
where [bool; MAX_WINDOW_SYMBOLS]: Unpin, [[u8; MAX_SYMBOL_SIZE]; MAX_WINDOW_SYMBOLS]: Unpin, [bool; MAX_EQUATIONS]: Unpin, [Row<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS>; MAX_EQUATIONS]: Unpin,

§

impl<const MAX_SYMBOL_SIZE: usize, const MAX_WINDOW_SYMBOLS: usize, const MAX_EQUATIONS: usize> UnsafeUnpin for Decoder<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS, MAX_EQUATIONS>

§

impl<const MAX_SYMBOL_SIZE: usize, const MAX_WINDOW_SYMBOLS: usize, const MAX_EQUATIONS: usize> UnwindSafe for Decoder<MAX_SYMBOL_SIZE, MAX_WINDOW_SYMBOLS, MAX_EQUATIONS>

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, 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.