Skip to main content

Crate rune_morse

Crate rune_morse 

Source
Expand description

Morse code encoder and decoder — ASCII text to dots and dashes and back.

Converts between ASCII text and International Morse Code. Letters are separated by a single space; words are separated by /. Both uppercase and lowercase input are accepted during encoding. The library has zero dependencies and works entirely in safe, pure Rust.

§Features

  • encode — convert ASCII text to Morse code.
  • decode — convert Morse code back to ASCII text.
  • MorseError — error type for unknown characters or unrecognised sequences.

§Quick Start

use rune_morse::{encode, decode};

let morse = encode("SOS").unwrap();
assert_eq!(morse, "... --- ...");

let text = decode("... --- ...").unwrap();
assert_eq!(text, "SOS");

§CLI

rune-morse encode "Hello World"
rune-morse decode ".... . .-.. .-.. --- / .-- --- .-. .-.. -.."

Enums§

MorseError
Error returned when encoding or decoding encounters unexpected input.

Functions§

decode
Decodes Morse code back to uppercase ASCII text.
encode
Encodes ASCII text as Morse code.