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>>
pub fn new(backend: B) -> Result<Terminal<B>>
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>>
pub fn with_options(backend: B, options: TerminalOptions) -> Result<Terminal<B>>
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<()>
pub fn flush(&mut self) -> Result<()>
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<()>
pub fn resize(&mut self, area: Rect) -> Result<()>
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<()>
pub fn autoresize(&mut self) -> Result<()>
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<'_>>where
F: FnOnce(&mut Frame<'_, B>),
pub fn draw<F>(&mut self, f: F) -> Result<CompletedFrame<'_>>where F: FnOnce(&mut Frame<'_, B>),
Synchronizes terminal size, calls the rendering closure, flushes the current internal state and prepares for the next draw call.