decode

Function decode 

Source
pub fn decode(bytes: &[u8], len: usize) -> Result<String, Error>
Expand description

This function converts a slice of SIXBIT-encoded bytes into the original string based on the provided length.

§Parameters

  • bytes: A slice of bytes containing SIXBIT-encoded data.
  • len: The length of the original string.

§Errors

Returns an Error::InvalidBytesLength if bytes.len() and len are inconsistent.

§Examples

use dec_sixbit::{encode, decode};

let input = "HELLO";
let (encoded_bytes, length) = encode(input).unwrap();
let decoded_string = decode(&encoded_bytes, length).unwrap();
assert_eq!(decoded_string, input);