Struct dyd::terminal::tui::Tui

source ·
pub struct Tui<B: Backend> {
    pub events: EventHandler,
    /* private fields */
}
Expand description

Representation of a terminal user interface.

It is responsible for setting up the terminal, initializing the interface and handling the draw events.

Fields§

§events: EventHandler

Terminal event handler.

Implementations§

source§

impl<B: Backend> Tui<B>

source

pub fn new(terminal: Terminal<B>, events: EventHandler) -> Self

Constructs a new instance of Tui.

source

pub fn init(&mut self) -> AppResult<()>

Initializes the terminal interface.

It enables the raw mode and sets terminal properties.

source

pub fn draw(&mut self, app: &mut App) -> AppResult<()>

Draw the terminal interface by rendering the widgets.

source

pub fn exit(&mut self) -> AppResult<()>

Exits the terminal interface.

It disables the raw mode and reverts back the terminal properties.

Trait Implementations§

source§

impl<B: Debug + Backend> Debug for Tui<B>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<B> !RefUnwindSafe for Tui<B>

§

impl<B> Send for Tui<B>where B: Send,

§

impl<B> !Sync for Tui<B>

§

impl<B> Unpin for Tui<B>where B: Unpin,

§

impl<B> !UnwindSafe for Tui<B>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.