Skip to main content

decode_substring_from_bytes

Function decode_substring_from_bytes 

Source
pub fn decode_substring_from_bytes(
    encoded_bytes: &[u8],
    start: usize,
    end: usize,
    alphabet: &Alphabet,
) -> Vec<u8> 
Expand description

Decodes a substring from a bit-packed encoded sequence.

Decodes a substring from a bit-packed sequence of bytes. Decodes via the decoding array, which maps encoded values back to original symbols.

§Arguments

  • encoded_bytes - A slice of bytes containing the bit-packed encoded sequence.
  • start - The start index of the substring (inclusive), in terms of symbols.
  • end - The end index of the substring (exclusive), in terms of symbols.
  • bits_per_symbol - The number of bits used to represent each symbol in the sequence.
  • decoding_array - A lookup table that maps encoded values back to their original symbols.

§Returns

A Vec<u8> containing the decoded substring.