pub use windows_result::Result;
pub use windows_result::Error;
pub use windows_result::HRESULT as HResult;
use windows_sys::Win32::Foundation::SetLastError;
use windows_sys::Win32::Foundation::WIN32_ERROR;
#[inline]
pub fn convert_error(error: WIN32_ERROR) -> Error {
crate::Error::from_hresult(crate::HResult::from_win32(error))
}
pub fn reset_last_error() {
unsafe { SetLastError(0) };
}
#[inline]
pub fn get_last_error() -> Option<Error> {
let error = Error::from_win32();
match error == Error::empty() {
true => None,
false => Some(error),
}
}