Trait term::Terminal [−][src]
A terminal with similar capabilities to an ANSI Terminal (foreground/background colors etc).
Associated Types
Loading content...Required methods
fn fg(&mut self, color: Color) -> Result<()>
[src]
Sets the foreground color to the given color.
If the color is a bright color, but the terminal only supports 8 colors, the corresponding normal color will be used instead.
Returns Ok(())
if the color change code was sent to the terminal, or Err(e)
if there
was an error.
fn bg(&mut self, color: Color) -> Result<()>
[src]
Sets the background color to the given color.
If the color is a bright color, but the terminal only supports 8 colors, the corresponding normal color will be used instead.
Returns Ok(())
if the color change code was sent to the terminal, or Err(e)
if there
was an error.
fn attr(&mut self, attr: Attr) -> Result<()>
[src]
Sets the given terminal attribute, if supported. Returns Ok(())
if the attribute is
supported and was sent to the terminal, or Err(e)
if there was an error or the attribute
wasn’t supported.
fn supports_attr(&self, attr: Attr) -> bool
[src]
Returns whether the given terminal attribute is supported.
fn reset(&mut self) -> Result<()>
[src]
Resets all terminal attributes and colors to their defaults.
Returns Ok(())
if the reset code was printed, or Err(e)
if there was an error.
Note: This does not flush.
That means the reset command may get buffered so, if you aren’t planning on doing anything else that might flush stdout’s buffer (e.g. writing a line of text), you should flush after calling reset.
fn supports_reset(&self) -> bool
[src]
Returns true if reset is supported.
fn supports_color(&self) -> bool
[src]
Returns true if color is fully supported.
If this function returns true
, bg
, fg
, and reset
will never
return Err(Error::NotSupported)
.
fn cursor_up(&mut self) -> Result<()>
[src]
Moves the cursor up one line.
Returns Ok(())
if the cursor movement code was printed, or Err(e)
if there was an
error.
fn delete_line(&mut self) -> Result<()>
[src]
Deletes the text from the cursor location to the end of the line.
Returns Ok(())
if the deletion code was printed, or Err(e)
if there was an error.
fn carriage_return(&mut self) -> Result<()>
[src]
Moves the cursor to the left edge of the current line.
Returns Ok(true)
if the deletion code was printed, or Err(e)
if there was an error.
fn get_ref(&self) -> &Self::Output
[src]
Gets an immutable reference to the stream inside
fn get_mut(&mut self) -> &mut Self::Output
[src]
Gets a mutable reference to the stream inside
fn into_inner(self) -> Self::Output where
Self: Sized,
[src]
Self: Sized,
Returns the contained stream, destroying the Terminal
Implementors
impl<T: Write> Terminal for TerminfoTerminal<T>
[src]
type Output = T
fn fg(&mut self, color: Color) -> Result<()>
[src]
fn bg(&mut self, color: Color) -> Result<()>
[src]
fn attr(&mut self, attr: Attr) -> Result<()>
[src]
fn supports_attr(&self, attr: Attr) -> bool
[src]
fn reset(&mut self) -> Result<()>
[src]
fn supports_reset(&self) -> bool
[src]
fn supports_color(&self) -> bool
[src]
fn cursor_up(&mut self) -> Result<()>
[src]
fn delete_line(&mut self) -> Result<()>
[src]
fn carriage_return(&mut self) -> Result<()>
[src]
fn get_ref(&self) -> &T
[src]
fn get_mut(&mut self) -> &mut T
[src]
fn into_inner(self) -> T where
Self: Sized,
[src]
Self: Sized,