Trait EncodeInto

Source
pub trait EncodeInto {
    // Required methods
    fn encode_parity(code: &LDPCCode, data: &[Self], parity: &mut [Self])
       where Self: Sized;
    fn encode<'a>(code: &LDPCCode, codeword: &'a mut [Self]) -> &'a mut [u8]
       where Self: Sized;
    fn copy_encode<'a>(
        code: &LDPCCode,
        data: &[u8],
        codeword: &'a mut [Self],
    ) -> &'a mut [u8]
       where Self: Sized;
    fn bitlength() -> usize;
}
Expand description

Trait for the types of codeword we can encode into.

We implement this for u8 (the standard but slow option), and u32 and u64 which give speedups.

Required Methods§

Source

fn encode_parity(code: &LDPCCode, data: &[Self], parity: &mut [Self])
where Self: Sized,

Given data which has k bits of data to transmit, encodes the parity and stores it in the parity buffer.

Source

fn encode<'a>(code: &LDPCCode, codeword: &'a mut [Self]) -> &'a mut [u8]
where Self: Sized,

Given codeword which has the first k bits set to the data to transmit, sets the remaining n-k parity bits.

Returns a &mut [u8] view on codeword.

Source

fn copy_encode<'a>( code: &LDPCCode, data: &[u8], codeword: &'a mut [Self], ) -> &'a mut [u8]
where Self: Sized,

First copies data into the first k bits of codeword, then calls encode.

Source

fn bitlength() -> usize

Returns the bit length for this type

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl EncodeInto for u8

Source§

fn encode_parity(code: &LDPCCode, data: &[Self], parity: &mut [Self])

Source§

fn encode<'a>(code: &LDPCCode, codeword: &'a mut [Self]) -> &'a mut [u8]

Source§

fn copy_encode<'a>( code: &LDPCCode, data: &[u8], codeword: &'a mut [Self], ) -> &'a mut [u8]

Source§

fn bitlength() -> usize

Source§

impl EncodeInto for u32

Source§

fn encode_parity(code: &LDPCCode, data: &[Self], parity: &mut [Self])

Source§

fn encode<'a>(code: &LDPCCode, codeword: &'a mut [Self]) -> &'a mut [u8]

Source§

fn copy_encode<'a>( code: &LDPCCode, data: &[u8], codeword: &'a mut [Self], ) -> &'a mut [u8]

Source§

fn bitlength() -> usize

Source§

impl EncodeInto for u64

Source§

fn encode_parity(code: &LDPCCode, data: &[Self], parity: &mut [Self])

Source§

fn encode<'a>(code: &LDPCCode, codeword: &'a mut [Self]) -> &'a mut [u8]

Source§

fn copy_encode<'a>( code: &LDPCCode, data: &[u8], codeword: &'a mut [Self], ) -> &'a mut [u8]

Source§

fn bitlength() -> usize

Implementors§