pub struct Message<const MSG_MAX: usize> { /* private fields */ }Implementations§
source§impl<const MSG_MAX: usize> Message<MSG_MAX>
impl<const MSG_MAX: usize> Message<MSG_MAX>
sourcepub fn iter(&self) -> MessageIterator<'_, MSG_MAX> ⓘ
pub fn iter(&self) -> MessageIterator<'_, MSG_MAX> ⓘ
Get an iterator to the message text contained within.
sourcepub fn set_edit_pos(&mut self, pos: usize)
pub fn set_edit_pos(&mut self, pos: usize)
Sets current editing position to given value.
sourcepub fn get_edit_pos(&self) -> usize
pub fn get_edit_pos(&self) -> usize
Returns current editing position.
sourcepub fn shift_edit_left(&mut self)
pub fn shift_edit_left(&mut self)
Move editing position to the left.
sourcepub fn shift_edit_right(&mut self)
pub fn shift_edit_right(&mut self)
Move editing position to the right.
sourcepub fn add_char(&mut self, ch: u8)
pub fn add_char(&mut self, ch: u8)
Insert character at the editing position.
If any characters before the character are FILLER_BYTEs They’ll automatically be converted to empty characters ’ ’ which means the user wants some space between words.
sourcepub fn put_char_at(&mut self, index: usize, ch: u8)
pub fn put_char_at(&mut self, index: usize, ch: u8)
Insert character at index.
If any characters before the character are FILLER_BYTEs They’ll automatically be converted to empty characters ’ ’ which means the user wants some space between words.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns current length of the message discarding empty FILLER_BYTE characters at the end.
This is useful for creating ranged loops of actual characters decoded or can be encoded.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the message is empty, false otherwise.
This method discards FILLER_BYTE characters and only takes into account normal characters.
sourcepub fn set_message(
&mut self,
message_str: &str,
edit_pos_end: bool,
) -> Result<(), &str>
pub fn set_message( &mut self, message_str: &str, edit_pos_end: bool, ) -> Result<(), &str>
Manually set the message from an &str.
edit_pos_end flag means we’ll continue from the end of this string when we continue decoding or encoding.
sourcepub fn as_bytes(&self) -> [u8; MSG_MAX]
pub fn as_bytes(&self) -> [u8; MSG_MAX]
Returns the message as it is now in a byte array format.
Note that this also includes ‘empty’ FILLER_BYTE characters. Client code can use return value of len() which is the actual length to loop through it or filter the fillers manually in a loop or iterator.
sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the message as it is now as &str slice.
Note that this does not include empty FILLER_BYTE characters.