Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
src/ | 25-Apr-2025 | - | 436 | 294 | ||
.cargo-checksum.json | D | 25-Apr-2025 | 984 | 1 | 1 | |
Android.bp | D | 25-Apr-2025 | 1.3 KiB | 57 | 52 | |
CHANGELOG.md | D | 25-Apr-2025 | 3.4 KiB | 103 | 67 | |
Cargo.toml | D | 25-Apr-2025 | 1.3 KiB | 50 | 43 | |
LICENSE | D | 25-Apr-2025 | 10.6 KiB | 202 | 169 | |
LICENSE-APACHE | D | 25-Apr-2025 | 10.6 KiB | 202 | 169 | |
LICENSE-MIT | D | 25-Apr-2025 | 1 KiB | 26 | 22 | |
METADATA | D | 25-Apr-2025 | 377 | 18 | 17 | |
MODULE_LICENSE_APACHE2 | D | 25-Apr-2025 | 0 | |||
README.md | D | 25-Apr-2025 | 1.4 KiB | 63 | 37 | |
TEST_MAPPING | D | 25-Apr-2025 | 73 | 8 | 7 | |
cargo_embargo.json | D | 25-Apr-2025 | 69 | 6 | 5 | |
clippy.toml | D | 25-Apr-2025 | 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