pub struct SourceBlockEncoder { /* private fields */ }Expand description
A struct that represents a source block encoder that uses Raptor codes.
Implementations§
Source§impl SourceBlockEncoder
impl SourceBlockEncoder
Sourcepub fn new(
source_block: &[u8],
max_source_symbols: usize,
) -> Result<Self, &'static str>
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).
Sourcepub fn nb_source_symbols(&self) -> u32
pub fn nb_source_symbols(&self) -> u32
Return the number of source symbols (k) inside the block
Sourcepub fn fountain(&mut self, esi: u32) -> Vec<u8> ⓘ
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§
impl Freeze for SourceBlockEncoder
impl RefUnwindSafe for SourceBlockEncoder
impl Send for SourceBlockEncoder
impl Sync for SourceBlockEncoder
impl Unpin for SourceBlockEncoder
impl UnwindSafe for SourceBlockEncoder
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