File: console.rs

package info (click to toggle)
rust-crossterm-winapi 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 204 kB
  • sloc: makefile: 4
file content (26 lines) | stat: -rwxr-xr-x 545 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#[cfg(windows)]
use std::io::Result;

#[cfg(windows)]
use crossterm_winapi::ConsoleMode;

#[cfg(windows)]
fn change_console_mode() -> Result<()> {
    let console_mode = ConsoleMode::new()?;

    // get the current console mode:
    let _mode: u32 = console_mode.mode()?;

    // set the console mode (not sure if this is an actual value xp)
    console_mode.set_mode(10)
}

#[cfg(windows)]
fn main() -> Result<()> {
    change_console_mode()
}

#[cfg(not(windows))]
fn main() {
    println!("This example is for the Windows platform only.");
}