Function morse::encode::encode
[−]
[src]
pub fn encode<S: Into<String>>(input: S) -> Result<String, TranslationError>
Encodes an ascii string into a morse code representation
Examples
use morse::encode; assert_eq!(encode::encode("sos").unwrap(), "... ___ ...");
Errors
Encoding will error with a morse::TranslationError
when an unsupported character is being encoded.
The error structure contains a Vec<String> unsupported_characters
to show what characters failed.
Note: The input will still complete parsing.