[go: up one dir, main page]

windows_gen 0.24.0

Code gen support for the windows crate
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use super::*;

pub fn gen_win32_error() -> TokenStream {
    quote! {
        impl ::std::convert::From<WIN32_ERROR> for ::windows::runtime::HRESULT {
            fn from(value: WIN32_ERROR) -> Self {
                Self(if value.0 as i32 <= 0 {
                    value.0
                } else {
                    (value.0 & 0x0000_FFFF) | (7 << 16) | 0x8000_0000
                })
            }
        }
    }
}