Tui

Struct Tui 

Source
pub struct Tui { /* private fields */ }
Expand description

There’s two types of lifetimes the TUI code needs to manage:

  • Across frames
  • Per frame

Tui manages the first one. It’s also the entrypoint for everything else you may want to do.

Implementations§

Source§

impl Tui

Source

pub fn new() -> Result<Self>

Creates a new Tui instance for storing state across frames.

Source

pub fn setup_indexed_colors(&mut self, colors: [u32; 18])

Sets up the framebuffer’s color palette.

Source

pub fn setup_modifier_translations( &mut self, translations: ModifierTranslations, )

Set up translations for Ctrl/Alt/Shift modifiers.

Source

pub fn set_floater_default_bg(&mut self, color: u32)

Set the default background color for floaters (dropdowns, etc.).

Source

pub fn set_floater_default_fg(&mut self, color: u32)

Set the default foreground color for floaters (dropdowns, etc.).

Source

pub fn set_modal_default_bg(&mut self, color: u32)

Set the default background color for modals.

Source

pub fn set_modal_default_fg(&mut self, color: u32)

Set the default foreground color for modals.

Source

pub fn read_timeout(&mut self) -> Duration

If the TUI is currently running animations, etc., this will return a timeout smaller than time::Duration::MAX.

Source

pub fn size(&self) -> Size

Returns the viewport size.

Source

pub fn indexed(&self, index: IndexedColor) -> u32

Returns an indexed color from the framebuffer.

Source

pub fn indexed_alpha( &self, index: IndexedColor, numerator: u32, denominator: u32, ) -> u32

Returns an indexed color from the framebuffer with the given alpha. See Framebuffer::indexed_alpha().

Source

pub fn contrasted(&self, color: u32) -> u32

Returns a color in contrast with the given color. See Framebuffer::contrasted().

Source

pub fn clipboard_ref(&self) -> &Clipboard

Returns the clipboard.

Source

pub fn clipboard_mut(&mut self) -> &mut Clipboard

Returns the clipboard (mutable).

Source

pub fn create_context<'a, 'input>( &'a mut self, input: Option<Input<'input>>, ) -> Context<'a, 'input>

Starts a new frame and returns a Context for it.

Source

pub fn needs_settling(&mut self) -> bool

After you finished processing all input, continue redrawing your UI until this returns false.

Source

pub fn render<'a>(&mut self, arena: &'a Arena) -> ArenaString<'a>

Renders the last frame into the framebuffer and returns the VT output.

Source

pub fn debug_layout<'a>(&mut self, arena: &'a Arena) -> ArenaString<'a>

Outputs a debug string of the layout and focus tree.

Auto Trait Implementations§

§

impl !Freeze for Tui

§

impl !RefUnwindSafe for Tui

§

impl !Send for Tui

§

impl !Sync for Tui

§

impl Unpin for Tui

§

impl !UnwindSafe 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, 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, 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.