str_to_morse

Function str_to_morse 

Source
pub fn str_to_morse(input: &str) -> Result<(u128, u16), MorseError>
Expand description

String to morse sequence of states

§Arguments

  • input - String to be translated to morse

§Returns

A result with Ok(tuple) as

  • u128 - a sequence of output states encoded into bits of a u128
  • u16 - length of the sequence of output states

or Err(MorseError)

§Example

use on_off_sequence_output::morse::*;

let (sequence, len) = str_to_morse("SOS").unwrap();
assert_eq!(0b_00_01_01_01_00_0111_0111_0111_00_01_01_01_u128, sequence);
assert_eq!(30_u16, len);