Crates.io | morsify |
lib.rs | morsify |
version | 0.1.0 |
source | src |
created_at | 2024-09-04 16:09:23.971199 |
updated_at | 2024-09-04 16:09:23.971199 |
description | Easily convert text to Morse code and vice versa. |
homepage | |
repository | https://github.com/martial-plains/morsify |
max_upload_size | |
id | 1363493 |
size | 50,429 |
Morsify is a Rust crate designed for encoding and decoding Morse code. It provides a flexible and efficient way to convert text to Morse code and vice versa, with customizable options for different Morse code representations and character sets.
To use Morsify, add it to your Cargo.toml
:
[dependencies]
morsify = "0.1.0"
Then, use the MorseCode
struct to encode and decode text. Here’s a basic example:
use morsify::{MorseCode, Options, MorseCharacterSet};
// Create a new `MorseCode` instance with default options
let options = Options {
dash: '-',
dot: '.',
space: '/',
separator: ' ',
invalid_char_callback: |c| c,
priority: MorseCharacterSet::Latin,
};
let morse_code = MorseCode::new(options);
// Encode a text message to Morse code
let encoded = morse_code.encode("Hello World");
println!("Encoded: {}", encoded);
// Decode a Morse code message to text
let decoded = morse_code.decode(".... . .-.. .-.. --- / .-- --- .-. .-.. -..");
println!("Decoded: {}", decoded);
For detailed information about the API, refer to the module documentation and individual methods of the MorseCode
struct.
Morsify is licensed under the MIT License. See the LICENSE
file for more details.
For more information about each character set, you can refer to the following links: