Crate ripmors

Crate ripmors 

Source
Expand description

§ripmors

ripmors is a Rust library for encoding and decoding international Morse code and several variants.

It is fast:

  • Encoding ASCII text to Morse code: 1.5 GiB/s
  • Encoding Unicode text to Morse code: 730 MiB/s
  • Decoding Morse code: 570 MiB/s
$ echo 'Hello, World!' | ripmors
.... . .-.. .-.. --- --..-- / .-- --- .-. .-.. -.. ..--.
$ echo '-- --- .-. ... . / -.-. --- -.. .' | ripmors -d
MORSE CODE

§Usage

Or, in Rust:

use ripmors::{decode_string, encode_string, to_standard};

assert_eq!(encode_string("Hello, World!"), ".... . .-.. .-.. --- --..-- / .-- --- .-. .-.. -.. ..--.");
assert_eq!(decode_string(b"-- --- .-. ... . / -.-. --- -.. .", to_standard), "MORSE CODE");

In addition to the standard International Morse Code and its Latin extensions, the following variants are supported:

  • Greek
  • Russian (Cyrillic)
  • Japanese (Hiragana, Katakana)
  • Korean (Hangul)
  • Hebrew
  • Arabic
$ echo 'モールスふごう' | ripmors
-..-. .--.- -.--. ---.- --.. ---- .. ..-
$ echo '-..-. .--.- -.--. ---.- --.. ---- .. ..-' | ripmors -d japanese
モールスフコ゛ウ

Or, in Rust:

use ripmors::{decode_string, encode_string, to_japanese};

assert_eq!(encode_string("モールスふごう"), "-..-. .--.- -.--. ---.- --.. ---- .. ..-");
assert_eq!(decode_string(b"-..-. .--.- -.--. ---.- --.. ---- .. ..-", to_japanese), "モールスフコ゛ウ");

§Feature Flags

There is a single feature flag, clap. It is only used for the binary. It only exists to reduce the dependencies of the libraries without splitting the crate.

Functions§

decode_stream
Decode Morse code from a Read object into a Write object.
decode_string
Decode Morse code from a byte slice into into a String.
encode_stream
Encode Unicode characters from a Read object into a Write object.
encode_stream_ascii
Encode ASCII characters from a Read object into a Write object.
encode_string
Encode characters from a string slice into a String.
encode_string_ascii
Encode ASCII characters from a byte slice into a String.
to_arabic
Mapping from Morse code to Arabic text
to_greek
Mapping from Morse code to Greek text
to_hebrew
Mapping from Morse code to Hebrew text
to_japanese
Mapping from Morse code to Japanese (Katakana) text
to_korean
Mapping from Morse code to Korean (Hangul) text
to_russian
Mapping from Morse code to Russian (Cyrillic) text
to_standard
Mapping from Morse code to Latin text