consolex 0.1.0

Windows console utilities: probe, create, and release the console of the current process, plus a small CLI.
//! Error type shared across the crate.

use std::io;

use thiserror::Error;

/// Errors returned by the console operations of this crate.
#[derive(Debug, Error)]
pub enum Error {
    /// The Win32 call to create a console failed.
    #[error("could not create a console: {0}")]
    Alloc(#[source] io::Error),

    /// The Win32 call to release the console failed.
    #[error("could not release the console: {0}")]
    Free(#[source] io::Error),

    /// An unrecognized console mode string was given.
    #[error("invalid mode `{0}`; expected `auto`, `show`, `hide` or `keep`")]
    Parse(String),

    /// Waiting for a key press failed.
    #[error("could not read the console input: {0}")]
    Input(#[from] io::Error),
}

/// Result alias used by this crate.
pub type Result<T> = std::result::Result<T, Error>;