| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| .github/ | 06-Sep-2024 | - | 80 | 72 | ||
| src/ | 06-Sep-2024 | - | 435 | 293 | ||
| .cargo_vcs_info.json | D | 06-Sep-2024 | 94 | 6 | 6 | |
| .gitignore | D | 06-Sep-2024 | 18 | 3 | 2 | |
| Android.bp | D | 06-Sep-2024 | 1.1 KiB | 47 | 44 | |
| CHANGELOG.md | D | 06-Sep-2024 | 3.2 KiB | 97 | 63 | |
| Cargo.toml | D | 06-Sep-2024 | 1.3 KiB | 50 | 43 | |
| Cargo.toml.orig | D | 06-Sep-2024 | 837 | 34 | 26 | |
| LICENSE | D | 06-Sep-2024 | 10.6 KiB | 202 | 169 | |
| LICENSE-APACHE | D | 06-Sep-2024 | 10.6 KiB | 202 | 169 | |
| LICENSE-MIT | D | 06-Sep-2024 | 1 KiB | 26 | 22 | |
| METADATA | D | 06-Sep-2024 | 475 | 22 | 21 | |
| MODULE_LICENSE_APACHE2 | D | 06-Sep-2024 | 0 | |||
| OWNERS | D | 06-Sep-2024 | 149 | 8 | 6 | |
| README.md | D | 06-Sep-2024 | 1.4 KiB | 63 | 37 | |
| cargo_embargo.json | D | 06-Sep-2024 | 42 | 5 | 4 | |
| clippy.toml | D | 06-Sep-2024 | 14 | 2 | 1 |
README.md
1# errno [](https://github.com/lambda-fairy/rust-errno/actions/workflows/main.yml) [](https://crates.io/crates/errno) 2 3Cross-platform interface to the [`errno`][errno] variable. Works on Rust 1.56 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 = "*" 17``` 18 19 20## Comparison with `std::io::Error` 21 22The standard library provides [`Error::last_os_error`][last_os_error] which fetches `errno` in the same way. 23 24This crate provides these extra features: 25 26- No heap allocations 27- Optional `#![no_std]` support 28- A `set_errno` function 29 30[last_os_error]: https://doc.rust-lang.org/std/io/struct.Error.html#method.last_os_error 31 32 33## Examples 34 35```rust 36extern crate errno; 37use errno::{Errno, errno, set_errno}; 38 39// Get the current value of errno 40let e = errno(); 41 42// Set the current value of errno 43set_errno(e); 44 45// Extract the error code as an i32 46let code = e.0; 47 48// Display a human-friendly error message 49println!("Error {}: {}", code, e); 50``` 51 52 53## `#![no_std]` 54 55Enable `#![no_std]` support by disabling the default `std` feature: 56 57```toml 58[dependencies] 59errno = { version = "*", default-features = false } 60``` 61 62The `Error` impl will be unavailable. 63