pub struct Encoder { /* private fields */ }
Expand description
Reed-Solomon BCH encoder
Implementations§
Source§impl Encoder
impl Encoder
Sourcepub fn new(ecc_len: usize) -> Self
pub fn new(ecc_len: usize) -> Self
Constructs a new Encoder
and calculates generator polynomial of given ecc_len
.
§Example
use reed_solomon::Encoder;
let encoder = Encoder::new(8);
Sourcepub fn encode(&self, data: &[u8]) -> Buffer
pub fn encode(&self, data: &[u8]) -> Buffer
Encodes passed &[u8]
slice and returns Buffer
with result and ecc
offset.
§Example
use reed_solomon::Encoder;
let data = "Hello World".as_bytes();
let encoder = Encoder::new(8);
let encoded = encoder.encode(&data);
println!("whole: {:?}", &encoded[..]);
println!("data: {:?}", encoded.data());
println!("ecc: {:?}", encoded.ecc());
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Encoder
impl RefUnwindSafe for Encoder
impl Send for Encoder
impl Sync for Encoder
impl Unpin for Encoder
impl UnwindSafe for Encoder
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