pub enum AppKeyAction {
}Expand description
Application-level key actions.
These are commands that the App knows how to execute. The KeyHandler doesn’t call methods directly - it returns an Action and the App executes it. This keeps the handler decoupled from App internals.
Note: This enum implements Clone and PartialEq manually due to the
Custom variant containing a trait object. Custom actions are compared
by Arc pointer equality and cloned by Arc reference counting.
Variants§
MoveUp
Move cursor up one line.
MoveDown
Move cursor down one line.
MoveLeft
Move cursor left one character.
MoveRight
Move cursor right one character.
MoveLineStart
Move cursor to the start of the current line.
MoveLineEnd
Move cursor to the end of the current line.
DeleteCharBefore
Delete character before cursor (Backspace).
DeleteCharAt
Delete character at cursor (Delete).
KillLine
Kill text from cursor to end of line.
InsertNewline
Insert a newline character in multi-line input.
InsertChar(char)
Insert a character.
Submit
Submit the current message.
Interrupt
Interrupt the current LLM request.
Quit
Quit the application immediately (force quit, Ctrl+Q).
RequestExit
Request exit - handler manages confirmation, App calls ExitHandler.
ActivateSlashPopup
Activate the slash command popup.
Custom(Arc<dyn Any + Send + Sync>)
Custom action for user-defined behavior.
The handler returns this, and the app receives it via a callback.
Use Arc to allow cheap cloning and type-erased storage.
§Example
// Define your custom action type
struct MyAction { command: String }
// Create a custom action
let action = AppKeyAction::custom(MyAction { command: "foo".into() });
// In your app, downcast to handle it
if let AppKeyAction::Custom(any) = action {
if let Some(my_action) = any.downcast_ref::<MyAction>() {
println!("Command: {}", my_action.command);
}
}Implementations§
Trait Implementations§
Source§impl Clone for AppKeyAction
impl Clone for AppKeyAction
Source§impl Debug for AppKeyAction
impl Debug for AppKeyAction
Source§impl PartialEq for AppKeyAction
impl PartialEq for AppKeyAction
Auto Trait Implementations§
impl Freeze for AppKeyAction
impl !RefUnwindSafe for AppKeyAction
impl Send for AppKeyAction
impl Sync for AppKeyAction
impl Unpin for AppKeyAction
impl !UnwindSafe for AppKeyAction
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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