pub struct Decoder<const MSG_MAX: usize> { /* private fields */ }Expand description
This is the builder, or public interface of the decoder using builder pattern. It builds a MorseDecoder which is the concrete implementation and returns it with build(). For details on how to use the decoder, refer to MorseDecoder documentation.
Implementations§
source§impl<const MSG_MAX: usize> Decoder<MSG_MAX>
impl<const MSG_MAX: usize> Decoder<MSG_MAX>
pub fn new() -> Self
sourcepub fn with_message(self, message_str: &str, edit_pos_end: bool) -> Self
pub fn with_message(self, message_str: &str, edit_pos_end: bool) -> Self
Build decoder with a starting message.
edit_pos_end means we’ll continue decoding from the end of this string. If you pass false to it, we’ll start from the beginning.
sourcepub fn with_edit_position(self, pos: usize) -> Self
pub fn with_edit_position(self, pos: usize) -> Self
Build decoder with an arbitrary editing start position.
Maybe client code saved the previous editing position to an EEPROM, harddisk, local storage in web and wants to continue from that.
sourcepub fn with_precision(self, precision: Precision) -> Self
pub fn with_precision(self, precision: Precision) -> Self
Set decoder precision.
Precision::Lazy is more human friendly, Precision::Accurate is for learning or a challenge contest.
sourcepub fn with_character_set(self, character_set: CharacterSet) -> Self
pub fn with_character_set(self, character_set: CharacterSet) -> Self
Use a different character set than default english alphabet.
This can be helpful to create a message with trivial encryption. Letters can be shuffled for example. This kind of encryption can easily be broken with powerful algorithms and AI. DON’T use it for secure communication.
sourcepub fn with_signal_tolerance(self, signal_tolerance: f32) -> Self
pub fn with_signal_tolerance(self, signal_tolerance: f32) -> Self
Use a different signal tolerance range factor than the default 0.5.
Tolerance factors higher than 0.5 tend to overlap and result in wrong decoding. You can lower this value though for stricter morse signalling. In any case the value will be clamped between 0.0 and 1.0 so values higher than 1.0 will be 1.0.
sourcepub fn with_reference_short_ms(self, reference_short_ms: u16) -> Self
pub fn with_reference_short_ms(self, reference_short_ms: u16) -> Self
Change initial reference short signal duration from 0 to some other value.
This value will determine the reference durations of signal types (short, long or very long). The value will be multiplied by LONG_SIGNAL_MULTIPLIER (x3) and WORD_SPACE_MULTIPLIER (x7) to determine long signals and very long word separator signals. Default value of 0 means MorseDecoder will try to calculate the reference short duration from incoming signals. This might not work well if the message starts with a ‘T’.
sourcepub fn build(self) -> MorseDecoder<MSG_MAX>
pub fn build(self) -> MorseDecoder<MSG_MAX>
Build and get yourself a shiny new MorseDecoder.
The ring is yours now…