Struct mortal::terminal::TerminalWriteGuard
source · [−]pub struct TerminalWriteGuard<'a>(_);
Expand description
Holds an exclusive lock for write operations on a Terminal
See Terminal
documentation for details on locking.
Implementations
sourceimpl<'a> TerminalWriteGuard<'a>
impl<'a> TerminalWriteGuard<'a>
sourcepub fn flush(&mut self) -> Result<()>
pub fn flush(&mut self) -> Result<()>
Flush all output to the terminal device.
This is called automatically when the TerminalWriteGuard
is dropped.
sourcepub fn clear_screen(&mut self) -> Result<()>
pub fn clear_screen(&mut self) -> Result<()>
Clears the terminal screen, placing the cursor at the first line and column.
If the terminal contains a scrolling window over a buffer, the window will be scrolled downward, preserving as much of the existing buffer as possible.
sourcepub fn clear_to_line_end(&mut self) -> Result<()>
pub fn clear_to_line_end(&mut self) -> Result<()>
Clears the current line, starting at cursor position.
sourcepub fn clear_to_screen_end(&mut self) -> Result<()>
pub fn clear_to_screen_end(&mut self) -> Result<()>
Clears the screen, starting at cursor position.
sourcepub fn move_right(&mut self, n: usize) -> Result<()>
pub fn move_right(&mut self, n: usize) -> Result<()>
Moves the cursor right n
columns.
sourcepub fn move_to_first_column(&mut self) -> Result<()>
pub fn move_to_first_column(&mut self) -> Result<()>
Moves the cursor to the first column of the current line
sourcepub fn set_cursor_mode(&mut self, mode: CursorMode) -> Result<()>
pub fn set_cursor_mode(&mut self, mode: CursorMode) -> Result<()>
Set the current cursor mode.
This setting is a visible hint to the user. It produces no change in behavior.
Notes
On some systems, this setting may have no effect.
sourcepub fn add_style(&mut self, style: Style) -> Result<()>
pub fn add_style(&mut self, style: Style) -> Result<()>
Adds a set of Style
flags to the current style setting.
sourcepub fn remove_style(&mut self, style: Style) -> Result<()>
pub fn remove_style(&mut self, style: Style) -> Result<()>
Removes a set of Style
flags from the current style setting.
sourcepub fn set_style<S>(&mut self, style: S) -> Result<()> where
S: Into<Option<Style>>,
pub fn set_style<S>(&mut self, style: S) -> Result<()> where
S: Into<Option<Style>>,
Sets the current style to the given set of flags.
sourcepub fn set_fg<C: Into<Option<Color>>>(&mut self, fg: C) -> Result<()>
pub fn set_fg<C: Into<Option<Color>>>(&mut self, fg: C) -> Result<()>
Sets the background text color.
sourcepub fn set_bg<C: Into<Option<Color>>>(&mut self, bg: C) -> Result<()>
pub fn set_bg<C: Into<Option<Color>>>(&mut self, bg: C) -> Result<()>
Removes color and style attributes.
sourcepub fn clear_attributes(&mut self) -> Result<()>
pub fn clear_attributes(&mut self) -> Result<()>
Adds bold to the current style setting.
sourcepub fn bold(&mut self) -> Result<()>
pub fn bold(&mut self) -> Result<()>
Adds bold to the current style setting.
This is equivalent to self.add_style(Style::BOLD)
.
sourcepub fn italic(&mut self) -> Result<()>
pub fn italic(&mut self) -> Result<()>
Adds italic to the current style setting.
This is equivalent to self.add_style(Style::ITALIC)
.
sourcepub fn underline(&mut self) -> Result<()>
pub fn underline(&mut self) -> Result<()>
Adds underline to the current style setting.
This is equivalent to self.add_style(Style::UNDERLINE)
.
sourcepub fn reverse(&mut self) -> Result<()>
pub fn reverse(&mut self) -> Result<()>
Adds reverse to the current style setting.
This is equivalent to self.add_style(Style::REVERSE)
.
sourcepub fn write_styled<F, B, S>(
&mut self,
fg: F,
bg: B,
style: S,
s: &str
) -> Result<()> where
F: Into<Option<Color>>,
B: Into<Option<Color>>,
S: Into<Option<Style>>,
pub fn write_styled<F, B, S>(
&mut self,
fg: F,
bg: B,
style: S,
s: &str
) -> Result<()> where
F: Into<Option<Color>>,
B: Into<Option<Color>>,
S: Into<Option<Style>>,
Writes output to the terminal with the given color and style added.
All attributes are removed after the given text is written.
sourcepub fn write_char(&mut self, ch: char) -> Result<()>
pub fn write_char(&mut self, ch: char) -> Result<()>
Writes a single character to the terminal using the current style and color settings.
Auto Trait Implementations
impl<'a> RefUnwindSafe for TerminalWriteGuard<'a>
impl<'a> !Send for TerminalWriteGuard<'a>
impl<'a> Sync for TerminalWriteGuard<'a>
impl<'a> Unpin for TerminalWriteGuard<'a>
impl<'a> UnwindSafe for TerminalWriteGuard<'a>
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