morse_codec::encoder

Struct MorseEncoder

source
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>

source

pub fn encode_character(&mut self, ch: &u8) -> Result<(), &str>

Encode a single character at the edit position and add it both to the message and encoded_message.

source

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.

source

pub fn encode_message_all(&mut self)

Encode the entire message and save it to encoded_message.

source

pub fn get_last_char_as_morse_charray(&self) -> Option<MorseCharray>

Get last encoded message character as Option<u8> byte 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.

source

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.

source

pub fn get_encoded_message_as_morse_charrays( &self, ) -> impl Iterator<Item = Option<MorseCharray>> + '_

Get an iterator to encoded message as Option<u8> byte 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.

source

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.

Auto Trait Implementations§

§

impl<const MSG_MAX: usize> Freeze for MorseEncoder<MSG_MAX>

§

impl<const MSG_MAX: usize> RefUnwindSafe for MorseEncoder<MSG_MAX>

§

impl<const MSG_MAX: usize> Send for MorseEncoder<MSG_MAX>

§

impl<const MSG_MAX: usize> Sync for MorseEncoder<MSG_MAX>

§

impl<const MSG_MAX: usize> Unpin for MorseEncoder<MSG_MAX>

§

impl<const MSG_MAX: usize> UnwindSafe for MorseEncoder<MSG_MAX>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.