Struct crossterm_winapi::Console
source · pub struct Console { /* private fields */ }
Expand description
A wrapper around a screen buffer.
Implementations§
source§impl Console
impl Console
sourcepub fn output() -> Result<Console>
pub fn output() -> Result<Console>
Create new instance of Console
.
This created instance will use the default output handle (STD_OUTPUT_HANDLE) as handle for the function call it wraps.
sourcepub fn set_text_attribute(&self, value: u16) -> Result<()>
pub fn set_text_attribute(&self, value: u16) -> Result<()>
Sets the attributes of characters written to the console screen buffer by the WriteFile
or WriteConsole
functions, or echoed by the ReadFile
or ReadConsole
functions.
This function affects text written after the function call.
The attributes is a bitmask of possible character attributes.
This wraps
SetConsoleTextAttribute
.
sourcepub fn set_console_info(
&self,
absolute: bool,
rect: WindowPositions
) -> Result<()>
pub fn set_console_info( &self, absolute: bool, rect: WindowPositions ) -> Result<()>
Sets the current size and position of a console screen buffer’s window.
This wraps
SetConsoleWindowInfo
.
sourcepub fn fill_whit_character(
&self,
start_location: Coord,
cells_to_write: u32,
filling_char: char
) -> Result<u32>
pub fn fill_whit_character( &self, start_location: Coord, cells_to_write: u32, filling_char: char ) -> Result<u32>
Writes a character to the console screen buffer a specified number of times, beginning at the specified coordinates. Returns the number of characters that have been written.
This wraps
FillConsoleOutputCharacterA
.
sourcepub fn fill_whit_attribute(
&self,
start_location: Coord,
cells_to_write: u32,
dw_attribute: u16
) -> Result<u32>
pub fn fill_whit_attribute( &self, start_location: Coord, cells_to_write: u32, dw_attribute: u16 ) -> Result<u32>
Sets the character attributes for a specified number of character cells, beginning at the specified coordinates in a screen buffer. Returns the number of cells that have been modified.
This wraps
FillConsoleOutputAttribute
.
sourcepub fn largest_window_size(&self) -> Result<Coord>
pub fn largest_window_size(&self) -> Result<Coord>
Retrieves the size of the largest possible console window, based on the current text and the size of the display.
This wraps GetLargestConsoleWindowSize
sourcepub fn write_char_buffer(&self, buf: &[u8]) -> Result<usize>
pub fn write_char_buffer(&self, buf: &[u8]) -> Result<usize>
Writes a character string to a console screen buffer beginning at the current cursor location.
This wraps
WriteConsoleW
.
sourcepub fn read_single_input_event(&self) -> Result<InputRecord>
pub fn read_single_input_event(&self) -> Result<InputRecord>
Read one input event.
This wraps
ReadConsoleInputW
.
sourcepub fn read_console_input(&self) -> Result<Vec<InputRecord>>
pub fn read_console_input(&self) -> Result<Vec<InputRecord>>
Read all available input events without blocking.
This wraps
ReadConsoleInputW
.
sourcepub fn number_of_console_input_events(&self) -> Result<u32>
pub fn number_of_console_input_events(&self) -> Result<u32>
Get the number of available input events that can be read without blocking.
This wraps
GetNumberOfConsoleInputEvents
.