3 releases
0.1.3 | Oct 7, 2022 |
---|---|
0.1.2 | Sep 30, 2022 |
0.1.0 | Feb 21, 2022 |
#241 in Windows APIs
87 downloads per month
Used in 7 crates
(via winresult)
1.5MB
22K
SLoC
🦀 winresult - windows result codes 🦀
Debug-friendly types for windows result codes.
Why?
-
u32
error codes are annoying todbg!(...)
.winresult
has awesomeDebug
impls. -
u32
error codes are annoying to view in your debugger.winresult
has awesome *.natvis files. Usenatvis-pdbs
! -
typoing
ERROR_WHATEVER
in amatch
is a mere warning.ERROR::WHATEVER
is a hard error.
(I'd still use#![deny(unreachable_patterns)]
anyways.) -
ERROR_INVALID_FUNCTION
==S_FALSE
(==1
.) Lame! -
ERROR_FILE_NOT_FOUND
(2) is a mess. A function orGetLastError
might return:label value notes ERROR_FILE_NOT_FOUND
0x00000002
Not an HRESULT
(would be "successful")HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
0x80070002
hresult.info "incorrectly" labels ERROR_*
as thisNTSTATUS_FROM_WIN32(ERROR_FILE_NOT_FOUND)
0xC0070002
IDK how frequently NtStatus
es get shoved intoGetLastError
, but I've seen weirderD3D10_ERROR_FILE_NOT_FOUND
0x88790002
Different facility, same code D3D11_ERROR_FILE_NOT_FOUND
0x887C0002
Different facility, same code -
ERROR_*
is a mixture ofHRESULT
s and non-HRESULT
s. Can you keep them straight? No. No you cannot. Stop lying.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Dependencies
~0.4–0.8MB
~19K SLoC