pub struct Display<T: Tui> { /* private fields */ }
Expand description
A high level interface to the terminal display.
Implementations
sourceimpl<T: Tui> Display<T>
impl<T: Tui> Display<T>
sourcepub fn draw_str(&mut self, s: &str) -> Result<()>
pub fn draw_str(&mut self, s: &str) -> Result<()>
Draws a string of text to the terminal interface.
Errors
Will error if the underlying terminal interface is in an error state.
sourcepub fn clear(&mut self) -> Result<()>
pub fn clear(&mut self) -> Result<()>
Clear the terminal interface and reset any style and color attributes.
Errors
Will error if the underlying terminal interface is in an error state.
sourcepub fn refresh(&mut self) -> Result<()>
pub fn refresh(&mut self) -> Result<()>
Force a refresh of the terminal interface. This normally should be called after after all text has been drawn to the terminal interface. This is considered a slow operation, so should be called only as needed.
Errors
Will error if the underlying terminal interface is in an error state.
sourcepub fn color(&mut self, color: DisplayColor, selected: bool) -> Result<()>
pub fn color(&mut self, color: DisplayColor, selected: bool) -> Result<()>
Set the color of text drawn to the terminal interface. This will only change text drawn to the terminal after this function call.
Errors
Will error if the underlying terminal interface is in an error state.
sourcepub fn set_style(
&mut self,
dim: bool,
underline: bool,
reverse: bool
) -> Result<()>
pub fn set_style(
&mut self,
dim: bool,
underline: bool,
reverse: bool
) -> Result<()>
Set the style attributes of text drawn to the terminal interface. This will only change text drawn to the terminal after this function call.
Errors
Will error if the underlying terminal interface is in an error state.
sourcepub fn get_window_size(&self) -> Size
pub fn get_window_size(&self) -> Size
Get the width and height of the terminal interface. This can be a slow operation, so should not be called unless absolutely needed.
Errors
Will error if the underlying terminal interface is in an error state.
sourcepub fn ensure_at_line_start(&mut self) -> Result<()>
pub fn ensure_at_line_start(&mut self) -> Result<()>
Reset the cursor position to the start of the line.
Errors
Will error if the underlying terminal interface is in an error state.
sourcepub fn move_from_end_of_line(&mut self, right: u16) -> Result<()>
pub fn move_from_end_of_line(&mut self, right: u16) -> Result<()>
Move the cursor position right
characters from the end of the line.
Errors
Will error if the underlying terminal interface is in an error state.
sourcepub fn next_line(&mut self) -> Result<()>
pub fn next_line(&mut self) -> Result<()>
Move the cursor to the next line.
Errors
Will error if the underlying terminal interface is in an error state.
sourcepub fn start(&mut self) -> Result<()>
pub fn start(&mut self) -> Result<()>
Start the terminal interface interactions. This should be called before any terminal interactions are performed.
Errors
Will error if the underlying terminal interface is in an error state.
sourcepub fn end(&mut self) -> Result<()>
pub fn end(&mut self) -> Result<()>
End the terminal interface interactions. This should be called after all terminal interactions are complete. This resets the terminal interface to the default state, and should be called on program exit.
Errors
Will error if the underlying terminal interface is in an error state.
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Display<T> where
T: RefUnwindSafe,
impl<T> Send for Display<T> where
T: Send,
impl<T> Sync for Display<T> where
T: Sync,
impl<T> Unpin for Display<T> where
T: Unpin,
impl<T> UnwindSafe for Display<T> where
T: 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