morse_lib/lib.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
//! # Morse Library
//!
//! Morse Library is a library parsing text and binary data
//! to Morse Code and vice versa.
//!
//! Morse Library support International rules and codes for Morse
//! Code, but if needed it support custom language(s) to convert any language-specific
//! Morse Code implementations. The library provides **Lines**, **Dots** and **Whitespace**
//! aliasing. That means output Morse Code could be not only lines, dots and whitespaces,
//! but also any UTF-8 emoji or even text! Also the library support playing Morse Code by sound
//! if needed, and customization of speed, frequency of playing.
//!
//! ## Extend multimultilingualism
//!
//! To provide custom language conversion the library has struct MorseCustom. The constructor accept two functions:
//! - first that match conversion from character to Morse Code
//! - second that match conversion from Morse Code to Character
//!
//! ## Features
//! * international (default)
//! * custom
//! * audio
//!
//! ## Data formats
//!
//! The following is a list of data formats that have been implemented
//! for Morse Library.
//!
//! ### Input
//!
//! - [String], the casual String or &str that contains text
//! - [Binary String], the casual String or &str that contains Morse Code represented by byte code.
//!
//! ### Output
//!
//! - [String], the casual String that contains Morse Code. By default **lines** and **dots**, but could be
//! any UTF-8 character or even string
//! - [Binary String], the casual String that contains Morse Code represented by byte code.
//! - [Sound], sound representation of Morse Code
//!
//! ## Use
//!
//! This is some examples as a dependency in Cargo.toml of enabling/disabling features in library:
//! ```toml
//! // for international Morse code, no audio:
//! morse-lib = "0.4.1"
//! // for all features:
//! morse-lib = { version = "0.4.1", features = ["custom", "audio"] }
//! // for custom Morse code only:
//! morse-lib = { version = "0.4.1", default-features = false, features = ["custom"] }
//! // for custom Morse code only and audio features:
//! morse-lib = { version = "0.4.1", default-features = false, features = ["custom", "audio"] }
//! ```
// Private modules
mod morse_char;
use morse_char::*;
mod morse_processors;
use morse_processors::*;
mod display_chars;
use display_chars::DisplayChars;
#[cfg(feature = "audio")]
mod sound;
#[cfg(feature = "audio")]
pub use sound::Sound;
// Public modules
mod morse_unit;
pub use morse_unit::MorseUnit;
mod error;
pub use error::*;
mod morse;
#[cfg(feature = "international")]
pub use morse::Morse;
#[cfg(feature = "custom")]
pub use morse::MorseCustom;
pub use morse::TMorse;