witas 0.11.2

An asynchronous window library in Rust for Windows
Documentation
/// The error type for this crate.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
    #[error("{0}")]
    Api(windows::core::Error),
    #[error("ui thread closed")]
    UiThreadClosed,
    #[error("{0}")]
    Io(std::io::Error),
}

impl Error {
    pub(crate) fn from_win32() -> Self {
        windows::core::Error::from_win32().into()
    }
}

impl From<windows::core::Error> for Error {
    fn from(src: windows::core::Error) -> Self {
        Self::Api(src)
    }
}

impl From<std::io::Error> for Error {
    fn from(src: std::io::Error) -> Self {
        Self::Io(src)
    }
}

/// A specialized `Result` type for this crate.
pub type Result<T> = ::core::result::Result<T, Error>;