Crates.io | errno-no-std |
lib.rs | errno-no-std |
version | 0.2.2 |
source | src |
created_at | 2021-10-02 23:37:34.611653 |
updated_at | 2024-09-13 18:34:01.415874 |
description | Cross-platform interface to the `errno` variable. |
homepage | |
repository | https://github.com/A1-Triard/errno-no-std |
max_upload_size | |
id | 459585 |
size | 21,068 |
Cross-platform interface to the errno
variable.
An improved version of the errno
crate.
use errno::{Errno, errno, set_errno};
// Get the current value of errno
let e = errno();
// Set the current value of errno
set_errno(e);
// Extract the error code as an i32
let code = e.0;
// Display a human-friendly error message
println!("Error {}: {}", code, e);