commit | 22b33229203b60f03fe16b5d2108f4d29ab6e824 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Fri Aug 09 01:11:51 2024 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Fri Aug 09 01:11:51 2024 +0000 |
tree | 87a299605d482d61f1cedf949ad5d13993758609 | |
parent | 6e0a684c9958d33d01e85b3cec4ceace2c7763c7 [diff] | |
parent | 2b83f00dad1ea4c961203a31c62da1a0ad2787ad [diff] |
Snap for 12205827 from 2b83f00dad1ea4c961203a31c62da1a0ad2787ad to 24Q4-release Change-Id: If807e29e1606120b0d3eb01d8ce920c30c053db3
Cross-platform interface to the errno
variable. Works on Rust 1.56 or newer.
Documentation is available at https://docs.rs/errno.
Add to your Cargo.toml
:
[dependencies] errno = "*"
std::io::Error
The standard library provides Error::last_os_error
which fetches errno
in the same way.
This crate provides these extra features:
#![no_std]
supportset_errno
functionextern crate errno; 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);
#![no_std]
Enable #![no_std]
support by disabling the default std
feature:
[dependencies] errno = { version = "*", default-features = false }
The Error
impl will be unavailable.