pub struct BaseDecoder<T: Types> { /* private fields */ }Expand description
A decoder capable of receiving and recombining fountain-encoded transmissions.
§Examples
See the crate::fountain module documentation for an example.
Implementations§
Source§impl<const MAX_MESSAGE_LEN: usize, const MAX_MIXED_PARTS: usize, const MAX_FRAGMENT_LEN: usize, const MAX_SEQUENCE_COUNT: usize, const QUEUE_SIZE: usize> BaseDecoder<Heapless<MAX_MESSAGE_LEN, MAX_MIXED_PARTS, MAX_FRAGMENT_LEN, MAX_SEQUENCE_COUNT, QUEUE_SIZE>>
impl<const MAX_MESSAGE_LEN: usize, const MAX_MIXED_PARTS: usize, const MAX_FRAGMENT_LEN: usize, const MAX_SEQUENCE_COUNT: usize, const QUEUE_SIZE: usize> BaseDecoder<Heapless<MAX_MESSAGE_LEN, MAX_MIXED_PARTS, MAX_FRAGMENT_LEN, MAX_SEQUENCE_COUNT, QUEUE_SIZE>>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Constructs a new HeaplessDecoder.
Source§impl<T: Types> BaseDecoder<T>
impl<T: Types> BaseDecoder<T>
Sourcepub fn receive(&mut self, part: &Part<'_>) -> Result<bool, Error>
pub fn receive(&mut self, part: &Part<'_>) -> Result<bool, Error>
Receives a fountain-encoded part into the decoder.
§Examples
See the crate::fountain module documentation for an example.
§Errors
If the part would fail validate because it is inconsistent
with previously received parts, an error will be returned.
Sourcepub fn is_part_consistent(&self, part: &Part<'_>) -> bool
pub fn is_part_consistent(&self, part: &Part<'_>) -> bool
Sourcepub fn message(&self) -> Result<Option<&[u8]>, Error>
pub fn message(&self) -> Result<Option<&[u8]>, Error>
If complete, returns the decoded message, None otherwise.
§Errors
If an inconsistent internal state is detected, an error will be returned.
§Examples
See the crate::fountain module documentation for an example.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Returns whether the decoder is complete and hence the message available.
§Examples
See the crate::fountain module documentation for an example.
Sourcepub fn estimated_percent_complete(&self) -> f64
pub fn estimated_percent_complete(&self) -> f64
Calculate estimated percentage of completion.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for BaseDecoder<T>where
<T as Types>::Message: Freeze,
<T as Types>::MixedParts: Freeze,
<T as Types>::Indexes: Freeze,
<T as Types>::Queue: Freeze,
<<T as Types>::Chooser as Types>::Indexes: Freeze,
<<T as Types>::Chooser as Types>::Shuffled: Freeze,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Aliases: Freeze,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Probs: Freeze,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Weights: Freeze,
<<<T as Types>::Chooser as Types>::Sampler as Types>::S: Freeze,
<<<T as Types>::Chooser as Types>::Sampler as Types>::L: Freeze,
impl<T> RefUnwindSafe for BaseDecoder<T>where
<T as Types>::Message: RefUnwindSafe,
<T as Types>::MixedParts: RefUnwindSafe,
<T as Types>::Indexes: RefUnwindSafe,
<T as Types>::Queue: RefUnwindSafe,
<<T as Types>::Chooser as Types>::Indexes: RefUnwindSafe,
<<T as Types>::Chooser as Types>::Shuffled: RefUnwindSafe,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Aliases: RefUnwindSafe,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Probs: RefUnwindSafe,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Weights: RefUnwindSafe,
<<<T as Types>::Chooser as Types>::Sampler as Types>::S: RefUnwindSafe,
<<<T as Types>::Chooser as Types>::Sampler as Types>::L: RefUnwindSafe,
impl<T> Send for BaseDecoder<T>where
<T as Types>::Message: Send,
<T as Types>::MixedParts: Send,
<T as Types>::Indexes: Send,
<T as Types>::Queue: Send,
<<T as Types>::Chooser as Types>::Indexes: Send,
<<T as Types>::Chooser as Types>::Shuffled: Send,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Aliases: Send,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Probs: Send,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Weights: Send,
<<<T as Types>::Chooser as Types>::Sampler as Types>::S: Send,
<<<T as Types>::Chooser as Types>::Sampler as Types>::L: Send,
impl<T> Sync for BaseDecoder<T>where
<T as Types>::Message: Sync,
<T as Types>::MixedParts: Sync,
<T as Types>::Indexes: Sync,
<T as Types>::Queue: Sync,
<<T as Types>::Chooser as Types>::Indexes: Sync,
<<T as Types>::Chooser as Types>::Shuffled: Sync,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Aliases: Sync,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Probs: Sync,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Weights: Sync,
<<<T as Types>::Chooser as Types>::Sampler as Types>::S: Sync,
<<<T as Types>::Chooser as Types>::Sampler as Types>::L: Sync,
impl<T> Unpin for BaseDecoder<T>where
<T as Types>::Message: Unpin,
<T as Types>::MixedParts: Unpin,
<T as Types>::Indexes: Unpin,
<T as Types>::Queue: Unpin,
<<T as Types>::Chooser as Types>::Indexes: Unpin,
<<T as Types>::Chooser as Types>::Shuffled: Unpin,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Aliases: Unpin,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Probs: Unpin,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Weights: Unpin,
<<<T as Types>::Chooser as Types>::Sampler as Types>::S: Unpin,
<<<T as Types>::Chooser as Types>::Sampler as Types>::L: Unpin,
impl<T> UnwindSafe for BaseDecoder<T>where
<T as Types>::Message: UnwindSafe,
<T as Types>::MixedParts: UnwindSafe,
<T as Types>::Indexes: UnwindSafe,
<T as Types>::Queue: UnwindSafe,
<<T as Types>::Chooser as Types>::Indexes: UnwindSafe,
<<T as Types>::Chooser as Types>::Shuffled: UnwindSafe,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Aliases: UnwindSafe,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Probs: UnwindSafe,
<<<T as Types>::Chooser as Types>::Sampler as Types>::Weights: UnwindSafe,
<<<T as Types>::Chooser as Types>::Sampler as Types>::S: UnwindSafe,
<<<T as Types>::Chooser as Types>::Sampler as Types>::L: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more