• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

src/H03-May-2022-324205

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D18-Jul-202074 65

.gitignoreH A D16-Nov-201518 32

.travis.ymlH A D27-Mar-2020569 2625

Cargo.tomlH A D18-Jul-20201.2 KiB3331

Cargo.toml.orig-cargoH A D18-Jul-2020688 2719

LICENSE-APACHEH A D18-Feb-201810.6 KiB202169

LICENSE-MITH A D18-Feb-20181 KiB2622

README.mdH A D27-Mar-2020821 3924

README.md

1# errno [![Build status](https://img.shields.io/travis/lambda-fairy/rust-errno.svg)](http://travis-ci.org/lambda-fairy/rust-errno) [![Cargo](https://img.shields.io/crates/v/errno.svg)](https://crates.io/crates/errno)
2
3Cross-platform interface to the [`errno`][errno] variable. Works on Rust 1.13 or newer.
4
5Documentation is available at <https://docs.rs/errno>.
6
7[errno]: https://en.wikipedia.org/wiki/Errno.h
8
9
10## Dependency
11
12Add to your `Cargo.toml`:
13
14```toml
15[dependencies]
16errno = "*"
17libc = "*"
18```
19
20
21## Examples
22
23```rust
24extern crate errno;
25use errno::{Errno, errno, set_errno};
26
27// Get the current value of errno
28let e = errno();
29
30// Set the current value of errno
31set_errno(e);
32
33// Extract the error code as an i32
34let code = e.0;
35
36// Display a human-friendly error message
37println!("Error {}: {}", code, e);
38```
39