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: AppModeCurrent application mode
previous_mode: AppModePrevious application mode (for quick switching)
chat: ChatStateChat state
theme_manager: ThemeManagerTheme manager for runtime theme switching
theme: ThemeCurrent theme (cached from theme manager)
config: TuiConfigApplication configuration
should_exit: boolWhether the application should exit
event_loop: EventLoopEvent loop
renderer: RendererRenderer
keybindings_enabled: boolMode-specific keybindings enabled
widget_integration: WidgetIntegrationWidget integration manager
screen_reader: ScreenReaderAnnouncerScreen reader announcer for accessibility
Keyboard navigation manager
focus_manager: FocusManagerFocus manager for accessibility
provider_integration: ProviderIntegrationProvider integration for AI responses
image_integration: ImageIntegrationImage integration for drag-and-drop and display Requirements: 1.1 - Detect drag-and-drop event via crossterm
image_widget: ImageWidgetImage widget for displaying images in the terminal Requirements: 5.1 - Display images in terminal using ricecoder-images ImageDisplay
Implementations§
Source§impl App
impl App
Sourcepub fn with_config(config: TuiConfig) -> Result<Self>
pub fn with_config(config: TuiConfig) -> Result<Self>
Create a new application instance with a specific configuration
Sourcepub fn switch_mode(&mut self, mode: AppMode)
pub fn switch_mode(&mut self, mode: AppMode)
Switch to a different mode
Sourcepub fn previous_mode_switch(&mut self)
pub fn previous_mode_switch(&mut self)
Switch to the previous mode in the cycle
Sourcepub fn toggle_mode(&mut self)
pub fn toggle_mode(&mut self)
Toggle between current and previous mode
Sourcepub fn current_mode_name(&self) -> &'static str
pub fn current_mode_name(&self) -> &'static str
Get the current mode display name
Sourcepub fn current_mode_shortcut(&self) -> &'static str
pub fn current_mode_shortcut(&self) -> &'static str
Get the current mode shortcut
Sourcepub fn switch_theme(&mut self, name: &str) -> Result<()>
pub fn switch_theme(&mut self, name: &str) -> Result<()>
Switch to a theme by name
Sourcepub fn available_themes(&self) -> Vec<&'static str>
pub fn available_themes(&self) -> Vec<&'static str>
Get available themes
Sourcepub fn current_theme_name(&self) -> Result<String>
pub fn current_theme_name(&self) -> Result<String>
Get current theme name
Sourcepub fn sync_widget_state(&mut self)
pub fn sync_widget_state(&mut self)
Synchronize widget state
Sourcepub fn widgets(&self) -> &WidgetContainer
pub fn widgets(&self) -> &WidgetContainer
Get the active widgets container
Sourcepub fn widgets_mut(&mut self) -> &mut WidgetContainer
pub fn widgets_mut(&mut self) -> &mut WidgetContainer
Get mutable access to the active widgets container
Sourcepub fn layout(&self) -> &LayoutCoordinator
pub fn layout(&self) -> &LayoutCoordinator
Get the layout coordinator
Sourcepub fn sync_prompt_context(&mut self)
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
Sourcepub fn get_prompt_context(&self) -> &PromptContext
pub fn get_prompt_context(&self) -> &PromptContext
Get the current prompt context
Sourcepub fn get_prompt_context_mut(&mut self) -> &mut PromptContext
pub fn get_prompt_context_mut(&mut self) -> &mut PromptContext
Get mutable access to the current prompt context
Sourcepub fn switch_mode_with_announcement(&mut self, mode: AppMode)
pub fn switch_mode_with_announcement(&mut self, mode: AppMode)
Switch mode with accessibility announcement
Sourcepub fn announce_error(&mut self, message: impl Into<String>)
pub fn announce_error(&mut self, message: impl Into<String>)
Announce an error to screen readers
Sourcepub fn announce_success(&mut self, message: impl Into<String>)
pub fn announce_success(&mut self, message: impl Into<String>)
Announce a success to screen readers
Sourcepub fn set_screen_reader_enabled(&mut self, enabled: bool)
pub fn set_screen_reader_enabled(&mut self, enabled: bool)
Enable or disable screen reader support
Sourcepub fn set_high_contrast_enabled(&mut self, enabled: bool)
pub fn set_high_contrast_enabled(&mut self, enabled: bool)
Enable or disable high contrast mode
Handle Tab key for keyboard navigation
Sourcepub fn get_focused_element_description(&self) -> Option<String>
pub fn get_focused_element_description(&self) -> Option<String>
Get the currently focused element description
Sourcepub fn register_keyboard_element(&mut self, alternative: TextAlternative)
pub fn register_keyboard_element(&mut self, alternative: TextAlternative)
Register an element for keyboard navigation
Sourcepub fn clear_keyboard_elements(&mut self)
pub fn clear_keyboard_elements(&mut self)
Clear all keyboard navigation elements
Sourcepub fn set_animations_enabled(&mut self, enabled: bool)
pub fn set_animations_enabled(&mut self, enabled: bool)
Enable or disable animations
Sourcepub fn set_reduce_motion(&mut self, enabled: bool)
pub fn set_reduce_motion(&mut self, enabled: bool)
Enable or disable reduce motion (for accessibility)
Sourcepub fn set_animation_speed(&mut self, speed: f32)
pub fn set_animation_speed(&mut self, speed: f32)
Set animation speed multiplier
Sourcepub fn should_animate(&self) -> bool
pub fn should_animate(&self) -> bool
Check if animations should be displayed
Sourcepub fn animation_duration_ms(&self, base_ms: u32) -> u32
pub fn animation_duration_ms(&self, base_ms: u32) -> u32
Get animation duration in milliseconds
Sourcepub fn announce_state_change(&mut self, event: StateChangeEvent)
pub fn announce_state_change(&mut self, event: StateChangeEvent)
Announce a state change
Sourcepub fn set_focus_with_announcement(&mut self, element_id: impl Into<String>)
pub fn set_focus_with_announcement(&mut self, element_id: impl Into<String>)
Set focus to an element and announce it
Sourcepub fn restore_focus(&mut self)
pub fn restore_focus(&mut self)
Restore previous focus
Sourcepub fn announce_operation_status(&mut self, operation: &str, status: &str)
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> 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> 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