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§
Sourcefn encode_parity(code: &LDPCCode, data: &[Self], parity: &mut [Self])where
Self: Sized,
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.
Sourcefn encode<'a>(code: &LDPCCode, codeword: &'a mut [Self]) -> &'a mut [u8]where
Self: Sized,
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
.
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.