pub struct App { /* private fields */ }Expand description
The main application state and driver for the interactive terminal user interface.
App owns:
- The visual theme (
LingoraTheme) - The
AuditResult(shared across widgets/views) - The current application view state (
AppViewState)
Responsibilities:
- Initialize from configuration and audit result
- Run the main event/draw loop
- Delegate rendering to
AppView(stateful widget) - Forward keyboard/mouse events to the view state
- Manage cursor visibility and position
Implementations§
Source§impl App
impl App
Sourcepub fn new(settings: LingoraToml, audit_result: AuditResult) -> Self
pub fn new(settings: LingoraToml, audit_result: AuditResult) -> Self
Creates a new App instance from settings and a completed audit result.
- Initializes the theme
- Wraps the audit result in
Rcfor shared access - Creates initial view state from settings and result
Sourcepub fn set_theme(self, theme: ThemeName) -> Self
pub fn set_theme(self, theme: ThemeName) -> Self
Replaces the base theme and returns self (builder-style).
Sourcepub fn run(&mut self, terminal: &mut DefaultTerminal) -> Result<(), TuiError>
pub fn run(&mut self, terminal: &mut DefaultTerminal) -> Result<(), TuiError>
Runs the main TUI event/draw loop until the user quits.
Loop steps:
- Draw current frame using
AppViewwidget - Read next crossterm event
- Handle event (keyboard, mouse, resize) via
AppViewState - Repeat until
state.is_running()returnsfalse(usually on ‘q’ or Ctrl+C)
§Errors
Propagates terminal I/O or event reading failures as TuiError::Io.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl !Send for App
impl !Sync for App
impl Unpin for App
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
Invokes
WrappingSpan::make_wrapped to wrap an AST node in a span.