Struct foundation_ur::BaseDecoder
source · pub struct BaseDecoder<T: Types> { /* private fields */ }
Expand description
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, const MAX_UR_TYPE: usize> BaseDecoder<Heapless<MAX_MESSAGE_LEN, MAX_MIXED_PARTS, MAX_FRAGMENT_LEN, MAX_SEQUENCE_COUNT, QUEUE_SIZE, MAX_UR_TYPE>>
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, const MAX_UR_TYPE: usize> BaseDecoder<Heapless<MAX_MESSAGE_LEN, MAX_MIXED_PARTS, MAX_FRAGMENT_LEN, MAX_SEQUENCE_COUNT, QUEUE_SIZE, MAX_UR_TYPE>>
sourcepub const fn new() -> Self
pub const fn new() -> Self
Construct a new HeaplessDecoder
.
source§impl<T: Types> BaseDecoder<T>
impl<T: Types> BaseDecoder<T>
sourcepub fn receive<'a>(&mut self, ur: UR<'_>) -> Result<(), Error>
pub fn receive<'a>(&mut self, ur: UR<'_>) -> Result<(), Error>
Receives a URI representing a CBOR and bytewords
-encoded fountain part
into the decoder.
§Examples
See the crate
module documentation for examples.
§Errors
This function may error along all the necessary decoding steps:
- The string may not be a well-formed URI according to the uniform resource scheme
- The URI payload may not be a well-formed
bytewords
string - The decoded byte payload may not be valid CBOR
- The CBOR-encoded fountain part may be inconsistent with previously received ones
In all these cases, an error will be returned.
sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
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>::Fragment: Freeze,
<T as Types>::URType: Freeze,
<<T as Types>::Decoder as Types>::Message: Freeze,
<<T as Types>::Decoder as Types>::MixedParts: Freeze,
<<T as Types>::Decoder as Types>::Indexes: Freeze,
<<T as Types>::Decoder as Types>::Queue: Freeze,
<<<T as Types>::Decoder as Types>::Chooser as Types>::Indexes: Freeze,
<<<T as Types>::Decoder as Types>::Chooser as Types>::Shuffled: Freeze,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Aliases: Freeze,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Probs: Freeze,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Weights: Freeze,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::S: Freeze,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::L: Freeze,
impl<T> RefUnwindSafe for BaseDecoder<T>where
<T as Types>::Fragment: RefUnwindSafe,
<T as Types>::URType: RefUnwindSafe,
<<T as Types>::Decoder as Types>::Message: RefUnwindSafe,
<<T as Types>::Decoder as Types>::MixedParts: RefUnwindSafe,
<<T as Types>::Decoder as Types>::Indexes: RefUnwindSafe,
<<T as Types>::Decoder as Types>::Queue: RefUnwindSafe,
<<<T as Types>::Decoder as Types>::Chooser as Types>::Indexes: RefUnwindSafe,
<<<T as Types>::Decoder as Types>::Chooser as Types>::Shuffled: RefUnwindSafe,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Aliases: RefUnwindSafe,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Probs: RefUnwindSafe,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Weights: RefUnwindSafe,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::S: RefUnwindSafe,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::L: RefUnwindSafe,
impl<T> Send for BaseDecoder<T>where
<T as Types>::Fragment: Send,
<T as Types>::URType: Send,
<<T as Types>::Decoder as Types>::Message: Send,
<<T as Types>::Decoder as Types>::MixedParts: Send,
<<T as Types>::Decoder as Types>::Indexes: Send,
<<T as Types>::Decoder as Types>::Queue: Send,
<<<T as Types>::Decoder as Types>::Chooser as Types>::Indexes: Send,
<<<T as Types>::Decoder as Types>::Chooser as Types>::Shuffled: Send,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Aliases: Send,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Probs: Send,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Weights: Send,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::S: Send,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::L: Send,
impl<T> Sync for BaseDecoder<T>where
<T as Types>::Fragment: Sync,
<T as Types>::URType: Sync,
<<T as Types>::Decoder as Types>::Message: Sync,
<<T as Types>::Decoder as Types>::MixedParts: Sync,
<<T as Types>::Decoder as Types>::Indexes: Sync,
<<T as Types>::Decoder as Types>::Queue: Sync,
<<<T as Types>::Decoder as Types>::Chooser as Types>::Indexes: Sync,
<<<T as Types>::Decoder as Types>::Chooser as Types>::Shuffled: Sync,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Aliases: Sync,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Probs: Sync,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Weights: Sync,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::S: Sync,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::L: Sync,
impl<T> Unpin for BaseDecoder<T>where
<T as Types>::Fragment: Unpin,
<T as Types>::URType: Unpin,
<<T as Types>::Decoder as Types>::Message: Unpin,
<<T as Types>::Decoder as Types>::MixedParts: Unpin,
<<T as Types>::Decoder as Types>::Indexes: Unpin,
<<T as Types>::Decoder as Types>::Queue: Unpin,
<<<T as Types>::Decoder as Types>::Chooser as Types>::Indexes: Unpin,
<<<T as Types>::Decoder as Types>::Chooser as Types>::Shuffled: Unpin,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Aliases: Unpin,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Probs: Unpin,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Weights: Unpin,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::S: Unpin,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::L: Unpin,
impl<T> UnwindSafe for BaseDecoder<T>where
<T as Types>::Fragment: UnwindSafe,
<T as Types>::URType: UnwindSafe,
<<T as Types>::Decoder as Types>::Message: UnwindSafe,
<<T as Types>::Decoder as Types>::MixedParts: UnwindSafe,
<<T as Types>::Decoder as Types>::Indexes: UnwindSafe,
<<T as Types>::Decoder as Types>::Queue: UnwindSafe,
<<<T as Types>::Decoder as Types>::Chooser as Types>::Indexes: UnwindSafe,
<<<T as Types>::Decoder as Types>::Chooser as Types>::Shuffled: UnwindSafe,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Aliases: UnwindSafe,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Probs: UnwindSafe,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::Weights: UnwindSafe,
<<<<T as Types>::Decoder as Types>::Chooser as Types>::Sampler as Types>::S: UnwindSafe,
<<<<T as Types>::Decoder 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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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