pub struct MorsePattern(/* private fields */);Expand description
MorsePattern is a sequence of maximum 15 taps or holds that can be encoded into an u16: 0x1 when empty, then 0 for tap or 1 for hold shifted from the right
Implementations§
Source§impl MorsePattern
impl MorsePattern
pub fn max_taps() -> usize
Sourcepub fn from_u16(value: u16) -> Self
pub fn from_u16(value: u16) -> Self
Creates a MorsePattern from a raw u16.
§Panics (debug only)
Panics if value is 0, which is not a valid encoding
(the empty pattern is 0b1).
pub fn to_u16(&self) -> u16
pub fn is_empty(&self) -> bool
pub fn is_full(&self) -> bool
pub fn pattern_length(&self) -> usize
Sourcepub fn starts_with(&self, pattern_start: MorsePattern) -> bool
pub fn starts_with(&self, pattern_start: MorsePattern) -> bool
Checks if this pattern starts with the given one
Sourcepub fn last_is_hold(&self) -> bool
pub fn last_is_hold(&self) -> bool
Returns true if the last step in the pattern is a hold.
Returns false for empty patterns.
pub fn followed_by_tap(&self) -> Self
pub fn followed_by_hold(&self) -> Self
Sourcepub fn is_all_taps(&self) -> bool
pub fn is_all_taps(&self) -> bool
true when the pattern consists only of tap steps (no holds).
Returns false for the empty pattern (encoding 0b1).
Trait Implementations§
Source§impl Clone for MorsePattern
impl Clone for MorsePattern
Source§fn clone(&self) -> MorsePattern
fn clone(&self) -> MorsePattern
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for MorsePattern
Source§impl Debug for MorsePattern
impl Debug for MorsePattern
Source§impl Default for MorsePattern
impl Default for MorsePattern
Source§impl<'de> Deserialize<'de> for MorsePattern
impl<'de> Deserialize<'de> for MorsePattern
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for MorsePattern
Source§impl MaxSize for MorsePattern
impl MaxSize for MorsePattern
Source§const POSTCARD_MAX_SIZE: usize
const POSTCARD_MAX_SIZE: usize
The maximum possible size that the serialization of this
type can have, in bytes.
Source§impl PartialEq for MorsePattern
impl PartialEq for MorsePattern
Source§impl Serialize for MorsePattern
impl Serialize for MorsePattern
impl StructuralPartialEq for MorsePattern
Auto Trait Implementations§
impl Freeze for MorsePattern
impl RefUnwindSafe for MorsePattern
impl Send for MorsePattern
impl Sync for MorsePattern
impl Unpin for MorsePattern
impl UnsafeUnpin for MorsePattern
impl UnwindSafe for MorsePattern
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more