Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are Unix errno constants in Rust?

Tags:

linux

unix

rust

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.

like image 343
Daniil Iaitskov Avatar asked Oct 15 '25 19:10

Daniil Iaitskov


1 Answers

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.