Skip to main content

App

Struct App 

Source
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

Source

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 Rc for shared access
  • Creates initial view state from settings and result
Source

pub fn set_theme(self, theme: ThemeName) -> Self

Replaces the base theme and returns self (builder-style).

Source

pub fn run(&mut self, terminal: &mut DefaultTerminal) -> Result<(), TuiError>

Runs the main TUI event/draw loop until the user quits.

Loop steps:

  1. Draw current frame using AppView widget
  2. Read next crossterm event
  3. Handle event (keyboard, mouse, resize) via AppViewState
  4. Repeat until state.is_running() returns false (usually on ‘q’ or Ctrl+C)
§Errors

Propagates terminal I/O or event reading failures as TuiError::Io.

Trait Implementations§

Source§

impl TryFrom<&TuiArgs> for App

Source§

type Error = TuiError

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

fn try_from(value: &TuiArgs) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<LingoraToml> for App

Source§

type Error = TuiError

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

fn try_from(settings: LingoraToml) -> Result<Self, Self::Error>

Performs the conversion.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

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, 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<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

Source§

type Proj<U: 'src> = U

Source§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, S> SpanWrap<S> for T
where S: WrappingSpan<T>,

Source§

fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned

Invokes WrappingSpan::make_wrapped to wrap an AST node in a span.
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.