Trait term::TerminalExperimental
[-]
[+]
[src]
pub trait Terminal<T: Writer>: Writer { fn fg(&mut self, color: Color) -> IoResult<bool>; fn bg(&mut self, color: Color) -> IoResult<bool>; fn attr(&mut self, attr: Attr) -> IoResult<bool>; fn supports_attr(&self, attr: Attr) -> bool; fn reset(&mut self) -> IoResult<()>; fn get_ref<'a>(&'a self) -> &'a T; fn get_mut<'a>(&'a mut self) -> &'a mut T; }
A terminal with similar capabilities to an ANSI Terminal (foreground/background colors etc).
Required Methods
fn fg(&mut self, color: Color) -> IoResult<bool>
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(true)
if the color was set, Ok(false)
otherwise, and Err(e)
if there was an I/O error.
fn bg(&mut self, color: Color) -> IoResult<bool>
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(true)
if the color was set, Ok(false)
otherwise, and Err(e)
if there was an I/O error.
fn attr(&mut self, attr: Attr) -> IoResult<bool>
Sets the given terminal attribute, if supported. Returns Ok(true)
if the attribute was supported, Ok(false)
otherwise, and Err(e)
if
there was an I/O error.
fn supports_attr(&self, attr: Attr) -> bool
Returns whether the given terminal attribute is supported.
fn reset(&mut self) -> IoResult<()>
Resets all terminal attributes and color to the default.
Returns Ok()
.
fn get_ref<'a>(&'a self) -> &'a T
Gets an immutable reference to the stream inside
fn get_mut<'a>(&'a mut self) -> &'a mut T
Gets a mutable reference to the stream inside
Implementors
impl<T: Writer + Send> Terminal<T> for TerminfoTerminal<T>
impl<T: Writer + Send> Terminal<T> for WinConsole<T>