#winapi #error-code #windows

no-std w32-error

Encapsulates Windows API error codes

1 stable release

1.0.0 Mar 31, 2020

#138 in Windows APIs

Download history 262/week @ 2024-07-28 184/week @ 2024-08-04 299/week @ 2024-08-11 510/week @ 2024-08-18 813/week @ 2024-08-25 581/week @ 2024-09-01 540/week @ 2024-09-08 638/week @ 2024-09-15 735/week @ 2024-09-22 776/week @ 2024-09-29 634/week @ 2024-10-06 1084/week @ 2024-10-13 654/week @ 2024-10-20 1068/week @ 2024-10-27 1021/week @ 2024-11-03 1174/week @ 2024-11-10

3,962 downloads per month
Used in 8 crates (2 directly)

Apache-2.0 OR MIT

12KB
148 lines

w32-error

Travis CI Crates.io Docs.rs

w32-error is a Rust crate for encapsulating Windows API error codes. It provides the W32Error type, a thin wrapper over a DWORD with trait implementations for error handling.

Features

  • #![no_std]-friendly - almost all of w32-error is available to #![no_std] crates. Parts that require libstd (Error trait impl, conversion to/from io::Error) are kept behind an opt-in feature gate.
  • Zero overhead - W32Error is guaranteed to have the same layout as a DWORD. Display::fmt doesn't access the heap; instead, it uses a small buffer on the stack to receive error messages.

Usage

To use w32-error, simply add it to your Cargo.toml.

By default, w32-error is configured for a #![no_std] environment:

[dependencies]
w32-error = "^1.0.0"

Alternatively, features that require libstd can be manually enabled:

[dependencies]
w32-error = { version = "^1.0.0", features = ["std"] }

For more details, see the API documentation.

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

~175KB