[][src]Struct mortal::terminal::TerminalWriteGuard

pub struct TerminalWriteGuard<'a>(_);

Holds an exclusive lock for write operations on a Terminal

See Terminal documentation for details on locking.

Methods

impl<'a> TerminalWriteGuard<'a>[src]

pub fn flush(&mut self) -> Result<()>[src]

Flush all output to the terminal device.

This is called automatically when the TerminalWriteGuard is dropped.

pub fn size(&self) -> Result<Size>[src]

Returns the size of the terminal.

pub fn clear_screen(&mut self) -> Result<()>[src]

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.

pub fn clear_to_line_end(&mut self) -> Result<()>[src]

Clears the current line, starting at cursor position.

pub fn clear_to_screen_end(&mut self) -> Result<()>[src]

Clears the screen, starting at cursor position.

pub fn move_up(&mut self, n: usize) -> Result<()>[src]

Moves the cursor up n lines.

pub fn move_down(&mut self, n: usize) -> Result<()>[src]

Moves the cursor down n lines.

pub fn move_left(&mut self, n: usize) -> Result<()>[src]

Moves the cursor left n columns.

pub fn move_right(&mut self, n: usize) -> Result<()>[src]

Moves the cursor right n columns.

pub fn move_to_first_column(&mut self) -> Result<()>[src]

Moves the cursor to the first column of the current line

pub fn set_cursor_mode(&mut self, mode: CursorMode) -> Result<()>[src]

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.

pub fn add_style(&mut self, style: Style) -> Result<()>[src]

Adds a set of Style flags to the current style setting.

pub fn remove_style(&mut self, style: Style) -> Result<()>[src]

Removes a set of Style flags from the current style setting.

pub fn set_style<S>(&mut self, style: S) -> Result<()> where
    S: Into<Option<Style>>, 
[src]

Sets the current style to the given set of flags.

pub fn set_theme(&mut self, theme: Theme) -> Result<()>[src]

Sets all attributes for the terminal.

pub fn set_fg<C: Into<Option<Color>>>(&mut self, fg: C) -> Result<()>[src]

Sets the background text color.

pub fn set_bg<C: Into<Option<Color>>>(&mut self, bg: C) -> Result<()>[src]

Removes color and style attributes.

pub fn clear_attributes(&mut self) -> Result<()>[src]

Adds bold to the current style setting.

pub fn bold(&mut self) -> Result<()>[src]

Adds bold to the current style setting.

This is equivalent to self.add_style(Style::BOLD).

pub fn italic(&mut self) -> Result<()>[src]

Adds italic to the current style setting.

This is equivalent to self.add_style(Style::ITALIC).

pub fn underline(&mut self) -> Result<()>[src]

Adds underline to the current style setting.

This is equivalent to self.add_style(Style::UNDERLINE).

pub fn reverse(&mut self) -> Result<()>[src]

Adds reverse to the current style setting.

This is equivalent to self.add_style(Style::REVERSE).

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>>, 
[src]

Writes output to the terminal with the given color and style added.

All attributes are removed after the given text is written.

pub fn write_char(&mut self, ch: char) -> Result<()>[src]

Writes a single character to the terminal using the current style and color settings.

pub fn write_str(&mut self, s: &str) -> Result<()>[src]

Writes a string to the terminal using the current style and color settings.

pub fn write_fmt(&mut self, args: Arguments) -> Result<()>[src]

Writes formatted text to the terminal using the current style and color settings.

This method enables TerminalWriteGuard to be used as the receiver to the write! and writeln! macros.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.