I am writing a program and there are a lot of places where UNIX error codes are required. Is there any standard place or library with predefined set of these constants in Rust? Maybe there is a way to import them from standard C headers.
It's a minor issue and I could define these constants at my own source code but I'd like to know all the options.
I need to return them rather than to parse and convert to human readable strings.
Many of these constants are available through the libc crate. It also offers bindings to the functions which you'd presumably call before checking for the error codes, so you should be using it anyway if you aren't already.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With