symcode/interfaces/
decoder.rs

1use bit_vec::BitVec;
2
3type DecodedData = BitVec;
4
5/// To decode an array of symbols into bit string
6pub trait Decoder {
7
8    type Symbol;
9
10    type Err;
11
12    /// Attempt to decode the data. If no errors, return a bit string
13    fn decode(&self, encoded_data: Vec<Self::Symbol>) -> Result<DecodedData, Self::Err>;
14
15    /// How many bits one symbol encodes
16    fn num_bits_per_symbol(&self) -> usize;
17}