pub struct Terminal<B>where
B: Backend,{ /* private fields */ }Expand description
Interface to the terminal backed by Termion
Implementations§
Source§impl<B> Terminal<B>where
B: Backend,
impl<B> Terminal<B>where
B: Backend,
Sourcepub fn new(backend: B) -> Result<Terminal<B>, Error>
pub fn new(backend: B) -> Result<Terminal<B>, Error>
Wrapper around Terminal initialization. Each buffer is initialized with a blank string and default colors for the foreground and the background
Sourcepub fn with_options(
backend: B,
options: TerminalOptions,
) -> Result<Terminal<B>, Error>
pub fn with_options( backend: B, options: TerminalOptions, ) -> Result<Terminal<B>, Error>
UNSTABLE
Sourcepub fn get_frame(&mut self) -> Frame<'_, B>
pub fn get_frame(&mut self) -> Frame<'_, B>
Get a Frame object which provides a consistent view into the terminal state for rendering.
pub fn current_buffer_mut(&mut self) -> &mut Buffer
pub fn backend(&self) -> &B
pub fn backend_mut(&mut self) -> &mut B
Sourcepub fn flush(&mut self) -> Result<(), Error>
pub fn flush(&mut self) -> Result<(), Error>
Obtains a difference between the previous and the current buffer and passes it to the current backend for drawing.
Sourcepub fn resize(&mut self, area: Rect) -> Result<(), Error>
pub fn resize(&mut self, area: Rect) -> Result<(), Error>
Updates the Terminal so that internal buffers match the requested size. Requested size will be saved so the size can remain consistent when rendering. This leads to a full clear of the screen.
Sourcepub fn autoresize(&mut self) -> Result<(), Error>
pub fn autoresize(&mut self) -> Result<(), Error>
Queries the backend for size and resizes if it doesn’t match the previous size.
Sourcepub fn draw<F>(&mut self, f: F) -> Result<CompletedFrame<'_>, Error>
pub fn draw<F>(&mut self, f: F) -> Result<CompletedFrame<'_>, Error>
Synchronizes terminal size, calls the rendering closure, flushes the current internal state and prepares for the next draw call.