Crates.io | crossterm_winapi |
lib.rs | crossterm_winapi |
version | 0.9.1 |
source | src |
created_at | 2019-01-02 15:35:04.068669 |
updated_at | 2023-06-12 18:05:33.496457 |
description | WinAPI wrapper that provides some basic simple abstractions around common WinAPI calls |
homepage | |
repository | https://github.com/crossterm-rs/crossterm-winapi |
max_upload_size | |
id | 105049 |
size | 60,106 |
This crate provides some wrappers aground common used WinAPI functions.
The purpose of this library is originally meant for the crossterm, but could be used apart from it. Although, notice that it unstable right because some changes to the API could be expected.
This crate provides some abstractions over reading input, console screen buffer, and handle.
The following WinAPI calls:
The examples repository has more complete and verbose examples.
use crossterm_winapi::{ScreenBuffer, Handle};
fn print_screen_buffer_information() {
let screen_buffer = ScreenBuffer::current().unwrap();
// get console screen buffer information
let csbi = screen_buffer.info().unwrap();
println!("cursor post: {:?}", csbi.cursor_pos());
println!("attributes: {:?}", csbi.attributes());
println!("terminal window dimentions {:?}", csbi.terminal_window());
println!("terminal size {:?}", csbi.terminal_size());
}
use crossterm_winapi::{HandleType, Handle};
fn get_different_handle_types() {
let out_put_handle = Handle::new(HandleType::OutputHandle).unwrap();
let out_put_handle = Handle::new(HandleType::InputHandle).unwrap();
let curr_out_put_handle = Handle::new(HandleType::CurrentOutputHandle).unwrap();
let curr_out_put_handle = Handle::new(HandleType::CurrentInputHandle).unwrap();
}