[][src]Struct unsegen::base::terminal::Terminal

pub struct Terminal<'a, T = StdoutLock<'a>> where
    T: AsRawFd + Write
{ /* fields omitted */ }

A type providing an interface to the underlying physical terminal. This also provides the entry point for any rendering to the terminal buffer.

Implementations

impl<'a, T: Write + AsRawFd> Terminal<'a, T>[src]

pub fn new(sink: T) -> Result<Self>[src]

Create a new terminal. The terminal takes control of the provided io sink (usually stdout) and performs all output on it.

If the terminal cannot be created (e.g., because the provided io sink does not allow for setting up raw mode), the error is returned.

pub fn handle_sigtstp(&mut self) -> Result<()>[src]

This method is intended to be called when the process received a SIGTSTP.

The terminal state is restored, and the process is actually stopped within this function. When the process then receives a SIGCONT it sets up the terminal state as expected again and returns from the function.

The usual way to deal with SIGTSTP (and signals in general) is to block them and waidpid for them in a separate thread which sends the events into some fifo. The fifo can be polled in an event loop. Then, if in the main event loop a SIGTSTP turns up, this function should be called.

pub fn on_main_screen<R, F: FnOnce() -> R>(&mut self, f: F) -> Result<R>[src]

Temporarily switch back to main terminal screen, restore terminal state, then execute f and subsequently switch back to tui mode again.

In other words: Execute a function f in "normal" terminal mode. This can be useful if the application executes a subprocess that is expected to take control of the tty temporarily.

pub fn create_root_window(&mut self) -> Window<'_>[src]

Create a root window that covers the whole terminal grid.

Use the buffer to manipulate the current window buffer and use present subsequently to write out the buffer to the actual terminal.

pub fn present(&mut self)[src]

Present the current buffer content to the actual terminal.

Trait Implementations

impl<'a, T: Write + AsRawFd> Drop for Terminal<'a, T>[src]

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for Terminal<'a, T> where
    T: RefUnwindSafe

impl<'a, T> Send for Terminal<'a, T> where
    T: Send

impl<'a, T> Sync for Terminal<'a, T> where
    T: Sync

impl<'a, T> Unpin for Terminal<'a, T> where
    T: Unpin

impl<'a, T> UnwindSafe for Terminal<'a, T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.