mors 0.1.1

A crate for converting morsecode to text and reverse
Documentation

Mors

A simple crate, that translates from morse code to letters and back.

Structure

Internal, the morse code is using a tree structure, that allows a fast lookup for the decoding of morse code to letters. For the encoding, the encoder, is using a Set, and a type of DFS(Depth First Search), that inserts the seen nodes into the set and is then iterating over the given set in order to find the given letter, that is to be encoded.

Usage

use mors::encoder;

let morse_encoder = encoder::Encoder::new();
let message = String::from("ET");
println!("{}",morse_encoder.encode_letters(message)) ==> ". -"




use mors::decoder;
let decoder = decoder::Decoder::new();
let message = String::from(". -");
println!("{}",decoder.decode_message(message)) ==> "ET"

Morse-Table

All codes that are inside the morse table can be found in the "codec.rs" file.

A => .-
B => -...
C => -.-.
D => -..
E => .
F => ..-.
G => --.
H => ....
I => ..
J => .---
K => -.-
L => .-..
M => --
N => -.
O => ---
P => .--.
Q => --.-
R => .-.
S => ...
T => -
U => ..-
V => ...-
W => .--
X => -..-
Y => -.--
Z => --..
CH => ----
0 => -----
1 => .----
2 => ..---
3 => ...--
4 => ....-
5 => .....
6 => -....
7 => --...
8 => ---..
9 => ----.
. => .-.-.-
, => --..--
? => ..--..
! => ..--.
: => ---...
" => .-..-.
' => .----.
= => -...-

Development

This is just a little side crate I created, because I wanted to implement a tree structure in rust. If you find bugs please open an issue

I will try to make the encoding and the decoding a bit faster and clean up the code, but for now, it is just working as I intended to. If you have any suggestions to expand the crate, please open an issue or contact my via github or gitter.

Licence

MIT License

Copyright (c) 2019 Nick Anthony Flückiger

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.