[−][src]Struct winapi_util::console::Console
A Windows console.
This represents a very limited set of functionality available to a Windows console. In particular, it can only change text attributes such as color and intensity. This may grow over time. If you need more routines, please file an issue and/or PR.
There is no way to "write" to this console. Simply write to stdout or stderr instead, while interleaving instructions to the console to change text attributes.
A common pitfall when using a console is to forget to flush writes to stdout before setting new text attributes.
Example
use winapi_util::console::{Console, Color, Intense}; let mut con = Console::stdout().unwrap(); con.fg(Intense::Yes, Color::Cyan).unwrap(); println!("This text will be intense cyan."); con.reset().unwrap(); println!("This text will be normal.");
Methods
impl Console
[src]
pub fn stdout() -> Result<Console>
[src]
Create a new Console to stdout.
If there was a problem creating the console, then an error is returned.
pub fn stderr() -> Result<Console>
[src]
Create a new Console to stderr.
If there was a problem creating the console, then an error is returned.
pub fn fg(&mut self, intense: Intense, color: Color) -> Result<()>
[src]
Apply the given intensity and color attributes to the console foreground.
If there was a problem setting attributes on the console, then an error is returned.
pub fn bg(&mut self, intense: Intense, color: Color) -> Result<()>
[src]
Apply the given intensity and color attributes to the console background.
If there was a problem setting attributes on the console, then an error is returned.
pub fn reset(&mut self) -> Result<()>
[src]
Reset the console text attributes to their original settings.
The original settings correspond to the text attributes on the console
when this Console
value was created.
If there was a problem setting attributes on the console, then an error is returned.
pub fn set_virtual_terminal_processing(&mut self, yes: bool) -> Result<()>
[src]
Toggle virtual terminal processing.
This method attempts to toggle virtual terminal processing for this console. If there was a problem toggling it, then an error returned. On success, the caller may assume that toggling it was successful.
When virtual terminal processing is enabled, characters emitted to the console are parsed for VT100 and similar control character sequences that control color and other similar operations.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Console
impl Send for Console
impl Sync for Console
impl Unpin for Console
impl UnwindSafe for Console
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,