App

Struct App 

Source
pub struct App {
Show 17 fields pub mode: AppMode, pub previous_mode: AppMode, pub chat: ChatState, pub theme_manager: ThemeManager, pub theme: Theme, pub config: TuiConfig, pub should_exit: bool, pub event_loop: EventLoop, pub renderer: Renderer, pub keybindings_enabled: bool, pub widget_integration: WidgetIntegration, pub screen_reader: ScreenReaderAnnouncer, pub keyboard_nav: KeyboardNavigationManager, pub focus_manager: FocusManager, pub provider_integration: ProviderIntegration, pub image_integration: ImageIntegration, pub image_widget: ImageWidget,
}
Expand description

Main application state

Fields§

§mode: AppMode

Current application mode

§previous_mode: AppMode

Previous application mode (for quick switching)

§chat: ChatState

Chat state

§theme_manager: ThemeManager

Theme manager for runtime theme switching

§theme: Theme

Current theme (cached from theme manager)

§config: TuiConfig

Application configuration

§should_exit: bool

Whether the application should exit

§event_loop: EventLoop

Event loop

§renderer: Renderer

Renderer

§keybindings_enabled: bool

Mode-specific keybindings enabled

§widget_integration: WidgetIntegration

Widget integration manager

§screen_reader: ScreenReaderAnnouncer

Screen reader announcer for accessibility

§keyboard_nav: KeyboardNavigationManager

Keyboard navigation manager

§focus_manager: FocusManager

Focus manager for accessibility

§provider_integration: ProviderIntegration

Provider integration for AI responses

§image_integration: ImageIntegration

Image integration for drag-and-drop and display Requirements: 1.1 - Detect drag-and-drop event via crossterm

§image_widget: ImageWidget

Image widget for displaying images in the terminal Requirements: 5.1 - Display images in terminal using ricecoder-images ImageDisplay

Implementations§

Source§

impl App

Source

pub fn new() -> Result<Self>

Create a new application instance

Source

pub fn with_config(config: TuiConfig) -> Result<Self>

Create a new application instance with a specific configuration

Source

pub async fn run(&mut self) -> Result<()>

Run the application

Source

pub fn switch_mode(&mut self, mode: AppMode)

Switch to a different mode

Source

pub fn next_mode(&mut self)

Switch to the next mode in the cycle

Source

pub fn previous_mode_switch(&mut self)

Switch to the previous mode in the cycle

Source

pub fn toggle_mode(&mut self)

Toggle between current and previous mode

Source

pub fn current_mode_name(&self) -> &'static str

Get the current mode display name

Source

pub fn current_mode_shortcut(&self) -> &'static str

Get the current mode shortcut

Source

pub fn switch_theme(&mut self, name: &str) -> Result<()>

Switch to a theme by name

Source

pub fn available_themes(&self) -> Vec<&'static str>

Get available themes

Source

pub fn current_theme_name(&self) -> Result<String>

Get current theme name

Source

pub fn sync_widget_state(&mut self)

Synchronize widget state

Source

pub fn widgets(&self) -> &WidgetContainer

Get the active widgets container

Source

pub fn widgets_mut(&mut self) -> &mut WidgetContainer

Get mutable access to the active widgets container

Source

pub fn layout(&self) -> &LayoutCoordinator

Get the layout coordinator

Source

pub fn sync_prompt_context(&mut self)

Sync prompt context with current state

§Requirements
  • Req 1.4: Add images to prompt context
  • Req 5.1: Include images in message history
Source

pub fn get_prompt_context(&self) -> &PromptContext

Get the current prompt context

Source

pub fn get_prompt_context_mut(&mut self) -> &mut PromptContext

Get mutable access to the current prompt context

Source

pub fn switch_mode_with_announcement(&mut self, mode: AppMode)

Switch mode with accessibility announcement

Source

pub fn announce(&mut self, message: impl Into<String>)

Announce a message to screen readers

Source

pub fn announce_error(&mut self, message: impl Into<String>)

Announce an error to screen readers

Source

pub fn announce_success(&mut self, message: impl Into<String>)

Announce a success to screen readers

Source

pub fn set_screen_reader_enabled(&mut self, enabled: bool)

Enable or disable screen reader support

Source

pub fn set_high_contrast_enabled(&mut self, enabled: bool)

Enable or disable high contrast mode

Source

pub fn handle_tab_navigation(&mut self, shift: bool)

Handle Tab key for keyboard navigation

Source

pub fn get_focused_element_description(&self) -> Option<String>

Get the currently focused element description

Source

pub fn register_keyboard_element(&mut self, alternative: TextAlternative)

Register an element for keyboard navigation

Source

pub fn clear_keyboard_elements(&mut self)

Clear all keyboard navigation elements

Source

pub fn set_animations_enabled(&mut self, enabled: bool)

Enable or disable animations

Source

pub fn set_reduce_motion(&mut self, enabled: bool)

Enable or disable reduce motion (for accessibility)

Source

pub fn set_animation_speed(&mut self, speed: f32)

Set animation speed multiplier

Source

pub fn should_animate(&self) -> bool

Check if animations should be displayed

Source

pub fn animation_duration_ms(&self, base_ms: u32) -> u32

Get animation duration in milliseconds

Source

pub fn announce_state_change(&mut self, event: StateChangeEvent)

Announce a state change

Source

pub fn set_focus_with_announcement(&mut self, element_id: impl Into<String>)

Set focus to an element and announce it

Source

pub fn restore_focus(&mut self)

Restore previous focus

Source

pub fn announce_operation_status(&mut self, operation: &str, status: &str)

Announce an operation status

Auto Trait Implementations§

§

impl Freeze for App

§

impl !RefUnwindSafe for App

§

impl Send for App

§

impl Sync for App

§

impl Unpin for App

§

impl !UnwindSafe for App

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more