pub struct Terminal<B> where
B: Backend, { /* private fields */ }
Expand description
Interface to the terminal backed by Termion
Implementations
sourceimpl<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.
pub fn hide_cursor(&mut self) -> Result<()>
pub fn show_cursor(&mut self) -> Result<()>
pub fn get_cursor(&mut self) -> Result<(u16, u16)>
pub fn set_cursor(&mut self, x: u16, y: u16) -> Result<()>
Trait Implementations
Auto Trait Implementations
impl<B> RefUnwindSafe for Terminal<B> where
B: RefUnwindSafe,
impl<B> Send for Terminal<B> where
B: Send,
impl<B> Sync for Terminal<B> where
B: Sync,
impl<B> Unpin for Terminal<B> where
B: Unpin,
impl<B> UnwindSafe for Terminal<B> where
B: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more