Trait term::Terminal
[−]
[src]
pub trait Terminal: Write { type Output: Write; fn fg(&mut self, color: Color) -> Result<bool>; fn bg(&mut self, color: Color) -> Result<bool>; fn attr(&mut self, attr: Attr) -> Result<bool>; fn supports_attr(&self, attr: Attr) -> bool; fn reset(&mut self) -> Result<bool>; fn get_ref(&self) -> &Self::Output; fn get_mut(&mut self) -> &mut Self::Output; fn into_inner(self) -> Self::Output
where
Self: Sized; }
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
A terminal with similar capabilities to an ANSI Terminal (foreground/background colors etc).
Associated Types
type Output: Write
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
The terminal's output writer type.
Required Methods
fn fg(&mut self, color: Color) -> Result<bool>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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) -> Result<bool>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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) -> Result<bool>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Returns whether the given terminal attribute is supported.
fn reset(&mut self) -> Result<bool>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Resets all terminal attributes and colors to their defaults.
Returns Ok(true)
if the terminal was reset, Ok(false)
otherwise, and Err(e)
if there
was an I/O 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 get_ref(&self) -> &Self::Output
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Gets an immutable reference to the stream inside
fn get_mut(&mut self) -> &mut Self::Output
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Gets a mutable reference to the stream inside
fn into_inner(self) -> Self::Output where
Self: Sized,
Self: Sized,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Returns the contained stream, destroying the Terminal
Implementors
impl<T: Write + Send> Terminal for TerminfoTerminal<T> type Output = T;