Skip to main content

TUI

Struct TUI 

Source
pub struct TUI {
    pub root: Container,
    /* private fields */
}

Fields§

§root: Container

The root container — all top-level children are added here. Matches pi’s class TUI extends Container — the TUI itself renders this root container first, then applies overlays.

Implementations§

Source§

impl TUI

Source

pub fn new() -> Self

Source

pub fn screen_mut(&mut self) -> &mut Screen

Source

pub fn full_redraw_count(&self) -> usize

Source

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

Source

pub fn set_dimensions(&mut self, width: usize, height: usize)

Source

pub fn get_dimensions(&self) -> (usize, usize)

Source

pub fn request_render(&mut self)

Source

pub fn is_dirty(&self) -> bool

Source

pub fn show_overlay( &mut self, component: Box<dyn Component>, options: OverlayOptions, ) -> u64

Show an overlay component with configurable positioning and sizing. Returns an overlay ID that can be used with hide_overlay.

Source

pub fn hide_overlay(&mut self, id: u64)

Hide an overlay by ID

Source

pub fn pop_overlay(&mut self)

Hide the topmost overlay and restore previous focus

Source

pub fn has_overlays(&self) -> bool

Check if there are any visible overlays

Source

pub fn set_focus(&mut self, overlay_idx: Option<usize>)

Set focus to a specific overlay or None for base content

Source

pub fn focused_overlay(&self) -> Option<usize>

Get current focus target

Source

pub fn route_input(&mut self, key: &KeyEvent) -> bool

Route a keyboard event through the overlay input pipeline. Returns true if the input was consumed by an overlay.

Should be called BEFORE the application handles the key itself, so overlays get first crack at input.

Source

pub fn route_paste(&mut self, text: &str) -> bool

Route a paste event to the focused overlay component or root. Matches pi’s input pipeline where paste is sent to handleInput.

Source

pub fn render( &mut self, width: usize, height: usize, writer: &mut dyn Write, ) -> Result<()>

Render the root component tree, composite overlays, then diff-render to screen.

Matches pi’s TUI.render() which extends Container:

  1. Render root Container (all permanent children)
  2. Append chat_buffer (bridge from compose_ui during migration)
  3. Composite any overlays on top
  4. Diff-render via Screen
Source

pub fn finalize(&mut self, writer: &mut dyn Write) -> Result<()>

Move cursor to clean position on exit — past all content

Trait Implementations§

Source§

impl Default for TUI

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for TUI

§

impl !Send for TUI

§

impl !Sync for TUI

§

impl !UnwindSafe for TUI

§

impl Freeze for TUI

§

impl Unpin for TUI

§

impl UnsafeUnpin for TUI

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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