SourceBlockEncoder

Struct SourceBlockEncoder 

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

A struct that represents a source block encoder that uses Raptor codes.

Implementations§

Source§

impl SourceBlockEncoder

Source

pub fn new( source_block: &[u8], max_source_symbols: usize, ) -> Result<Self, &'static str>

Create a source block encoder, passing the list of source symbols

§Parameters
  • source_block: A slice of vectors containing the source symbols.
  • max_source_symbols: Max number of source symbols inside the source block

Returns a Result containing:

  • Ok(SourceBlockEncoder) if the encoder was successfully created.
  • Err(&'static str) if the encoder could not be created (for example, if the partitionning of the source_block results in too few encoding symbols (k < 4), leading to a not fully specified matrix).
Source

pub fn nb_source_symbols(&self) -> u32

Return the number of source symbols (k) inside the block

Source

pub fn fountain(&mut self, esi: u32) -> Vec<u8>

Generates an encoding symbol with the specified Encoding Symbol Identifier (ESI).

This method generates a encoding symbol using the Raptor code and the intermediate symbols generated during the initialization of the encoder.

§Parameters
  • esi: The Encoding Symbol Identifier (ESI) of the desired encoding symbol.
§Returns

A tuple containing:

  • Vec<u8> : The generated encoding symbol

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.