pub struct MorseEncoder<const MSG_MAX: usize> {
pub message: Message<MSG_MAX>,
/* private fields */
}
Fields§
§message: Message<MSG_MAX>
Implementations§
Source§impl<const MSG_MAX: usize> MorseEncoder<MSG_MAX>
impl<const MSG_MAX: usize> MorseEncoder<MSG_MAX>
Sourcepub fn encode_character(&mut self, ch: &Character) -> Result<(), &str>
pub fn encode_character(&mut self, ch: &Character) -> Result<(), &str>
Encode a single character at the edit position and add it both to the message and encoded_message.
Sourcepub fn encode_slice(&mut self, str_slice: &str) -> Result<(), &str>
pub fn encode_slice(&mut self, str_slice: &str) -> Result<(), &str>
Encode a &str slice at the edit position and add it both to the message and encoded message.
Note if the slice exceeds maximum message length it will return an error. Non-ASCII characters will be ignored.
Sourcepub fn encode_message_all(&mut self)
pub fn encode_message_all(&mut self)
Encode the entire message from start to finish and save it to encoded_message.
Sourcepub fn get_last_char_as_morse_charray(&self) -> Option<MorseCharray>
pub fn get_last_char_as_morse_charray(&self) -> Option<MorseCharray>
Get last encoded message character as Option<Character>
arrays of morse code.
Arrays will have a fixed length of MORSE_ARRAY_LENGTH
and if there’s no
signal the option will be None.
Sourcepub fn get_last_char_as_sdm(&self) -> Option<SDMArray>
pub fn get_last_char_as_sdm(&self) -> Option<SDMArray>
Get last encoded message character as Option<SDM>
arrays of morse code.
The multiplier values then can be used to calculate durations of individual
signals to play or animate the morse code.
It’ll be great to filter-out Empty
values of SDM arrays.
Sourcepub fn get_encoded_message_as_morse_charrays(
&self,
) -> impl Iterator<Item = Option<MorseCharray>> + '_
pub fn get_encoded_message_as_morse_charrays( &self, ) -> impl Iterator<Item = Option<MorseCharray>> + '_
Get an iterator to encoded message as Option<Character>
arrays of morse code.
Arrays will have a fixed length of MORSE_ARRAY_LENGTH
and if there’s no
signal the option will be None
. So it will be good to filter them out.
Sourcepub fn get_encoded_message_as_sdm_arrays(
&self,
) -> impl Iterator<Item = Option<SDMArray>> + '_
pub fn get_encoded_message_as_sdm_arrays( &self, ) -> impl Iterator<Item = Option<SDMArray>> + '_
Get an iterator to entire encoded message as Option<SDM>
arrays of morse code.
The multiplier values then can be used to calculate durations of individual
signals to play or animate the morse code.
It’ll be good to filter Empty
values that might fill the arrays at the end.