pub struct FecCode { /* private fields */ }Expand description
Reed-Solomon FEC code used by WFB blocks.
Implementations§
Source§impl FecCode
impl FecCode
Sourcepub fn new(k: usize, n: usize) -> Result<Self, FecError>
pub fn new(k: usize, n: usize) -> Result<Self, FecError>
Create an FEC code with k primary fragments and n-k parity fragments.
Sourcepub fn encode(
&self,
primary: &[Vec<u8>],
block_size: usize,
) -> Result<Vec<Vec<u8>>, FecError>
pub fn encode( &self, primary: &[Vec<u8>], block_size: usize, ) -> Result<Vec<Vec<u8>>, FecError>
Generate parity fragments for a full primary block.
Sourcepub fn recover_primary(
&self,
fragments: &mut [Option<Vec<u8>>],
block_size: usize,
) -> Result<usize, FecError>
pub fn recover_primary( &self, fragments: &mut [Option<Vec<u8>>], block_size: usize, ) -> Result<usize, FecError>
Recover missing primary fragments in-place.
Sourcepub fn recover_primary_into(
&self,
fragments: &mut [u8],
present: &mut [bool],
block_size: usize,
) -> Result<usize, FecError>
pub fn recover_primary_into( &self, fragments: &mut [u8], present: &mut [bool], block_size: usize, ) -> Result<usize, FecError>
Recover missing primary fragments into caller-owned reusable buffers.
present identifies received fragments. fragments contains exactly
n * block_size contiguous bytes in fragment-index order. This avoids
allocating recovered fragments in the packet-processing hot path.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FecCode
impl RefUnwindSafe for FecCode
impl Send for FecCode
impl Sync for FecCode
impl Unpin for FecCode
impl UnsafeUnpin for FecCode
impl UnwindSafe for FecCode
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