4 releases

0.1.3 Oct 7, 2022
0.1.2 Sep 30, 2022
0.1.1 Feb 21, 2022
0.1.0 Feb 21, 2022

#97 in Windows APIs

Download history 26/week @ 2024-07-22 28/week @ 2024-07-29 29/week @ 2024-08-05 34/week @ 2024-08-12 21/week @ 2024-08-19 25/week @ 2024-08-26 23/week @ 2024-09-02 24/week @ 2024-09-09 21/week @ 2024-09-16 59/week @ 2024-09-23 33/week @ 2024-09-30 15/week @ 2024-10-14 26/week @ 2024-10-21 25/week @ 2024-10-28 20/week @ 2024-11-04

86 downloads per month
Used in 6 crates

Apache-2.0 OR MIT

4MB
36K SLoC

🦀 winresult - windows result codes 🦀

Debug-friendly types for windows result codes.

GitHub crates.io docs.rs License

Why?

  • u32 error codes are annoying to dbg!(...). winresult has awesome Debug impls.

  • u32 error codes are annoying to view in your debugger. winresult has awesome *.natvis files. Use natvis-pdbs!

  • typoing ERROR_WHATEVER in a match 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 or GetLastError 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 this
    D3D10_ERROR_FILE_NOT_FOUND 0x88790002 Different facility, same code
    D3D11_ERROR_FILE_NOT_FOUND 0x887C0002 Different facility, same code
  • ERROR_* is a mixture of HRESULTs and non-HRESULTs. Can you keep them straight? No. No you cannot. Stop lying.

License

Licensed under either of

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