pub struct MessageEditorState { /* private fields */ }Expand description
State for the message editor component
Implementations§
Source§impl MessageEditorState
impl MessageEditorState
Sourcepub fn set_messages(&mut self, messages: Vec<GeneratedMessage>)
pub fn set_messages(&mut self, messages: Vec<GeneratedMessage>)
Set generated messages (replaces all existing)
Sourcepub fn add_messages(&mut self, messages: Vec<GeneratedMessage>) -> usize
pub fn add_messages(&mut self, messages: Vec<GeneratedMessage>) -> usize
Add messages to existing list (preserves history) Returns the index of the first new message
Sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Get current message count
Sourcepub fn selected_index(&self) -> usize
pub fn selected_index(&self) -> usize
Get currently selected index
Sourcepub fn next_message(&mut self)
pub fn next_message(&mut self)
Select next message
Sourcepub fn prev_message(&mut self)
pub fn prev_message(&mut self)
Select previous message
Sourcepub fn enter_edit_mode(&mut self)
pub fn enter_edit_mode(&mut self)
Enter edit mode
Sourcepub fn exit_edit_mode(&mut self)
pub fn exit_edit_mode(&mut self)
Exit edit mode
Sourcepub fn is_editing(&self) -> bool
pub fn is_editing(&self) -> bool
Is in edit mode?
Sourcepub fn get_message(&self) -> String
pub fn get_message(&self) -> String
Get current message text
Sourcepub fn current_generated(&self) -> Option<&GeneratedMessage>
pub fn current_generated(&self) -> Option<&GeneratedMessage>
Get the current generated message (if any)
Sourcepub fn handle_key(&mut self, key: KeyEvent) -> bool
pub fn handle_key(&mut self, key: KeyEvent) -> bool
Handle key input (when in edit mode)
Sourcepub fn is_modified(&self) -> bool
pub fn is_modified(&self) -> bool
Check if message was modified
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MessageEditorState
impl RefUnwindSafe for MessageEditorState
impl Send for MessageEditorState
impl Sync for MessageEditorState
impl Unpin for MessageEditorState
impl UnwindSafe for MessageEditorState
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more