dec_sixbit

Function encode

Source
pub fn encode(str: &str) -> Result<(Vec<u8>, usize), Error>
Expand description

This function converts the input string into a compact SIXBIT-encoded byte vector and returns the encoded bytes along with the original string length.

§Constraints

  • Only ASCII characters in the range 32-95 (space through underscore) are allowed.

§Errors

Returns an Error::InvalidCharacter if the input contains characters outside the valid range.

§Examples

use dec_sixbit::encode;

let input = "HELLO";
let (encoded_bytes, length) = encode(input).unwrap();